Ad Widget

Collapse

How-To monitor & trigger based on process in 'ps -ef'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dernwine
    Junior Member
    • Mar 2010
    • 10

    #1

    How-To monitor & trigger based on process in 'ps -ef'

    I am a Zabbix newbie. I've looked through the forums but can't find anything explicitly on how to monitor and trigger based on the results of a process being found in a 'ps' response on the server with zabbix_agentd running.

    Closest I found was: proc.num[<name>,<user>,<state>]

    Is this the correct way to do this task?

    Can someone give me an example on how to set up a monitor for say checking if process XYZ is running in a 'ps' listing and then triggering if it isn't found?


    Thank you!
  • MrKen
    Senior Member
    • Oct 2008
    • 652

    #2
    Hi,
    Take a look at the end of your zabbix_agentd.conf files on each server, there you will see UserParameter=

    That would be the best way of doing this with the zabbix agent installed.

    Example: UserParameter=ZabAg,ps -ef | grep zabbix_agent | wc -l

    The result of that will actually be 1 more than the real value because it will include 'grep zabbix agent', but we can deal with that with the Trigger.
    Next you need to create an item with a Key call ZabAg on each Host.

    Then make a Trigger which will fire if the result is less than 2
    {MyServer:ZabAg.last(0)}<2

    Of course you would need to change things depending on what process or info you're looking for. UserParameters are great for pulling the results from commands or scripts, you can read more here: http://www.zabbix.com/documentation/1.8/manual/config/user_parameters

    MrKen
    Disclaimer: All of the above is pure speculation.

    Comment

    • dernwine
      Junior Member
      • Mar 2010
      • 10

      #3
      Thanks MrKen. Will give it a try and advise results.

      Regards,
      David

      Comment

      • dernwine
        Junior Member
        • Mar 2010
        • 10

        #4
        ERROR: Cannot add trigger



        When I try to add the trigger I am getting the following error:

        * No such monitored parameter (MFPAg) for host (MyHostName).

        My Trigger expression looks like:

        {MyHostName:MFPAg.last(0)}<1

        My UserParameter line in my zabbix_agentd.conf looks like:

        UserParameter=MFPAg,ps -ef | grep DomainDaemon | grep -v "grep" | wc -l | awk '{print $1}'

        The zabbix_agentd.log is showing everythign running, and I'm able to see the AIX template monitored items just fine. I'm about cross-eyed from reading the manual - any ideas where I'm going wrong?

        Thanks,
        David

        Comment

        • dernwine
          Junior Member
          • Mar 2010
          • 10

          #5
          Resolved - How to monitor unix-based processes

          MrKen,

          Figured it out. I misunderstood your post. When you indicated I needed to create an "item with a key" I understood the "key" in the "UserParameter" field, not creating a key that gets linked to the trigger on the server.

          After I created the key on the server referencing the "key name" on the client everything worked.

          Quick question: For a "UserParameter" field, will the "Item Type" always be "Zabbix Agent"? What does "Simple Check" then provide?

          Thanks again for the help.

          Regards,
          David

          Comment

          • craigwelsh
            Junior Member
            • Sep 2005
            • 12

            #6
            ps should just list running processes and I assume is what the agent uses in the background to do the proc built in test anyway. I haven't tested this on AIX yet though as i've had issues with Solaris at the moment.

            Personally i'd just use proc.num and I think you can use * for any user.

            Check apache, pop3, mysql etc examples in Template_Linux for good examples of how you normally do these items and also the triggers. I've taken these out of the default template and put them in separate ones as they aren't on a default box.

            Presumably adding things in the agentd.conf is also less dynamic if you need to change it in future too.

            Comment

            • MrKen
              Senior Member
              • Oct 2008
              • 652

              #7
              Originally posted by dernwine

              Quick question: For a "UserParameter" field, will the "Item Type" always be "Zabbix Agent"? What does "Simple Check" then provide?

              Thanks again for the help.

              Regards,
              David
              Hi David, congrats on getting it working!
              As UserParameters are part of the agent.conf, then yes they will be type Zabbix Agent.
              Simple Checks are for agentless monitoring - simple ping, check ports, etc

              Btw, Craig makes a valid point re proc.num, however I have had some items set up like that which just wouldn't work. Which just means that if proc.num(blah) doesn't work then you can always set up a UserParameter to run a command or script.

              Happy zabbixing.
              Disclaimer: All of the above is pure speculation.

              Comment

              Working...