ncpa_passive checks
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
ncpa_passive checks
Hello,
I recently implemented ncpa passive checks, and am having a hard time understanding exactly how to add additional passive checks outside the defaults.
I need to accomplish a few different types of passive checks:
- check apt status
- disk health using either megacli or storcli
- disk IO
- quantity of logged in users
I have copied many of the nagios plugins to the servers, (including check_apt), so I could easily use that or any other plugins, but am unsure of how to send the output data to the passive plugin to relay to the nagios server.
thanks in advance!
I recently implemented ncpa passive checks, and am having a hard time understanding exactly how to add additional passive checks outside the defaults.
I need to accomplish a few different types of passive checks:
- check apt status
- disk health using either megacli or storcli
- disk IO
- quantity of logged in users
I have copied many of the nagios plugins to the servers, (including check_apt), so I could easily use that or any other plugins, but am unsure of how to send the output data to the passive plugin to relay to the nagios server.
thanks in advance!
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: ncpa_passive checks
Hello, @nag4csec42. This should be fairly simple.
First, put the plugins that you want to use into the plugins folder within the NCPA directory.
Next, in the web browser type in the IP address of the NCPA server:5663. In my example it's:
Go to the API menu.
In the API endpoint select "Plugins"
On the next line select the plugin that you want to use for passive checks
Insert the required arguments in the arguments field
Click on: View in an alternative format -> As an active check, and make sure that:
Produces the correct output for this plugin.
Next, click on View in an alternative format -> As a passive check.
Copy the command and insert it with all the other standard passive check commands in the cfg file.
Done!
First, put the plugins that you want to use into the plugins folder within the NCPA directory.
Next, in the web browser type in the IP address of the NCPA server:5663. In my example it's:
Code: Select all
https://172.16.153.1:5693On the next line select the plugin that you want to use for passive checks
Insert the required arguments in the arguments field
Click on: View in an alternative format -> As an active check, and make sure that:
Code: Select all
Would result in the following output:.... Next, click on View in an alternative format -> As a passive check.
Copy the command and insert it with all the other standard passive check commands in the cfg file.
Done!
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
Re: ncpa_passive checks
Thanks for the detailed info!
check_apt plugin:
The NCPA API generated this and Nagios reported an UNKNOWN status:
I added a space after the -U and this check started working correctly.
check_uptime plugin:
Same type of deal, I had to add a space after the slash in 'check_uptime/'
NCPA API generated:
modified & working:
---------------------------------------------------
One issue I have is with the disk IO check.
I am able to run command as sudo from command line:
Disk IO check in nrdp.cfg file:
Our nagios user is a member of the sudo group.
Permissions for plugin are:
-r-xr-xr-x 1 nagios nagios 11687 Mar 29 19:00 check_diskstat.sh*
But, I receive this error in Nagios from the ncpa_passive plugin and when trying to run this command in the NCPA API:
I have attempted to add spaces to the command in the nrdp.cfg file, but cannot figure out how to make this passive check work.
check_apt plugin:
The NCPA API generated this and Nagios reported an UNKNOWN status:
Code: Select all
%HOSTNAME%|<service name> = plugins/check_apt/-U/-t 20Code: Select all
%HOSTNAME%|APT Updates = plugins/check_apt/-U /-t 20check_uptime plugin:
Same type of deal, I had to add a space after the slash in 'check_uptime/'
NCPA API generated:
Code: Select all
%HOSTNAME%|Uptime = plugins/check_uptime/-t 60Code: Select all
%HOSTNAME%|Uptime = plugins/check_uptime/ -t 60One issue I have is with the disk IO check.
I am able to run command as sudo from command line:
Code: Select all
user@host1:/usr/local/ncpa/etc/ncpa.cfg.d$ sudo ../../plugins/check_diskstat.sh -d sda -W 10 -C 20
summary: 1 io/s, read 824 sectors (15kB/s), write 96 sectors (1kB/s), queue size 0 in 26 seconds | tps=1io/s;;; read=16226b/s;;; write=1890b/s;;; avgrq-sz=20;;; avgqu-sz=0;10;20; await=0ms;;;
Code: Select all
%HOSTNAME%|Disk IO sda = plugins/check_diskstat.sh/-d sda /-W 10 /-C 20Permissions for plugin are:
-r-xr-xr-x 1 nagios nagios 11687 Mar 29 19:00 check_diskstat.sh*
But, I receive this error in Nagios from the ncpa_passive plugin and when trying to run this command in the NCPA API:
Code: Select all
{
"returncode": 2, "stdout": "/usr/local/ncpa/plugins/check_diskstat.sh: 77: /usr/local/ncpa/plugins/check_diskstat.sh: Bad substitution" }-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: ncpa_passive checks
@nag4csec42 , Not sure why all your commands have slashes. I'd try to remove them but keep spaces between the arguments:
Code: Select all
%HOSTNAME%|Disk IO sda = plugins/check_diskstat.sh -d sda -W 10 -C 20As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
Re: ncpa_passive checks
You do not have the required permissions to view the files attached to this post.
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
Re: ncpa_passive checks
I removed all the slashes, now Nagios reports "Need device name, ex: sda" for the check_diskstat.sh command, but the command line check works with the same command.
output from command line:
nrdp.cfg file config:
From Nagios:
output from command line:
Code: Select all
user@host1:/usr/local/ncpa/etc/ncpa.cfg.d$ sudo ../../plugins/check_diskstat.sh -d sda -W 10 -C 20
summary: 0 io/s, read 916928 sectors (5kB/s), write 654080 sectors (3kB/s), queue size 0 in 82337 seconds | tps=0io/s;;; read=5701b/s;;; write=4067b/s;;; avgrq-sz=39;;; avgqu-sz=0;10;20; await=0ms;;;Code: Select all
%HOSTNAME%|Disk IO sda = plugins/check_diskstat.sh -d sda -W 10 -C 20You do not have the required permissions to view the files attached to this post.
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
Re: ncpa_passive checks
For the check_users passive check, the command line works:
But the same check in nrdp.cfg does not:
Code: Select all
user1@host:/usr/local/ncpa/etc/ncpa.cfg.d$ sudo ../../plugins/check_users -w 5 -c 10
USERS OK - 1 users currently logged in |users=1;5;10;0Code: Select all
%HOSTNAME%|Current Users = plugins/check_users -w 5 -c 10You do not have the required permissions to view the files attached to this post.
Re: ncpa_passive checks
Try the following service definition instead:
Let us know if this helped. Thank you!
Code: Select all
%HOSTNAME%|Disk IO sda = plugins/check_diskstat.sh?args=-d sda&args=-W 10&args=-C 20Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: ncpa_passive checks
Just saw your second post. For Current Users, you can try:
Code: Select all
%HOSTNAME%|Current Users = plugins/check_users?args=-w 5&args=-c 10Be sure to check out our Knowledgebase for helpful articles and solutions!
-
nag4csec42
- Posts: 25
- Joined: Tue Sep 06, 2016 10:59 am
Re: ncpa_passive checks
Bummer, I still get these results in Nagios:
Settings in nrdp.cfg:
Settings in nrdp.cfg:
%HOSTNAME%|Disk IO sda = plugins/check_diskstat.sh?args=-d sda&args=-W 10&args=-C 20
%HOSTNAME%|Disk IO sdb = plugins/check_diskstat.sh?args=-d sdb&args=-W 10&args=-C 20
%HOSTNAME%|Current Users = plugins/check_users?args=-w 5&args=-c 10
You do not have the required permissions to view the files attached to this post.