Ad Widget

Collapse

Remote commands execution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dunedin
    Junior Member
    • Dec 2005
    • 12

    #1

    Remote commands execution

    Hello,

    Is it possible to execute remote commands from zabbix (say stopping/starting IIS or sql etc...) ?
  • ReefShark
    Member
    • Dec 2005
    • 43

    #2
    It is now (beta8)

    Comment

    • ianh
      Junior Member
      • Mar 2006
      • 7

      #3
      what parameter does it take in the "remote command" field?

      Also in zabbix_agentd.conf i found out that remote commands was disabled so i uncommented it and it should enabled it correct?

      # Enable remote commands for ZABBIX agent. By default remote commands disabled.
      EnableRemoteCommands=1

      Cheers

      Comment

      • kempkep
        Junior Member
        • Feb 2006
        • 18

        #4
        Remote Commands usage

        The remote command should be of the form:

        <hostname>:<command>

        Note: The hostname cannot be a fully qualified one, it doesn't match the reg expression in the code. So if you defined hosts fully qualified you need to change it.

        Also make sure you update the agent on the host you want to run the command on. A system.run command is run on the agent and this is not supported prior to 1.1beta8.

        Comment

        • ianh
          Junior Member
          • Mar 2006
          • 7

          #5
          Thanks for the tip kempkep

          I can successfully add a remote command action however i don't think the command is executing. FYI, I am using zabbix 1.1beta8 on all my test machines.

          Here is my remote command "amon01:service sendmail start" -- starts my sendmail

          First off, i stopped my sendmail service so when the action is fired it starts my service sendmail, thus i am able to check if the remote command works.

          Assigning a trigger that when fired sends a email and remote command, i get the email but when i check my sendmail status it has not started.

          One other thing is that if a remote command action is fired, does it show up in the "history of actions page"?

          Has anyone got remote command working?

          **any docs on remote command??

          Cheers

          Comment

          • kempkep
            Junior Member
            • Feb 2006
            • 18

            #6
            Remote commands execution

            Check the agent log, increase the debug level to 4 and restart. You should see something like this...

            015114:20060330:124941 Got line:system.run[/tmp/mycommand >/tmp/remcom.log]
            015114:20060330:124941 Run remote command '/tmp/mycommand >/tmp/remcom.log'
            015114:20060330:124941 Sending back:1

            Also check that the agent is working and not saying ZBX_NOTSUPPORTED, ie: it should look like this...

            akcux05:/etc/zabbix##### /usr/local/bin/zabbix_agentd -p
            system.run[echo test] [u|1]

            If it does not show you're probably running the wrong agent or the script/command is not executable.

            You're right about it not showing in the actions history - even when it works

            Just had another thought - what you are doing won't work as the script will run as zabbix and a service command will need to run as root. So unless you're doing a setuid on the service command, you'll need to use sudo or create a wrapper script that you setuid. Maybe do the wrapper first and direct output to a log somewhere.
            Last edited by kempkep; 30-03-2006, 06:17.

            Comment

            • ianh
              Junior Member
              • Mar 2006
              • 7

              #7
              Once again thanks for the quick response kempkep.

              I'll keep working on it...

              Comment

              • tuhl
                Junior Member
                • May 2005
                • 17

                #8
                Exit status / stdout / stderr of remote command

                Hi!

                Remote command invocation works (user zabbix). There should be a log of the exit status and the output of stdout and stderr (up to 512 bytes)

                Comment

                • Corsar
                  Junior Member
                  • Aug 2005
                  • 24

                  #9
                  So ... can you help me?
                  How i can add remote command execution with web-frontend?

                  1. Put EnableRemoteCommands=1 in agentd.conf
                  2. Add some item and trigger with web-frontend
                  3. But when i'm trying to add action:
                  -------------------------------------
                  host.domain.ru:whoami | mail [email protected]
                  -------------------------------------
                  Web-frontend say me:
                  [ERROR:Cannot add action]
                  incorrect command: 'host.domain.ru:mail [email protected]'

                  Where is my mistake?

                  Comment

                  • grabber
                    Member
                    • Mar 2005
                    • 85

                    #10
                    @Corsar

                    reading the above it would seem that you cannot use FQDN for the host. So you have to switch that off....

                    Comment

                    • Corsar
                      Junior Member
                      • Aug 2005
                      • 24

                      #11
                      Ooops ...
                      Sorry
                      I see this condition ...

                      But, i think what this is .... khm ... mistake developer's ...
                      FQDN != remote command execution
                      It's very uncomfortable ...

                      May i hope, for this condition (FQDN != remote command execution) eliminate?

                      Comment

                      • Borrie
                        Junior Member
                        • Jun 2006
                        • 18

                        #12
                        No arguments while running scripts?

                        -edited by me-
                        Last edited by Borrie; 29-06-2006, 10:19.

                        Comment

                        Working...