I then created a new vnc.cfg under /etc/nagios-plugins/config/vnc.cfg:
Code: Select all
# cat /etc/nagios-plugins/config/vnc.cfg
# 'check_vnc' command definition
define command{
command_name check_vnc
command_line /usr/lib/nagios/plugins/check_vnc -H '$HOSTADDRESS$'
}
# 'check_vnc_port' command definition
define command{
command_name check_vnc_port
command_line /usr/lib/nagios/plugins/check_vnc -p '$ARG1$' -H '$HOSTADDRESS$'
}
Code: Select all
define hostgroup {
hostgroup_name vnc-servers
alias VNC servers
members localhost
}
Code: Select all
define service {
hostgroup_name vnc-servers
service_description VNC
check_command check_vnc
use generic-service
notification_interval 0 ; set > 0 if you want to be renotified
}
Code: Select all
define host{
use generic-host ; Name of host template to use
host_name localhost
alias localhost
address 127.0.0.1
}
VNC CRITICAL 2017-10-26 13:50:28 0d 0h 27m 21s 4/4 (Service check did not exit properly)
When I execute it from the command line, it seems to behave just fine:
Code: Select all
# /usr/lib/nagios/plugins/check_vnc -H localhost
VNC OK - RFB version 003.008 | time=0.069626s;;
# sudo -u www-data /usr/lib/nagios/plugins/check_vnc -H 127.0.0.1
VNC OK - RFB version 003.008 | time=0.065526s;;
# echo $?
0