The actual treatment of the error—depending on the current event—is dealt with by the script defined in the command definition. So that we can concentrate on the essential aspects in this context, we shall assume that
lpd is installed on the Nagios server itself. This enables the service to be restarted locally, without the need for a remote shell such as the Secure Shell.
restart-lpd.sh checks to see exactly what event is involved, using the macros passed on to it, and either does nothing at all or tries to restart
#!/bin/bash # /usr/local/nagios/libexec/eventhandlers/restart-lpd.sh # $1 = Status, $2 = status type, $3 = attempt case $1 in OK) ;; WARNING) ;; CRITICAL) if [ $2 == "HARD" ] || [[ $2 == "SOFT" ...