Hi Techs
I wonder how to add Cisco routers and switches to icinga2 to monitor…
Hi Techs
I wonder how to add Cisco routers and switches to icinga2 to monitor…
Hi,
that’s usually done with the help of a plugin and your own checkcommand
You can use check_nwc_health
. There’s already a corresponding checkcommand in the ITL.
https://labs.consol.de/de/nagios/check_nwc_health/index.html
Thanks Johannes and Thomas , It’s very helpful to info…but still i am not clear how to execute the check_nwc_health. What is the next step…I have icinga2 director2 also…pls help me
What i did upto now
mkdir /usr/lib64/nagios/plugins/check_nwc_health
create the check_nwc_health and script
[root@localhost check_nwc_health]# ls
plugins-scripts
steps i did:
wget https://labs.consol.de/assets/downloads/nagios/check_nwc_health-7.6.tar.gz
tar -xvzf check_nwc_health-7.6.tar.gz
cd /check_nwc_health-7.6
./configure
make
mv plugins-scripts /usr/lib64/nagios/plugins/check_nwc_health
[root@localhost /]# cd /usr/lib64/nagios/plugins
[root@localhost plugins]# ls
check_nwc_health
[root@localhost plugins-scripts]# ls
Classes Makefile Makefile.am Makefile.in check_nwc_health check_nwc_health.pl subst subst.in
[root@localhost plugins-scripts]#
move the check_nwc_health to /usr/lib64/nagios/plugins. That way you can use the already existing nwc_health
command from the ITL. These commands are already imported into the Icinga Director after running the kickstart wizard.
Next steps are to configure the needed fields for the command. This can be easily done be just adding the fields from the drop down list in the “Fields” tab of the command.
Then create a service template using the command and apply the template to a host (via apply rule, or the host template)
see the detailed version below
Hi,
check_nwc_health should be a single perl script, its output is what’s written to plugin-scripts
as directory. This script must then be moved into /usr/lib/nagios/plugins
.
cp plugins-scripts/check_nwc_health /usr/lib/nagios/plugins
chmod 755 /usr/lib/nagios/plugins/check_nwc_health
Do a first run on the CLI as icinga user and figure out which parameters you’ll need.
sudo -u icinga /usr/lib/nagios/plugins/check_nwc_health -H ....
Once you’ve found out about the parameters, look into the ITL docs for nwc_health
and open the Director. Underneath the commands tab, you should see the nwc_health as external imported command.
Inside the fields
tab, you can specify command fields you’d want to use. There you need to specify whether the parameters are optional or mandatory.
Once you’ve prepared the CheckCommand, you can use it inside a service template then. The check_command attribute is set, and the custom properties need to be filled - either in the template, or the service apply rule / set you’ll create.
That goes on for every attribute you’ll need to define.
Cheers,
Michael
Michael , Thanks for your help and its spotted directly what i required. Need to spend some time to learn the director
Hi Michael , Thomas and Johannes
Thanks for your kind support. Hope i am good now.
Kind regards
Robert
Would you kindly tick the “Solution” checkbox in the post that gave the correct answer? This way you give kudos and show all other users that you don’t need any more help.
Hi All
I have an other issues , I added one cisco switch, normal ping service works and check_nwc_health shows below output
execvpe(/usr/lib64/nagios/plugins/check_nwc_health) failed: Permission denied
[root@localhost /]# ls -la /usr/lib64/nagios/plugins/check_nwc_health
-rwxr-x—. 1 root root 3342503 Mar 25 21:08 /usr/lib64/nagios/plugins/check_nwc_health
The check is executed by the user who is running icinga (nagios or icinga depending on the distribution) and your plugin’s rights does not allow this user to run the plugin. chmod 755 will solve this issue.
BTW: When you try to run it manually you did this using user root. And that user is allowed to run the plugin.
Yes there are more reasons than “false positives” behind not running them as root. Plugins “should not” create temporary files but they can if they have to. If you run them as root they will create temporary files with permissions so Icinga can’t change them anymore.
So always run them as the same user Icinga is running as. e.g. sudo -u icinga [plugin]
I tried icinga , got below the permission denied error
[root@localhost /]# sudo -u icinga /usr/lib64/nagios/plugins/check_nwc_health -H …
sudo: unable to execute /usr/lib64/nagios/plugins/check_nwc_health: Permission denied
[root@localhost /]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
icinga:x:997:995:icinga:/var/spool/icinga2:/sbin/nologin
nagios:x:996:992::/var/spool/nagios:/sbin/nologin
AS @rsx said you have to change the permissions to the file.
Easiest way is to do chmod 755 <filename>
as the root user.
In you case chmod 755 /usr/lib64/nagios/plugins/check_nwc_health
This way the persmissions are set to:
Hi , I did the below before ,
chmod 750 /usr/lib64/nagios/plugins/check_nwc_health
/usr/lib64/nagios/plugins/check_nwc_health -H …
shall i apply this below pls?
chmod 755 /usr/lib64/nagios/plugins/check_nwc_health
/usr/lib64/nagios/plugins/check_nwc_health -H …
Hi,
if the plugin is owned by root, then the others
flag must be enabled to execute the script. chmod o+x ...
is a different notation for that, in general you’d use chmod 755 ...
as numeric representation. Grab your favourite Linux basics book, and read on, it really helps.
If the plugin is owned by the icinga daemon user (namely, nagios
on Debian packages for historical reasons), having the executable bit for owner and group is sufficient.
TL;DR - use chmod 755 ...
and leave root as owner.
Cheers,
Michael
Hi i am very new to linux & worked only on network side , and trying myself to workout icinga…all of your kind support , i reached to this stage…
chmod 755 /usr/lib64/nagios/plugins/check_nwc_health
/usr/lib64/nagios/plugins/check_nwc_health -H …
After this , the permission denied error resolved …
I got a new error , is it anything related to perl or plugin? pls
CRITICAL - could not find Net::SNMP module
You did not install the required perl modules for this plugin, especially Net::SNMP
in this case. I am wondering why your manual test worked though …
Which distribution are you on? cat /etc/os-release