Page 1 of 1

Proper ways to create check command

Posted: Thu Dec 23, 2021 6:12 am
by dhlao
I've made several check commands that are written in C, they can successfully pass the value (I think they're strings) and are properly shown in Nagios web console.
However, when using Histou to pass value to Grafana for creating graph, they failed.

This doesn't happen when using built-in check_command such as "check_snmp" and "check_ping". So, I wonder what are missing in my code.

Re: Proper ways to create check command

Posted: Thu Dec 23, 2021 6:28 am
by mcapra
Probably missing correctly formatted performance data:
https://nagios-plugins.org/doc/guidelines.html#AEN200

Re: Proper ways to create check command

Posted: Mon Jan 03, 2022 5:08 am
by dhlao
Hello mcapra,
I haven't added performance data before. After some research, I still get confuse of how to properly include this in the code.

I've checked https://assets.nagios.com/downloads/nag ... fdata.html. Adding the *stroke* doesn't work.

I've tried using the method in https://github.com/nagios-plugins/nagio ... eck_ping.c. Line 174-181; function of "perfdata" can't be used even I've included almost all header (.h) files.

I've also visited https://assets.nagios.com/downloads/nag ... inapi.html. However, I'm still don't have any idea.

Re: Proper ways to create check command

Posted: Mon Jan 03, 2022 9:19 pm
by dhlao
Finally, I managed to make performance data works; By referencing a custom check command - "check_eth" which is written in Perl and is available in Nagios Exchange. Thanks to mcapra again for giving me the very useful hint.