diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 1a53677230147117e67ed943c8600cacdc121074..7f05d4d53038ab297245a7eebc36bd409caf7285 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
const char *progname = "check_fping";
const char *revision = "$Revision$";
-const char *copyright = "2000-2003";
+const char *copyright = "2000-2004";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
int
main (int argc, char **argv)
{
+/* normaly should be int result = STATE_UNKNOWN; */
+
int status = STATE_UNKNOWN;
char *server = NULL;
char *command_line = NULL;
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage4 (_("Could not parse arguments"));
server = strscpy (server, server_name);
/* run the command */
child_process = spopen (command_line);
if (child_process == NULL) {
- printf (_("Unable to open pipe: %s\n"), command_line);
+ printf (_("Could not open pipe: %s\n"), command_line);
return STATE_UNKNOWN;
}
-
int
textscan (char *buf)
{
int status = STATE_UNKNOWN;
if (strstr (buf, "not found")) {
- die (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
+ die (STATE_CRITICAL, _("FPING UNKNOW - %s not found\n"), server_name);
}
else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
- die (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
+ die (STATE_CRITICAL, _("FPING CRITICAL - %s is unreachable\n"),
"host");
}
else if (strstr (buf, "is down")) {
- die (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
+ die (STATE_CRITICAL, _("FPING CRITICAL - %s is down\n"), server_name);
}
else if (strstr (buf, "is alive")) {
return status;
}
-\f
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE) {
- printf (_("Invalid host name/address\n\n"));
- print_usage ();
- exit (STATE_UNKNOWN);
+ usage2 (_("Invalid hostname/address"), optarg);
}
server_name = strscpy (server_name, optarg);
break;
if (server_name == NULL)
- usage (_("Host name was not supplied\n\n"));
+ usage (_("Hostname was not supplied\n\n"));
return OK;
}
-
-
int
get_threshold (char *arg, char *rv[2])
{
-
-\f
void
print_help (void)
{
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
- printf (_("Copyright (c) 1999 Didi Rieder <adrieder@sbox.tu-graz.ac.at>\n"));
- printf (_(COPYRIGHT), copyright, email);
+ printf ("Copyright (c) 1999 Didi Rieder <adrieder@sbox.tu-graz.ac.at>\n");
+ printf (COPYRIGHT, copyright, email);
printf (_("\
-This plugin will use the /bin/fping command (from saint) to ping the\n\
-specified host for a fast check if the host is alive. Note that it is\n\
-necessary to set the suid flag on fping.\n\n"));
+This plugin will use the /bin/fping command to ping the specified host\n\
+for a fast check if the host is alive.\n\
+Note that it is necessary to set the suid flag on fping.\n\n"));
print_usage ();
-
void
print_usage (void)
{
- printf (_("Usage: %s <host_address>\n"), progname);
- printf (_(UT_HLP_VRS), progname, progname);
+ printf ("Usage: %s <host_address>\n", progname);
}