Ad Widget

Collapse

Remote Command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zeeshan
    Junior Member
    • Apr 2013
    • 18

    #1

    Remote Command

    Hi Guys,

    i have been trying to restart Clamd daemon if the daemon is stopped through remote commands. I can see the command gets sent to the zabbix-agent but it does nothing. i have ran the debug and got the following response:

    32045:20130529:151354.941 Processing request.
    32045:20130529:151354.941 Requested [system.run["sudo /etc/init.d/clamd start","nowait"]]
    32045:20130529:151354.941 Executing command 'sudo /etc/init.d/clamd start'
    32045:20130529:151354.944 Sending back [1]

    in the agent config file EnableRemoteCommands=1 is set. the zabbix user has full rights to run the command in the sudoers file and this command does run from the command line.

    If anyone could shed some light on this it will be highly appreciated.

    many thanks,

    Zeeshan
  • guaracy_tome
    Junior Member
    • May 2013
    • 7

    #2
    Hi Zeeshan,

    Could you post the the agent log?

    Thank you

    Comment

    • Zeeshan
      Junior Member
      • Apr 2013
      • 18

      #3
      Hi,

      Many thanks for you reply, really appreciate it. please the agent log below. it says executing command but nothing happens.

      13133:20130530:102702.205 Starting Zabbix Agent [web4stage]. Zabbix 2.0.5 (revision 33558).
      13151:20130530:102702.217 agent #0 started [collector]
      13152:20130530:102702.218 agent #1 started[listener]
      13153:20130530:102702.218 agent #2 started[listener]
      13154:20130530:102702.218 agent #3 started[listener]
      13155:20130530:102702.219 agent #4 started [active checks]
      13153:20130530:102751.809 Executing command 'sudo /etc/init.d/clamd start'


      Many thanks,


      Zeeshan

      Comment

      • guaracy_tome
        Junior Member
        • May 2013
        • 7

        #4
        Please, try to look into clamd log ( http://linux.die.net/man/5/clamd.conf ). If you don't see anything useful, try enable debug log on agent to search for any clue.

        Comment

        • Zeeshan
          Junior Member
          • Apr 2013
          • 18

          #5
          Hi again,

          Many thanks for your reply, its not a problem with clam antivirus, i am just trying to start a service through remote commands if the service fails. i did run a debug and copied the entries i found in my first post.

          i have followed all the steps as mentioned in the zabbix 2.0 manual but the remote command goes to the zabbix agent but does not execute.

          Cheers for all your help.

          thanks

          Zeeshan

          Comment

          • Zeeshan
            Junior Member
            • Apr 2013
            • 18

            #6
            Hello again,

            i figured out what the problem was, i had disabled the requiretty option in visudo but the changed hadn't been picked up. i just gave the box a reboot and it worked don't know why it wanted a reboot but that fixed the problem and remote commands are executing!

            Cheers for all your help!

            Z

            Comment

            • guaracy_tome
              Junior Member
              • May 2013
              • 7

              #7
              I understand.
              When I said debug log I mean to set 4 for log in agent.conf. There will be a LOT of information.

              Maybe we can find some hide pieces of information...

              ### Option: DebugLevel
              # Specifies debug level
              # 0 - no debug
              # 1 - critical information
              # 2 - error information
              # 3 - warnings
              # 4 - for debugging (produces lots of information)
              #
              # Mandatory: no
              # Range: 0-4
              # Default:
              # DebugLevel=3

              Comment

              • carl_qin
                Junior Member
                • May 2013
                • 11

                #8
                Hi Zeeshan,
                I got exact same issue with you.The remote command is not executed and I tried to disable requiretty. But still not lucky.
                Below is what I did:
                visudo
                Defaults !requiretty
                Defaults !visiblepw

                Then I reboot both of zabbix server and zabbix agent server.But remote command isn't still executed.

                Could you let me know what changes you did in visudo.
                By the way, both of zabbix server version and agent version are 2.0.6

                Appreciate for your help
                Carl

                Comment

                • Zeeshan
                  Junior Member
                  • Apr 2013
                  • 18

                  #9
                  Hi Carl,

                  could you paste the snippet of the Defaults Requiretty from the visudo, plus have a look in sudo.log to see what happens when the command is running.

                  just to confirm you are disabling Defaults requiretty by doing

                  #Defaults requiretty

                  many thanks,

                  Z

                  Comment

                  • carl_qin
                    Junior Member
                    • May 2013
                    • 11

                    #10
                    Hi Zeeshan,
                    Sorry to reply late.Below is the visudo snippet about disabling requiretty.

                    #
                    # Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
                    # You have to run "ssh -t hostname sudo <cmd>".
                    #
                    Defaults !requiretty

                    #
                    # Refuse to run if unable to disable echo on the tty. This setting should also be
                    # changed in order to be able to use sudo without a tty. See requiretty above.
                    #
                    Defaults !visiblepw

                    I ever tried !Defaults requiretty,but still didn't work.The weird thing is there is no sudo.log in this server.

                    Thank you very much
                    Carl

                    Comment

                    • Zeeshan
                      Junior Member
                      • Apr 2013
                      • 18

                      #11
                      Hi Carl,

                      in the visudo could you change

                      Defaults !requiretty
                      Defaults !visiblepw
                      to

                      #Defaults requiretty
                      #Defaults visiblepw

                      # character comments out the entry next to it so it isnt used in the config.

                      could you try this, i am assuming you are using a fair current distro of linux?

                      thanks

                      Z

                      Comment

                      • carl_qin
                        Junior Member
                        • May 2013
                        • 11

                        #12
                        Thanks Zeeshan,I will try it.

                        Comment

                        • Zeeshan
                          Junior Member
                          • Apr 2013
                          • 18

                          #13
                          any luck ?

                          Z

                          Comment

                          • carl_qin
                            Junior Member
                            • May 2013
                            • 11

                            #14
                            Thank you, Zeeshan. I haven't tried yet.Will try next down time.

                            Comment

                            Working...