Nagios Plugs output does not match in Nagios console

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jchow10
Posts: 8
Joined: Wed Mar 02, 2016 10:34 pm

Nagios Plugs output does not match in Nagios console

Post by jchow10 »

Hi,
I created the Nagios plugins to get custom df output but when it passed the output back to Nagios server. It replaced ";" with ":" in the result. This is very puzzle me. I will appreciate for any hints.

Script output:
if [ $STATE_CRITICAL -eq 1 ]
then
echo "CRITICAL - $getStorageInfo;"
exit 2
elif [ $STATE_WARNING -eq 1 ]
then
echo "WARNING - $getStorageInfo;"
exit 1
elif [ $STATE_OK -eq 1 ]
then
echo "OK - $getStorageInfo;"
exit 0
.....


The result is dsplay in one single line.

./check_storage_new -w 80 -c 90
OK - Filesystem;Type;1K-blocks;Used;Available;Use%;Mounted;on;/dev/md1;ext4;113251888;7606716;99892296;8%;/;tmpfs;tmpfs;132211444;0;132211444;0%;/dev/shm;/dev/md2;ext4;2063120;64340;1893980;4%;/boot;/dev/sda;xfs;1170326196;9887460;1160438736;1%;/data/disk1;/dev/sdb;xfs;1170326196;8843992;1161482204;1%;/data/disk2;/dev/sdc;xfs;1170326196;7970756;1162355440;1%;/data/disk3;/dev/sdd;xfs;1170326196;8613564;1161712632;1%;/data/disk4;172.16.1.29:/usr/local/nagios/libexec;nfs;94439424;21877760;67764224;25%;/usr/lib64/nagios/plugins


Nagios Console result: (Somehow ; is replace by ":")
./check_storage_new -w 80 -c 90
OK - Filesystem:Type:1K-blocks:Used:Available:Use%:Mounted:on:/dev/md1:ext4:113251888:7606912:99892100:8%:/:tmpfs:tmpfs:132211444:0:132211444:0%:/dev/shm:/dev/md2:ext4:2063120:64340:1893980:4%:/boot:/dev/sda:xfs:1170326196:9887460:1160438736:1%:/data/disk1:/dev/sdb:xfs:1170326196:8843992:1161482204:1%:/data/disk2:/dev/sdc:xfs:1170326196:7970756:1162355440:1%:/data/disk3:/dev/sdd:xfs:1170326196:8613564:1161712632:1%:/data/disk4:172.16.1.29:/usr/local/nagios/libexec:nfs:94439424:21878784:67764224:25%:/usr/lib64/nagios/plugins:

Thank you in advance,

-JC
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios Plugs output does not match in Nagios console

Post by rkennedy »

It doesn't look like your plugin is following the guidelines, Nagios is going to convert the semicolons for anything before a |, as it represents non-performance data. After the |, you can use semi colons, but this is what Nagios will determine as performance data.

More information at https://nagios-plugins.org/doc/guidelines.html and https://assets.nagios.com/downloads/nag ... inapi.html
Former Nagios Employee
Locked