(Cisco switch) CPU load check in Icinga Director

Hello,

I am trying to run the following Cisco switch CPU load check in Icinga Director:

check-cisco.pl.zip (3.4 KB)

If I execute it directly on the command line, it works as expected (siehe screenshot): ./check-cisco.pl -H 10.5.3.30 -C pubzid -t cpu -w 70 -c 85

But I am having problems to do the same in Icinga Director. This is what I’ve done, but I always get several error messages:

2

Thank you very much in advance for your help.

Best regards,

Javier

Click on Inspect in the last view and check how Icinga executes the plugin command line. That should give you an idea where to start fixing things.

Cheers,
Michael

Hello Michael,

thank you for your answer. I tried almost everything and I checked the whole configuration many times but I always get an error message. I also tried to delete the command, service template, etc. and start again, but the result was the same.

Can you give me please a hint on how to set the options/parameters/arguments? Specially the part related to the cpu?

Screenshot%20from%202019-08-07%2013-41-50

Thank you very much in advance.

Regards,

Javier

Follow my advise, I don’t know what Icinga actually executes in this regard.

Up until now, we don’t know which parts are missing.

Cheers,
Michael

Hello Michael,

please find enclosed the output of “Inspect”:

Regards,

Javier

Seems that the command arguments are not translated into actual command parameters for the plugin command.

Look into (Cisco switch) CPU load check in Icinga Director in the first post again, and pick the screenshot where the command arguments are specified, after the fields. They are missing and do not reference the created fields.

Cheers,
Michael

Hello Michael,

I followed your advice, but the result was more or less the same:

Do you have any other ideas?

Regards,

Javier

Yes, you need to specifiy all arguments the plugin needs to be executed.

In you first post you have a successfully running command line. Transfer that to the Icinga Director (create all arguments and fields for them). As the script can only take on value for each warning and critical threshold, you can remove the load_cload* and load_wload fields from the command. They are not used anyway.

Hello,

Thank you very much for your answer. I found another possibility to achieve that. You can close this topic.

Best regards,

Javier

Sharing you solution might help others, so sharing is much appreciated :wink:

You can “close” the topic by marking any answer as solution

Unfortunately many people think this is a free support ticket system. Your answer is gold for community spirit :kissing_heart:

Hello Michael and log1c,

Despite your advice, I was unable to execute the mentioned Cisco switch CPU Load check in Icinga Director (see my first post). As I already wrote, if I execute that on the command line, it works as expected:

./check-cisco.pl -H $HOSTADDRESS$ -C pubzid -t cpu -w 70 -c 85
Cpu: OK - Cpu Load 34% 20% 19% | cpu_5s=34percent;70;85 cpu_1m=20percent cpu_5m=19percent

The main problem I faced was to create all arguments and fields I need (as you recommended me and I tried to do). Still I don’t know what I did wrong, but this did not work as expected and I was getting several syntax error messages.

In order to get this done, I created a small bash script, which executes exactly the options/parameters from above. In order to use it with Icinga Director, I need to create an extra command, a service template for each service/host and and so on. It is altogether more work than working with just one command and service template but it works:

#!/bin/bash
cd /usr/lib/nagios/plugins/
./check-cisco.pl -H $HOSTADDRESS$ -C pubzid -t cpu -w 70 -c 85

Can you please recommend me some documentation, video, post or whatever about creating arguments and fields in Icinga Director? I could not find much information about it, but I would like to try it again as soon as I have more time.

Thank you in advance.

Best regards,

Javier

You already were on the right track.
Rename the $check-type$ variable to (e.g.) $cisco_load_type$ (not sure if dots are supported in variable names).
Add new arguments -w and a value$cisco_load_warn and -c with value $cisco_load_crit.
Then go to the Fields tab and add the fields $community$, $cisco_load_type$, $cisco_load_warn$ and $cisco_load_crit$. You don’t need to add the $address$ field, because this is implicitly taken from the host object.
Next create a new service template that uses the check command. After saving you will see the variable fields in the custom property section.

After this create an apply rule to create a check with the service template.
Input the information from the command line into the variable fields (community=pubzid, cisco_load_type=cpu, cisco_load_warn=75, cisco_load_crit=85) and use assign where host.address= (or what ever you want to use to assign the check ;))

Deploy and check what the check does.
Check the Inspect link on the Web Interface to see exactly what the Icinga 2 core is executing.

1 Like

Hello log1c,

Thank you very much for your answer. I followed the steps from your last post and now I get the message “Can’t create SNMP session to ”. For some reason the service check doesn’t recognize the target host ip address:







Can you see anything wrong in the configuration.

Thank you again!

Best regards,

Javier

Yes, your are missing the -H argument.
Add the argument with $address$ as value and you are good to go.

This was ONLY meant for the Fields tab of the command, not the Arguments tab.

If you don’t define an argument with the $address$ variable, the check doesn’t know were to connect to/which host to monitor, as you can see in your screenshot in the executed command line (black)

Sorry to ask so bluntly, but did you even bother to compare the command line you are executing on the CLI to the executed command line from the Inspect on Icinga Web 2 even once???

1 Like

Hello log1c,

It works now!

I knew anyway the IP was missing because of the service output and also because I was executing on the command line the same output from the Inspect.

Thank you very much for your help!

Best regards,

Javier