Closed kingdingaling83 closed 7 years ago
Okay, a couple things here - NCPA 2 is going to be released tomorrow and may take care of a bit of this but the problem I would assume is that this doesn't always work in a sane way.
For example let's look at your service --status-all
command, that is directly related to the services
API endpoint in NCPA so you'd view that as:
./check_ncpa.py -H <host> -t <token> -M 'services' -q 'service=portal:archiver'
Which would give you whether the service is running or not (from the services list you displayed)
However, if you want to know how many archiver processes are running, which is done differently that the service node - you'd do the following:
./check_ncpa.py -H <host> -t <token> -M 'processes' -q 'name=archiver,match=search'
Would instead get the processes that have the term archiver in them, however, note that the match
term only works in NCPA 2. In NCPA 1.x the processes endpoint only returns services with the exact name, but you can pass multiple names like name=archiver,name=archiver-test
and so on. I believe that was fixed in version 1.8 to work with multiples, I know it works in 2.
at the moment it's just to make sure they're running. it's doesn't matter how many processes. i'll test this tomorrow but it sounds promising.
If you just want to check if it's running, the easiest way to do it is just
./check_ncpa.py -H <host> -t <token> -M 'services' -q 'service=portal:archiver&status=running'
Would return OK when it's running and CRITICAL if it's not.
Great i'll give this a test!
Closing this since NCPA 2 is out and the matching types now work properly!
Hey there, not sure if it's best to be posting this sort of thing here or on the nagios forum
i'm trying to have some process checks using NCPA
root@grhldesv02(/tmp):service --status-all | grep portal portal:archiver RUNNING pid 22035, uptime 0:04:54 portal:celery_portal STOPPED Dec 14 02:27 PM portal:celerybeat RUNNING pid 2129, uptime 6 days, 5:10:35 portal:celeryd STOPPED Dec 14 02:27 PM portal:indexer RUNNING pid 2036, uptime 6 days, 5:10:36 portal:notifier RUNNING pid 2148, uptime 6 days, 5:10:34 portal:notifyindexer STOPPED Dec 14 02:27 PM portal RUNNING pid 2073, uptime 6 days, 5:10:35 portal:re3 RUNNING pid 2007, uptime 6 days, 5:10:37
here's the list of processes.
In the nagios wizard i dont see them in the service list so i specify them in the process list.
i've tried: portal:archiver archiver
either way i get the following back: OK: Process count for processes named archiver was 0c
this is the service check command: [nagios@localhost.localdomain ~]# /usr/local/nagios/libexec/check_ncpa.py -H 10.101.0.100 -t 'mytoken' -P 5693 -M 'process/archiver/count' -w 0 -c 0 OK: Process count for processes named archiver was 0c | 'process_count_0'=0c;0;0;
am i missing something?