I am running Nagios Core 4.4.3.
I have been trying to create a custom check on my Nagios server.
Code: Select all
vi /usr/local/nagios/libexec/third-party-resources.sh
#!/bin/bash
number_of_char=$(~/third-party-resources-checker-master/bin/third-party-resources-checker -w ~/third-party-resources-checker-master/whitelist.json https://website|wc -m)
if (($number_of_char == 0)); then
echo "OK";
exit 0
elif (($number_of_char > 0)); then
echo "WARNING -new third party resources found:"
~/third-party-resources-checker-master/bin/third-party-resources-checker -w ~/third-party-resources-checker-master/whitelist.json https://website
exit 1
elif (($number_of_char < 0)); then
#CRITICAL - never happens
# It is just to make an example on all possible exits
exit 2
else echo "UNKNOWN"
exit 3
fi
chown nagios: /usr/local/nagios/libexec/third-party-resources.sh
chmod 755 /usr/local/nagios/libexec/third-party-resources.sh
nrpe.cfg:
command[third-party-resources]=/usr/local/nagios/libexec/third-party-resources.sh
commands.cfg:
define command{
command_name third-party-resources
command_line /usr/local/nagios/libexec/third-party-resources.sh
}
monitor.cfg:
define service{
use local-service ; Name of service template to use
host_name Nagios_server
service_description third-party-resources
check_command third-party-resources
notifications_enabled 1
}
service nagios restart
returns a good outcome: WARNING
but in Nagios GUI I am seeing: OK (what is not supposed to be)
Please advise.
Thanks,
Dragan