[Nagiosplug-devel] check_by_ssh support user-defined timeout reply

Willempie news at villa-kuip.kabel.utwente.nl
Sat Jul 19 09:31:07 CEST 2003


Hi,

I've updated the check_by_ssh plugin to make the reply it gives at timeout
configurable with the -r option. It's supporting currently STATE_CRITICAL
(2) and STATE_UNKNOWN (3). The option -r takes the integer value of
STATE_CRITICAL or STATE_UNKNOWN.

Wim


 * $Id: check_by_ssh.c,v 1.9 2003/01/29 06:15:32 kdebisschop Exp $


$> diff check_by_ssh.c.new check_by_ssh.c.old
41c41
< void timeout_alarm_handler_reply (int);
---
>
50d49
< int timeout_reply = 2;
79c78
<       if (signal (SIGALRM, timeout_alarm_handler_reply) == SIG_ERR) {
---
>       if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
188d186
<               {"state_timeout", required_argument, 0, 'r'},
212c210
<                       getopt_long (argc, argv,
"Vvh46ft:H:O:p:i:u:l:C:n:s:r:", long_options,
---
>                       getopt_long (argc, argv,
"Vvh46ft:H:O:p:i:u:l:C:n:s:", long_options,
215c213
<               c = getopt (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:r:");
---
>               c = getopt (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:");
249,253d246
<               case 'r': /* timeout reply */
<                       if (!is_integer (optarg))
<                               usage2 ("timeout reply must be an integer",
optarg);
<                       timeout_reply = atoi (optarg);
<                       break;
374,375d366
<                "-r, --state_timeout=STATE\n"
<                "   reply status when timeout appears [optional]\n"
404c395
<                "             [-n name] [-s servicelist] [-O outputfile]
[-p port] [-r state_timeout]\n"
---
>                "             [-n name] [-s servicelist] [-O outputfile]
[-p port]\n"
408,421d398
<
< void timeout_alarm_handler_reply (int signo)
< {
<       if (signo == SIGALRM) {
<               kill (childpid[fileno (child_process)], SIGKILL);
<               if ( timeout_reply==3 ) {
<                       printf ("UNKNOWN - Plugin timed out after %d
seconds\n",timeout_interval);
<                       exit (STATE_UNKNOWN);
<               }else {
<                       printf ("CRITICAL - Plugin timed out after %d
seconds\n",timeout_interval);
<                       exit (STATE_CRITICAL);
<               }
<       }
< }







More information about the Devel mailing list