diff options
| -rw-r--r-- | plugins/check_fping.c | 21 | 
1 files changed, 20 insertions, 1 deletions
| diff --git a/plugins/check_fping.c b/plugins/check_fping.c index fde1d798..c7cce97d 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
| @@ -74,6 +74,7 @@ main (int argc, char **argv) | |||
| 74 | /* normaly should be int result = STATE_UNKNOWN; */ | 74 | /* normaly should be int result = STATE_UNKNOWN; */ | 
| 75 | 75 | ||
| 76 | int status = STATE_UNKNOWN; | 76 | int status = STATE_UNKNOWN; | 
| 77 | int result = 0; | ||
| 77 | char *fping_prog = NULL; | 78 | char *fping_prog = NULL; | 
| 78 | char *server = NULL; | 79 | char *server = NULL; | 
| 79 | char *command_line = NULL; | 80 | char *command_line = NULL; | 
| @@ -146,10 +147,24 @@ main (int argc, char **argv) | |||
| 146 | (void) fclose (child_stderr); | 147 | (void) fclose (child_stderr); | 
| 147 | 148 | ||
| 148 | /* close the pipe */ | 149 | /* close the pipe */ | 
| 149 | if (spclose (child_process)) | 150 | if (result = spclose (child_process)) | 
| 150 | /* need to use max_state not max */ | 151 | /* need to use max_state not max */ | 
| 151 | status = max_state (status, STATE_WARNING); | 152 | status = max_state (status, STATE_WARNING); | 
| 152 | 153 | ||
| 154 | if (result > 1 ) { | ||
| 155 | status = max_state (status, STATE_UNKNOWN); | ||
| 156 | if (result == 2) { | ||
| 157 | die (STATE_UNKNOWN, _("FPING UNKNOWN - IP address not found\n")); | ||
| 158 | } | ||
| 159 | if (result == 3) { | ||
| 160 | die (STATE_UNKNOWN, _("FPING UNKNOWN - invalid commandline argument\n")); | ||
| 161 | } | ||
| 162 | if (result == 4) { | ||
| 163 | die (STATE_UNKNOWN, _("FPING UNKNOWN - failed system call\n")); | ||
| 164 | } | ||
| 165 | |||
| 166 | } | ||
| 167 | |||
| 153 | printf ("FPING %s - %s\n", state_text (status), server_name); | 168 | printf ("FPING %s - %s\n", state_text (status), server_name); | 
| 154 | 169 | ||
| 155 | return status; | 170 | return status; | 
| @@ -175,6 +190,10 @@ textscan (char *buf) | |||
| 175 | "host"); | 190 | "host"); | 
| 176 | 191 | ||
| 177 | } | 192 | } | 
| 193 | else if (strstr (buf, "Operation not permitted") || strstr (buf, "No such device") ) { | ||
| 194 | die (STATE_UNKNOWN, _("FPING UNKNOWN - %s parameter error\n"), | ||
| 195 | "host"); | ||
| 196 | } | ||
| 178 | else if (strstr (buf, "is down")) { | 197 | else if (strstr (buf, "is down")) { | 
| 179 | die (STATE_CRITICAL, _("FPING CRITICAL - %s is down\n"), server_name); | 198 | die (STATE_CRITICAL, _("FPING CRITICAL - %s is down\n"), server_name); | 
| 180 | 199 | ||
