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?
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.
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.
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.
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.
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:
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???