[Pkg-nagios-devel] Bug#582272: nagios-plugins-basic: ssh_disk quoting in disk.cfg wrong

Paul Slootman paul at debian.org
Wed May 19 16:38:33 UTC 2010


Package: nagios-plugins-basic
Version: 1.4.14-5
Severity: normal

>From /usr/share/nagios-plugins/templates-basic/disk.cfg :

# 'ssh_disk' command definition
define command{
        command_name    ssh_disk
        command_line    /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -C '/usr/lib/nagios/plugins/check_disk -w '\''$ARG1$' -c '\''$ARG2$'\'' -e -p '\''$ARG3$'\'
        }

The command_line has some wierd quoting and escaping going on.
This is confirmed by the fact it simply doesn't work, if I try to use it:

Status Information:     Usage: check_by_ssh -H <host> -C <command> [-fqv] [-1 [-S [lines]] [-E [lines]] [-t timeout] [-i identity] [-l user] [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]
Performance Data:       -2] [-4|-6]

The service definition I tried was:
define service {
    use                 generic-service
    service_description ssh by disk
    check_command       ssh_disk!10!5!/tmp
    host_name           dino
}


If I change the command_line to this, it works:

command_line    /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -C "/usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$'"

i.e. enclose the -C parameter by double quotes, which removes the need
for funky escaping.

Same goes for ssh_disk_4.

FWIW, I'm now running icinga, but I suspect that nagios3 would have
the same problems. I in fact noticed the quoting problem because
icinga-idocfg couldn't insert this command into the postgresql database,
this appeared in /var/log/messages:

May 19 17:19:33 nagios3 ido2db: Successfully connected to pgsql database
May 19 17:20:03 nagios3 ido2db: Error: database query failed for 'UPDATE icinga_commands SET command_line='/usr/lib/nagios/plugins/check_by_ssh -H ''$HOSTADDRESS$'' -C ''/usr/lib/nagios/plugins/check_disk -w ''\''''$ARG1$'' -c ''\''''$ARG2$''\'''' -e -p ''\''''$ARG3$''\''' WHERE instance_id=1 AND object_id=3658 AND config_type=1' - 'ERROR:  unterminated dollar-quoted string at or near "$ARG1$'' -c ''\''''$ARG2$''\'''' -e -p ''\''''$ARG3$''\''' WHERE instance_id=1 AND object_id=3658 AND config_type=1" LINE 1: ...-C ''/usr/lib/nagios/plugins/check_disk -w ''\''''$ARG1$'' -...                                                              ^ ' 
May 19 17:20:03 nagios3 ido2db: Successfully disconnected from database


Thanks,
Paul Slootman





More information about the Pkg-nagios-devel mailing list