Ad Widget

Collapse

Monitoring Linux Process

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • miramira007
    Member
    • Sep 2015
    • 89

    #1

    Monitoring Linux Process

    Hellau everyone,

    I want to monitor some linux processes with a UserParameter
    UserParameter=service.grep[*], sudo ps ax | grep $1 | grep -v grep
    In the bash i have got exactly the expected behavior. When the process is running, so i get some information like pid, so on. When the process is not known / not running / etc. so i get an empty line.

    First i thought "yeeah"- this is what i want. But testing this line with a trigger with using nodata() function from zabbix, does not work.

    So i want to know, do someone know, how to find the length of the bash result of this userparamter? For human it seems to be empty, but in reality not. (Otherwise the nodata()=1) would be working. And how do you monitor your linux/unix proccesses/deamons?

    Thanks,
    Mira
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    On https://www.zabbix.com/documentation...t#zabbix_agent
    You can find information about standard agent proc.num[<name>,<user>,<state>,<cmdline>] key so you don't need to use UserParameter keys.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment


    • vamshi_pulluri
      vamshi_pulluri commented
      Editing a comment
      Can we use Zabbix API to monitor Linux Processes?
  • miramira007
    Member
    • Sep 2015
    • 89

    #3
    Can someone tell me how to monitor processes without a pid? when im using proc.num[name] so im getting 0 for applications/processes that have no pid. thank you.

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #4
      Originally posted by miramira007
      Can someone tell me how to monitor processes without a pid? when im using proc.num[name] so im getting 0 for applications/processes that have no pid. thank you.
      Every process has PID.
      On some systems exist process with PID=0.
      Example of such system is:
      Code:
      [tkloczko@solaris001 ~]$ ps -ef -o pid,fname | sort -n | head -1; uname -a
          0 sched
      SunOS solaris001 5.11 11.3 i86pc i386 i86pc
      I don't think that you are using Solaris :P so you need to tell us your OS name and what kind of process you are trying to monitor
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      • miramira007
        Member
        • Sep 2015
        • 89

        #5
        Hellau,

        in my case i have some processes, maybe process is the wrong word in this case, which has no pid.

        here some output from terminal:

        systemctl status confluence.service

        Loaded: loaded (/etc/rc.d/init.d/confluence)
        Active: active (running) since Mon 2016-03-21 15:21:15 CET; 4 weeks 0 days ago
        Docs: man:systemd-sysv-generator(8)
        Process: 9999 ExecStart=/xx/yyy/init.d/confluence start (code=exited, status=0/SUCCESS)
        CGroup: /system.slice/confluence.service
        └─9999 /opt/atlassian/confluence/jre//bin/java -Djava.util.logging.config.file=/xx/yy/yy/logging...
        We are using CentOS 7 with Zabbix 3.0.1

        I want to monitor this service, but with proc.num[confluence] i'm getting 0. What should i do in this case? How to monitor services which has subservices?

        Comment

        • kloczek
          Senior Member
          • Jun 2006
          • 1771

          #6
          Originally posted by miramira007
          I want to monitor this service, but with proc.num[confluence] i'm getting 0. What should i do in this case? How to monitor services which has subservices?
          As you wrote above you don't need to monitor process .. you need to monitor service so you can use on checking your confluence service state systemctl command
          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
          https://kloczek.wordpress.com/
          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
          My zabbix templates https://github.com/kloczek/zabbix-templates

          Comment

          • miramira007
            Member
            • Sep 2015
            • 89

            #7
            In this case, i need a userparameter which i wrote above? Or can you give me more introduction?

            Comment

            • abevern
              Junior Member
              • Apr 2015
              • 10

              #8
              Originally posted by miramira007
              In this case, i need a userparameter which i wrote above? Or can you give me more introduction?
              Yes, you can use a userparameter to parse the output of the service state to determine the information that you're after. There appears to be a lot of information in your output, so there may be multiple ways in which a failure could be indicated. You may need to encapsulate that complexity in your test(s).

              As a general rule, the nodata() check only works on items that are sent to zabbix server (e.g. agent active checks) - if the zabbix server does anything to retrieve the data - then the nodata() trigger will not fire.

              Comment

              • Alfista
                Senior Member
                • Mar 2017
                • 136

                #9
                Monitoring Linux Process

                Hi,

                i try to do it too, but I need to monitor Debian 9.3 a RedHat 6.x, where are not the proc.num commands and I don't know how to check the states of the processes (running, stoped and failed).

                Thanks.

                Comment

                Working...