Ad Widget

Collapse

Help with Remote Commands

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dav_man
    Junior Member
    • Jul 2006
    • 7

    #1

    Help with Remote Commands

    I searched for threads with solutions but I'm not having any luck...

    I have set up the following test scenario where I check for SSH running when I manually stop SSH, Zabbix does its thing and emails the right people then attempts to run a remote command to restart the SSH service. I have done the following in the sudoers file (very liberal rights):

    zabbix ALL=(ALL) NOPASSWD:ALL

    Then I made sure I had the right command in zabbix for the action:

    ServerName:sudo /etc/rc.d/sshd restart

    It is still not working and when on the host when I try to run sudo -u zabbix /etc/rc.d/sshd restart I get an error that says "cannot read proc/9711/exe permission denied.

    Any help would be greatly appreciated.... I really want to use the remote commands.

    And yes... with Debug level 4 the command is actually getting executed on the host.

    Dave
  • dav_man
    Junior Member
    • Jul 2006
    • 7

    #2
    So?

    Does anyone have remote commands working? Restarting daemons?

    Comment

    • grabber
      Member
      • Mar 2005
      • 85

      #3
      Originally posted by dav_man

      It is still not working and when on the host when I try to

      run sudo -u zabbix /etc/rc.d/sshd restart

      I get an error that says "cannot read proc/9711/exe permission denied.

      Dave

      Does the user zabbix have rights to run ".../sshd restart"? get that working first before tryinf remoate commands.

      Ian

      Comment

      • dav_man
        Junior Member
        • Jul 2006
        • 7

        #4
        Still no luck...

        I decided to do a new install on a test server. As before the install went great. Sudo privledges are setup properly for user zabbix and both the sudo /etc/init.d/sshd restart command and a script I made to run that command execute on the local host flawlessly while logged in as Zabbix. Here are snippets from both the server log and the agent log (below) - the error is the same for the direct call or when going through the script... Also they never show up in the action history. The Server and agent are on the same server in this exercise.

        Once again, any help is appreciated... I want to use Zabbix but if the remote functionality does not work I'll have to try something else.

        Dave


        For calling /etc/init.d/ssh restart:

        Server error: 018005:20060711:123800 Type of received value [1] is not sutable for [system.run[ sudo /etc/init.d/sshd restart,nowait]@Test01] having type [2052388396] 018005:20060711:123800 Returning NOTSUPPORTED

        Agent error: 019435:20060711:123700 Before read() 019435:20060711:123700 After read() 2 [50] 019435:20060711:123700 Got line:system.run[ sudo /etc/init.d/sshd restart,nowait] 019435:20060711:123700 RUN_COMMAND cmd = 'system.run[ sudo /etc/init.d/sshd restart,nowait]' 019435:20060711:123700 RUN_COMMAND flag = 'nowait' 019435:20060711:123700 Run remote command ' sudo /etc/init.d/sshd restart' 019435:20060711:123700 RUN_COMMAND runed as NOWAIT 019435:20060711:123700 Sending back:1 Test01:/tmp # tail zabbix_agentd.log 019435:20060711:123700 Sending back:1 019439:20060711:123708 In refresh_metrics() 019439:20060711:123708 get_active_checks: host[10.10.10.13] port[10051] 019439:20060711:123708 Sending [ZBX_GET_ACTIVE_CHECKS util01 ]

        Comment

        • dav_man
          Junior Member
          • Jul 2006
          • 7

          #5
          Looks Like I got it...

          So I tried a few things and now it seems to work. One thing I did was go to hostnames in the config files instead of IP addresses. This exposed some messed up entries in my hosts file that I then removed. It looks good for now.

          Thanks,

          Dave

          Comment

          • hostit1
            Junior Member
            • Sep 2006
            • 6

            #6
            Make sure that the service (ie sshd) is chmodded to 755 and not 700

            Hope this helps

            Comment

            Working...