Ad Widget

Collapse

running programs/services/processes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • micholus
    Junior Member
    • Mar 2009
    • 7

    #1

    running programs/services/processes

    Hi all.
    Is there a way to get a list of running programs/services/processes on a host with zabbix agent?

    Regards,
    Micholus
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    Have a search in the forums. I know myself and others have posted some solutions for this. If you're having trouble finding something that works just ask again. :-)

    Try looking for some of the following terms, process list remote command
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • micholus
      Junior Member
      • Mar 2009
      • 7

      #3
      Ok, I did a search and found only tips how to if check specific service is running.
      Is there a way to get a list of all running services?
      Thanks,
      Micholus
      Last edited by micholus; 18-03-2009, 09:42.

      Comment

      • trikke
        Senior Member
        • Aug 2007
        • 140

        #4
        Hi,

        On NT: "net start" or "wmic Services get *"
        On Nix: "ps -ef"

        From server: zabbix_get -s <hostname> -ksystem.run["cmd"]

        Greets
        Patrick

        Comment

        • micholus
          Junior Member
          • Mar 2009
          • 7

          #5
          Thanks for reply!
          When I run it from server I get ZBX_NOTSUPPORTED.
          How Can I use it in a template? Should I create Item system.run["net start"] with type "Text"?
          EDIT:
          I've managed to get a list of running services.
          In zabbix_agentd.conf I added : UserParameter=service.running, net start
          And in zabbix server an item: service.running with type text.
          It works just fine
          I've tried to do the same with a list of running processes:
          UserParameter=pr.running, wmic process get Caption,Commandline,Processid
          But when I try to run it from server :zabbix_get -s host -k pr.running
          I get: "Timeout while executing operation."
          I've also tried with pslist.exe from sysinternatls
          UserParameter=pr.running, pslist.exe -m
          but I got the same result :|
          I would really appreciate any help


          micholus
          Last edited by micholus; 19-03-2009, 12:35.

          Comment

          • nelsonab
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2006
            • 1233

            #6
            I wrote a script a while ago to do this which I have attached. It must be run as a remote command. When it is run it will take the output of the script given on the command line and then send that to the server into the appropriate log item.

            When I last worked with this script it was definitely in development. I don't remember it's state (working/broken/bug in Zabbix), however it can be useful to point you in the right direction.

            For the remote command action I have the following entry:
            lisa:/etc/zabbix/scripts/ruby_proc_sender.rb -s server.ip.address.or.host.name.here -h lisa -k trap.log -c "ps -eo pcpu\,pmem\,command|sort -k1|tail -10" -D >> /tmp/debug.out

            This will run the ruby script attached which sits on my host named Lisa. The script is then fed another sub script or set of commands, the results of which is fed back to the server.

            You will also need to enable remote commands on your agent:
            EnableRemoteCommands=1

            The script is pretty well documented overall. I do recall one very annoying and hard to figure out how to fix bug from when I was working on this though. There was a limitation in the string length for calling external scripts. I don't know if this bug still exists or not.
            Attached Files
            RHCE, author of zbxapi
            Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
            Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

            Comment

            • micholus
              Junior Member
              • Mar 2009
              • 7

              #7
              Everything worked just fine!
              Thx for help
              Michols

              Comment

              Working...