Ad Widget

Collapse

running remote command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thgnss
    Junior Member
    • Feb 2010
    • 4

    #1

    running remote command

    Hi all,
    I have some problems with remote command.
    I'm monitorin a host named host1 e when the apache server is down I would restart it. So the action I configured for the remote command contain:
    host1:sudo /etc.init.d/apache2 start
    But when the apache trigger switch no action is executed.
    Analizing the server log file through:

    tail /var/log/zabbix-server/zabbix_server.log

    and the output is:

    3433:20100216:231956 Type of received value [1] is not sutable for [system.run[sudo /etc.init.d/apache2 start,nowait]@stefano] having type [-72515583] 3433:20100216:231956 Returning NOTSUPPORTED

    Any help would be appreciated.
    Thanks
  • Akao
    Junior Member
    • Mar 2010
    • 15

    #2
    I have a similar problem, I try to restart apache when it is down through an action.

    First I grant permission to zabbix user to execute command without pass in visudo and EnableRemoteCommands in zabbix_agentd.conf.

    Second, I configure remote command.

    (hostname): sudo /etc/rc.d/init.d/httpd restart

    So, i stop apache to test it, I see in dashboard that the action appears as sent, but apache continues down.

    What can it be?? Permissions problem?

    thanks

    PS - in server log nothing appears, and now i realized that in client there is no zabbix_agentd.log but the agent is working.
    Last edited by Akao; 10-03-2010, 13:58.

    Comment

    • Akao
      Junior Member
      • Mar 2010
      • 15

      #3
      Originally posted by Akao
      I have a similar problem, I try to restart apache when it is down through an action.

      First I grant permission to zabbix user to execute command without pass in visudo and EnableRemoteCommands in zabbix_agentd.conf.

      Second, I configure remote command.

      (hostname): sudo /etc/rc.d/init.d/httpd restart

      So, i stop apache to test it, I see in dashboard that the action appears as sent, but apache continues down.

      What can it be?? Permissions problem?

      thanks

      PS - in server log nothing appears, and now i realized that in client there is no zabbix_agentd.log but the agent is working.
      I am testing in the zabbix server too but the same happens, service doesnt restart. In log appears this:

      30908:20100311:114955.216 In run_commands()
      30908:20100311:114955.217 In get_next_command(command_list:Servidor_Zabbix: /usr/bin/sudo /etc/rc.d/init.d/sshd start)
      30908:20100311:114955.217 End get_next_command(alias:Servidor_Zabbix,is_group:0, command: /usr/bin/sudo /etc/rc.d/init.d/sshd start)
      30908:20100311:114955.217 In run_remote_command(hostname:Servidor_Zabbix,comman d: /usr/bin/sudo /etc/rc.d/init.d/sshd start)
      30908:20100311:114955.217 Query [txnlev:1] [select hostid,host,useip,ip,dns,port,useipmi,ipmi_ip,ipmi _port,ipmi_authtype,ipmi_privilege,ipmi_username,i pmi_password from hosts where status in (0) and host='Servidor_Zabbix' and hostid between 000000000000000 and 099999999999999]
      30908:20100311:114955.219 In get_value_agent() host:'Servidor_Zabbix' addr:'192.168.200.10' key:''
      30908:20100311:114955.224 Sending [system.run[/usr/bin/sudo /etc/rc.d/init.d/sshd start,nowait]
      ]
      30908:20100311:114955.244 Get value from agent result: '1'
      30908:20100311:114955.246 End run_remote_command(result:0)
      30908:20100311:114955.246 In get_next_command(command_list
      30908:20100311:114955.247 Result get_next_command [EOL]
      30908:20100311:114955.248 End run_commands()

      News, i have created another remote command that creates a file. echo 0 > /tmp/aaa.txt and the file is created well, so I understand nothing, remote command works for me creating file but not restarting services...
      Last edited by Akao; 11-03-2010, 13:00.

      Comment

      • Akao
        Junior Member
        • Mar 2010
        • 15

        #4
        I continue my monologue, I realize that remote commands without sudo are executed well, but when I need to use sudo it doesn't work.

        sudo echo 0 > /tmp/a.txt --> dont work
        echo 0 > /tmp/a.txt --> work

        The problem is that I dont know how to fix it, Zabbix user has permissions in sudoers to execute all commands without pass, i tested the commands before in a shell and work.

        Any idea?

        Comment

        • Akao
          Junior Member
          • Mar 2010
          • 15

          #5
          Problem solved.

          I just have to comment out in visudo the line default requiretty.

          Comment

          • willian.guedes
            Junior Member
            • Mar 2011
            • 3

            #6
            Thanks

            Thanks ! It worked perfectly without the "default requiretty" in /etc/sudoers

            Comment

            Working...