summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d8128e)
raw | patch | inline | side by side (parent: 1d8128e)
author | Benoit Mortier <opensides@users.sourceforge.net> | |
Wed, 1 Dec 2004 23:54:51 +0000 (23:54 +0000) | ||
committer | Benoit Mortier <opensides@users.sourceforge.net> | |
Wed, 1 Dec 2004 23:54:51 +0000 (23:54 +0000) |
standardize unknow arguments
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
45 files changed:
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 6daa1a11bd60128d1206cfe93bba730cb272bc91..8f6cde99ad60b8d652dd5e15610f6ded8b87762f 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.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_by_ssh";
/* process arguments */
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_by_ssh: could not parse arguments\n"));
/* Set signal handling and alarm timeout */
switch (c) {
case '?': /* help */
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
case 'V': /* version */
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
exit (STATE_OK);
case 'h': /* help */
print_help ();
break;
case 'H': /* host */
if (!is_host (optarg))
- usage2 (_("Invalid hostname/adress"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
hostname = optarg;
break;
case 'p': /* port number */
if (!is_integer (optarg))
- usage2 (_("port must be a positive integer"), optarg);
+ usage2 (_("Port must be a positive integer"), optarg);
asprintf (&comm,"%s -p %s", comm, optarg);
break;
case 'O': /* output file */
if (c <= argc) {
die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname);
} else if (!is_host (argv[c]))
- die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid host name"), argv[c]);
+ die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid hostname/address"), argv[c]);
hostname = argv[c++];
}
-
-
int
validate_arguments (void)
{
-
-
void
print_usage (void)
{
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 5b472ecaac040cb158a38a12d7db7365096f7720..a500cdcfaa0f3e99b0a02652df797be7d254da0c 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
*****************************************************************************/
#include "common.h"
asprintf (&output, _("Server not found in ANSWER SECTION"));
result = STATE_WARNING;
}
-
}
}
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* help */
- usage3 (_("Unknown argument"), optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
dns_server = optarg;
}
else {
- usage2 (_("Invalid hostname/adress"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'p': /* server port */
server_port = atoi (optarg);
}
else {
- usage2 (_("port must be a positive integer"), optarg);
+ usage2 (_("Port must be a positive integer"), optarg);
}
break;
case 'l': /* address to lookup */
dns_server = argv[c];
}
else {
- usage2 (_("Invalid hostname/adress"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
}
else {
-
-
int
validate_arguments (void)
{
-
-
-
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index c823925011cd4cffa089357be374da46dd8de930..437bbbf21aca536cfd2b82f516856f352eae9a59 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.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_disk";
static struct mount_entry *mount_list;
-\f
+
int
main (int argc, char **argv)
{
mount_list = read_filesystem_list (0);
if (process_arguments (argc, argv) != OK)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_disk: could not parse arguments\n"));
for (me = mount_list; me; me = me->me_next) {
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Unknow argument\n"));
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
}
+
void
print_path (const char *mypath)
{
return;
}
+
+
int
validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath)
{
@@ -523,7 +528,6 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
-\f
int
check_disk (double usp, double free_disk)
{
-
-
void
print_help (void)
{
@@ -631,7 +633,6 @@ and generates an alert if free space is less than one of the threshold values.")
-
void
print_usage (void)
{
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 6c08c2776e558ec3cee998d0a7afc49c99add4e6..fa7fbc1e820edab7e86e1405461bf5418290f363 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not
be picked up by this plugin
+
+ $Id$
******************************************************************************/
}
if (process_arguments (argc, argv) != OK) {
- print_usage ();
+ usage (_("check_dns: could not parse arguments\n"));
return STATE_UNKNOWN;
}
return result;
}
+
+
int
error_scan (char *input_buffer)
{
}
+
+
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
/* TODO: this is_host check is probably unnecessary. */
/* Better to confirm nslookup response matches */
if (is_host (optarg) == FALSE) {
- printf (_("Invalid server name/address\n\n"));
+ printf (_("Invalid hostname/address\n\n"));
print_usage ();
exit (STATE_UNKNOWN);
}
return validate_arguments ();
}
+
+
int
validate_arguments ()
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c
index 7f50834989c5104f6e179969cc62e26d4630fdba..a99e38a73f4df28d6261e3fcf0e95a7b4aecde9b 100644 (file)
--- a/plugins/check_dummy.c
+++ b/plugins/check_dummy.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
#include "common.h"
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 2dba2d58400bf1079978d7e142964b2b2f56cc5d..8647330c88798f2859deb0fc3f126d710758d7f5 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";
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_fping: could not parse arguments\n"));
server = strscpy (server, server_name);
-
int
textscan (char *buf)
{
return status;
}
-\f
-
-
int
get_threshold (char *arg, char *rv[2])
{
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 511e96179dcee83f379d74e2085bf0d40ffb78ee..8b2a6c42f6d229080a436a9923c448604d2c935a 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.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_game";
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- result = process_arguments (argc, argv);
+// result = process_arguments (argc, argv);
+
+ if (process_arguments (argc, argv) == ERROR)
+ usage (_("check_game: could not parse arguments\n"));
- if (result != OK) {
+/* if (result != OK) {
printf (_("Incorrect arguments supplied\n"));
printf ("\n");
print_revision (progname, revision);
printf ("\n");
return STATE_UNKNOWN;
}
+*/
result = STATE_OK;
-\f
void
print_help (void)
{
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 5699570c08e8a064bfb2dd259a0f8df54e3c2536..af6044a0e26e661fcbaafbad29c683d7a40d7802 100644 (file)
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+* $Id$
*****************************************************************************/
#include "common.h"
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_hpjd: could not parse arguments\n"));
/* removed ' 2>1' at end of command 10/27/1999 - EG */
/* create the query string */
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
address = strscpy(address, optarg) ;
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'C': /* community */
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
address = argv[c++];
}
else {
- usage2 (_("Invalid host name"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
}
-
-
int
validate_arguments (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 98005d0220edc63a67da83f97daa5d6ad9e4d74d..748ca46e28da6a874bb1034cdb3efb079a4f0914 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
#endif
return result;
}
-\f
+
/* process command-line arguments */
switch (c) {
case '?': /* usage */
- usage3 (_("unknown argument"), optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
break;
case 'h': /* help */
print_help ();
break;
case 'c': /* critical time threshold */
if (!is_nonnegative (optarg))
- usage2 (_("invalid critical threshold"), optarg);
+ usage2 (_("Critical threshold must be integer"), optarg);
else {
critical_time = strtod (optarg, NULL);
check_critical_time = TRUE;
break;
case 'w': /* warning time threshold */
if (!is_nonnegative (optarg))
- usage2 (_("invalid warning threshold"), optarg);
+ usage2 (_("Warning threshold must be integer"), optarg);
else {
warning_time = strtod (optarg, NULL);
check_warning_time = TRUE;
case 'C': /* Check SSL cert validity */
#ifdef HAVE_SSL
if (!is_intnonneg (optarg))
- usage2 (_("invalid certificate expiration period"), optarg);
+ usage2 (_("Invalid certificate expiration period"), optarg);
else {
days_till_exp = atoi (optarg);
check_cert = TRUE;
}
#else
- usage (_("check_http: invalid option - SSL is not available\n"));
+ usage (_("Invalid option - SSL is not available\n"));
#endif
break;
case 'f': /* onredirect */
return TRUE;
}
-\f
+
/* written by lauri alanko */
buf[i] = '\0';
return buf;
}
-\f
-
}
+
static void
check_document_dates (const char *headers)
{
if ( sslerr == SSL_ERROR_SSL ) {
die (STATE_WARNING, _("Client Certificate Required\n"));
} else {
- die (STATE_CRITICAL, _("Error in recv()\n"));
+ die (STATE_CRITICAL, _("Error on receive\n"));
}
}
else {
#endif
- die (STATE_CRITICAL, _("Error in recv()\n"));
+ die (STATE_CRITICAL, _("Error on receive\n"));
#ifdef HAVE_SSL
}
#endif
microsec = deltime (tv);
elapsed_time = (double)microsec / 1.0e6;
asprintf (&msg,
- _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"),
+ _("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""),
perfd_time (elapsed_time), perfd_size (pagesize));
-
/* per RFC 2396 */
#define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: "
#define URI_HTTP "%[HTPShtps]://"
}
#endif
+
+
#ifdef HAVE_SSL
int
check_certificate (X509 ** certificate)
return STATE_OK;
}
#endif
-\f
+
char *perfd_time (double elapsed_time)
}
+
char *perfd_size (int page_len)
{
return perfdata ("size", page_len, "B",
}
+
int
my_recv (void)
{
}
+
int
my_close (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
index 06deb12aeed9ece129aac22e339ac1e063ef63a5..9d3c3160d4a7a87f4c80673676156d756ef9bb98 100644 (file)
* check_ide-smart v.1 - hacked version of ide-smart for Nagios
* Copyright (C) 2000 Robert Dale <rdale@digital-mission.com>
*
- * Net Saint - http://www.nagios.org
+ * Nagios - http://www.nagios.org
*
* Notes:
* ide-smart has the same functionality as before. Some return
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id$
*/
#include "common.h"
SMART_CMD_AUTO_OFFLINE
};
+
+
char *
get_offline_text (int status)
{
return offline_status_text[i].text;
}
}
- return "unknown";
+ return "UNKNOW";
}
+
+
int
smart_read_values (int fd, values_t * values)
{
args[3] = 1;
if (ioctl (fd, HDIO_DRIVE_CMD, &args)) {
e = errno;
- printf (_("CRITICAL: SMART_READ_VALUES: %s\n"), strerror (errno));
+ printf (_("CRITICAL - SMART_READ_VALUES: %s\n"), strerror (errno));
return e;
}
memcpy (values, args + 4, 512);
return 0;
}
+
+
int
values_not_passed (values_t * p, thresholds_t * t)
{
return (passed ? -failed : 2);
}
+
+
int
net_saint (values_t * p, thresholds_t * t)
{
}
switch (status) {
case PREFAILURE:
- printf (_("CRITICAL: %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"),
+ printf (_("CRITICAL - %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"),
prefailure,
prefailure > 1 ? 's' : ' ',
failed,
total);
break;
case ADVISORY:
- printf (_("WARNING: %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"),
+ printf (_("WARNING - %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"),
advisory,
advisory > 1 ? "ies" : "y",
failed,
total);
break;
case OPERATIONAL:
- printf (_("Status: Operational (%d/%d tests passed)\n"), passed, total);
+ printf (_("STATUS - Operational (%d/%d tests passed)\n"), passed, total);
break;
default:
- printf (_("Error: Status '%d' uknown. %d/%d tests passed\n"), status,
+ printf (_("ERROR - Status '%d' uknown. %d/%d tests passed\n"), status,
passed, total);
status = -1;
break;
return status;
}
+
+
void
print_value (value_t * p, threshold_t * t)
{
p->value > t->threshold ? "Passed" : "Failed");
}
+
+
void
print_values (values_t * p, thresholds_t * t)
{
p->smart_capability & 2 ? "AutoSave" : "");
}
+
+
void
print_thresholds (thresholds_t * p)
{
if (ioctl (fd, HDIO_DRIVE_CMD, &args)) {
e = errno;
if (show_error) {
- printf (_("CRITICAL: %s: %s\n"), smart_command[command].text, strerror (errno));
+ printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno));
}
}
return e;
}
+
+
int
smart_read_thresholds (int fd, thresholds_t * thresholds)
{
args[3] = 1;
if (ioctl (fd, HDIO_DRIVE_CMD, &args)) {
e = errno;
- printf (_("CRITICAL: SMART_READ_THRESHOLDS: %s\n"), strerror (errno));
+ printf (_("CRITICAL - SMART_READ_THRESHOLDS: %s\n"), strerror (errno));
return e;
}
memcpy (thresholds, args + 4, 512);
return 0;
}
+
+
void
show_version ()
{
printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n");
}
+
+
void
show_help ()
{
-V, --version\n"));
}
+
+
int
main (int argc, char *argv[])
{
show_version ();
return 0;
default:
- printf (_("Try `%s --help' for more information.\n"), argv[0]);
- return 1;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
if (optind < argc) {
fd = open (device, O_RDONLY);
if (fd < 0) {
- printf (_("CRITICAL: Couldn't open device: %s\n"), strerror (errno));
+ printf (_("CRITICAL - Couldn't open device: %s\n"), strerror (errno));
return 2;
}
if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) {
- printf (_("CRITICAL: SMART_CMD_ENABLE\n"));
+ printf (_("CRITICAL - SMART_CMD_ENABLE\n"));
return 2;
}
}
return retval;
}
-
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 698741171976df80f472eddaae7f720ea3029ad8..0dc0380a76c5525a7db5adf22f7242f0fb811a7d 100644 (file)
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.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_ldap";
#endif
break;
default:
- usage (_("check_ldap: could not parse unknown arguments\n"));
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
-\f
void
print_help (void)
{
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 956f907770be06351e9fe95ec68dfca0d4b782f5..babe84bc82fc0cc85bfc957bed7d55c87efb5832 100644 (file)
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
******************************************************************************/
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage ("failed processing arguments\n");
+ usage (_("check_load: could not parse arguments\n"));
#if HAVE_GETLOADAVG==1
result = getloadavg (la, 3);
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 5532389c7ea2f659fed667f4eb9d7eb2720b8c3f..2badd4abc5142f258020a77cbec71b63410ccfe0 100644 (file)
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.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_mrtg";
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_mrtg: could not parse arguments\n"));
/* open the MRTG log file for reading */
fp = fopen (log_file, "r");
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
index a5455b044787f6dc60137c917facddb64f9dae21..0b0f49efdbeda44ad09af2e89b40b49e6c7d4c8d 100644 (file)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
******************************************************************************/
unsigned long outgoing_critical_threshold = 0L;
-
-
-\f
int
main (int argc, char **argv)
{
char outgoing_speed_rating[8];
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_ldap: could not parse arguments\n"));
/* open the MRTG log file for reading */
fp = fopen (log_file, "r");
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
-\f
void
print_help (void)
{
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index deac37fc848793d1669470a5a8181f154e74a683..ffd96ed4743dc509745bdf83dbdf6f6821efd005 100644 (file)
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_mysql: could not parse arguments\n"));
/* initialize mysql */
mysql_init (&mysql);
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
db_host = optarg;
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'd': /* hostname */
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
db_host = argv[c++];
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
else if (strlen(db_user) == 0)
db_user = argv[c++];
-
-
int
validate_arguments (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index d9d18d9b5182c2c9e7c5be7ab8c1ec23433382de..4439251fba5b298c292a45ca8a1c27f55e917746 100644 (file)
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.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_nagios";
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_nagios: could not parse arguments\n"));
/* Set signal handling and alarm */
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
/* open the status log */
fp = fopen (status_log, "r");
if (fp == NULL) {
- printf (_("Error: Cannot open status log for reading!\n"));
+ printf (_("ERROR - Cannot open status log for reading!\n"));
return STATE_CRITICAL;
}
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 8d66092d4f9781547020e7ccfede00afd31aab29..84b78bc5060a961fce56cabe4cd3abc42d3c8a82 100644 (file)
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * $Id$
+ *
*****************************************************************************/
#include "common.h"
textdomain (PACKAGE);
if(process_arguments(argc,argv)==ERROR)
- usage(_("Could not parse arguments\n"));
+ usage(_("check_nt: could not parse arguments\n"));
/* initialize alarm signal handling */
signal(SIGALRM,socket_timeout_alarm_handler);
updays = uptime / 86400;
uphours = (uptime % 86400) / 3600;
upminutes = ((uptime % 86400) % 3600) / 60;
- asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
+ asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
return_code=STATE_OK;
break;
-
-
-\f
/* process command-line arguments */
int process_arguments(int argc, char **argv){
int c;
-
-
-\f
void fetch_data (const char *address, int port, const char *sendb) {
int result;
-
-
-\f
void print_help(void)
{
print_revision(progname,"$Revision$");
-
void print_usage(void)
{
printf(_("\
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 46bc7e90816bba4729866034b8b71b228782889d..ec5d5d6c3544227925b1c60d824ca0b6dd5e034f 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.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_nwstat";
-
-
-\f
int
main(int argc, char **argv) {
int result;
textdomain (PACKAGE);
if (process_arguments(argc,argv)==ERROR)
- usage(_("Could not parse arguments\n"));
+ usage(_("check_nwstat: could not parse arguments\n"));
/* initialize alarm signal handling */
signal(SIGALRM,socket_timeout_alarm_handler);
if (time_sync_status==0) {
result=STATE_CRITICAL;
- asprintf (&output_message,_("Critical: Time not in sync with network!"));
+ asprintf (&output_message,_("CRITICAL - Time not in sync with network!"));
}
else {
- asprintf (&output_message,_("OK! Time in sync with network!"));
+ asprintf (&output_message,_("OK - Time in sync with network!"));
}
/* check LRU sitting time in secondss */
return result;
}
-\f
+
+
+
/* process command-line arguments */
int process_arguments(int argc, char **argv) {
int c;
-
-
-\f
void print_help(void)
{
char *myport;
-
void print_usage(void)
{
printf (_("\
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 0b524ff728ebca1be434004ec8cf77cfb965cef3..6682d8e68f9478eebe6c2d9e9d4d6e4737e1a4b5 100644 (file)
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.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_overcr";
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage ("Could not parse arguments\n");
+ usage (_("check_overcr: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
}
return OK;
}
-\f
+
+
+
void
print_usage (void)
{
printf (_(UT_HLP_VRS), progname, progname);
}
+
+
void
print_help (void)
{
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 07abd9c06f2d7f4e777f7a7157a1d96a2c814e47..53ba2950f6feb0940b0399e7b3db6f1900de06c2 100644 (file)
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
*****************************************************************************/
#define DEFAULT_DB "template1"
const char *revision = "$Revision$";
const char *copyright = "1999-2003";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
-\f
+
/******************************************************************************
<title>Functions</title>
-@@
******************************************************************************/
-\f
-
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage ("Could not parse arguments");
+ usage (_("check_pgsql: could not parse arguments\n"));
/* Set signal handling and alarm */
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
/* check to see that the backend connection was successfully made */
if (PQstatus (conn) == CONNECTION_BAD) {
- printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"),
+ printf (_("CRITICAL - no connection to '%s' (%s).\n"),
dbName, PQerrorMessage (conn));
PQfinish (conn);
return STATE_CRITICAL;
status = STATE_OK;
}
PQfinish (conn);
- printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"),
+ printf (_(" %s - database %s (%d sec.)|%s\n"),
state_text(status), dbName, elapsed_time,
fperfdata("time", elapsed_time, "s",
(int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0));
return status;
}
-\f
+
/* process command-line arguments */
switch (c) {
case '?': /* usage */
- usage3 (_("Unknown argument"), optopt);
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
break;
case 'c': /* critical time threshold */
if (!is_nonnegative (optarg))
- usage2 (_("Invalid critical threshold"), optarg);
+ usage2 (_("Critical threshold must be a positive integer"), optarg);
else
tcrit = strtod (optarg, NULL);
break;
case 'w': /* warning time threshold */
if (!is_nonnegative (optarg))
- usage2 (_("Invalid critical threshold"), optarg);
+ usage2 (_("Critical threshold must be a positive integer"), optarg);
else
twarn = strtod (optarg, NULL);
break;
case 'H': /* host */
if (!is_host (optarg))
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
else
pghost = optarg;
break;
case 'P': /* port */
if (!is_integer (optarg))
- usage2 (_("Port must be an integer"), optarg);
+ usage2 (_("Port must be a positive integer"), optarg);
else
pgport = optarg;
break;
-@@
******************************************************************************/
+
+
int
validate_arguments ()
{
return OK;
}
-\f
/******************************************************************************
-@@
******************************************************************************/
+
+
int
is_pg_dbname (char *dbname)
{
-@@
******************************************************************************/
+
+
int
is_pg_logname (char *username)
{
</article>
-@@
******************************************************************************/
-\f
-
printf (_(COPYRIGHT), copyright, email);
- printf (_("Test whether a PostgreSQL DBMS is accepting connections.\n\n"));
+ printf (_("Test whether a PostgreSQL Database is accepting connections.\n\n"));
print_usage ();
-
void
print_usage (void)
{
%s (-V | --version) for version information\n"),
progname, progname);
}
-
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 074519d3695a5def75059c52f1da061413bdea11..260e1b651a02921df0225d1147c7d9d26d3f6f25 100644 (file)
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.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_ping";
-
-\f
int
main (int argc, char **argv)
{
addresses[0] = NULL;
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments"));
+ usage (_("check_ping: could not parse arguments\n"));
/* Set signal handling and alarm */
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* usage */
- usage3 (_("Unknown argument"), optopt);
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
if (addresses[0] == NULL) {
if (is_host (argv[c]) == FALSE) {
- usage2 (_("Invalid host name/address"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
} else {
addresses[0] = argv[c++];
n_addresses++;
return validate_arguments ();
}
+
+
int
get_threshold (char *arg, float *trta, int *tpl)
{
return STATE_UNKNOWN;
}
+
+
int
validate_arguments ()
{
for (i=0; i<n_addresses; i++) {
if (is_host(addresses[i]) == FALSE)
- usage2 (_("Invalid host name/address"), addresses[i]);
+ usage2 (_("Invalid hostname/address"), addresses[i]);
}
return OK;
-
-
-\f
int
run_ping (const char *cmd, const char *addr)
{
/* check stderr, setting at least WARNING if there is output here */
while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr))
- if (! strstr(buf,"Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP"))
+ if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP"))
result = max_state (STATE_WARNING, error_scan (buf, addr));
(void) fclose (child_stderr);
-
-
int
error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
{
if (strstr (buf, "Network is unreachable"))
- die (STATE_CRITICAL, _("PING CRITICAL - Network unreachable (%s)"), addr);
+ die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr);
else if (strstr (buf, "Destination Host Unreachable"))
- die (STATE_CRITICAL, _("PING CRITICAL - Host Unreachable (%s)"), addr);
+ die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr);
else if (strstr (buf, "unknown host" ))
- die (STATE_CRITICAL, _("PING CRITICAL - Host not found (%s)"), addr);
+ die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr);
if (strstr (buf, "(DUP!)") || strstr (buf, "DUPLICATES FOUND")) {
if (warn_text == NULL)
-
-
-\f
void
print_usage (void)
{
printf (_(UT_HLP_VRS), progname, progname);
}
+
+
void
print_help (void)
{
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index d39bfa5467e0aa66eb8ac6964dd18f616338374c..011661c189325717064f70b15d17f83437a86e54 100644 (file)
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.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_procs";
-
-
-\f
int
main (int argc, char **argv)
{
metric = METRIC_PROCS;
if (process_arguments (argc, argv) == ERROR)
- usage (_("Unable to parse command line\n"));
-
+ usage (_("check_procs: could not parse arguments\n"));
/* Set signal handling and alarm timeout */
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
}
alarm (timeout_interval);
-
if (verbose >= 2)
printf (_("CMD: %s\n"), PS_COMMAND);
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* help */
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
case 'h': /* help */
-
int
validate_arguments ()
{
-
-
-\f
/* Check thresholds against value */
int
check_thresholds (int value)
-
-
-\f
void
print_help (void)
{
printf (_(UT_SUPPORT));
}
+
+
void
print_usage (void)
{
printf (_(UT_HLP_VRS), progname, progname);
}
+
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 725cf9f8ad68ffeb8744d05dfe49e9e1ccdfdcd0..3e6bdcae5880bca166cea2d699983fbeb5800822 100644 (file)
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.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_radius";
-@@
******************************************************************************/
+
+
int
main (int argc, char **argv)
{
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_radius: could not parse arguments\n"));
str = strdup ("dictionary");
if ((config_file && rc_read_config (config_file)) ||
if (is_intpos (argv[7]))
port = atoi (argv[7]);
else
- usage (_("Server port must be a positive integer"));
+ usage (_("Port must be a positive integer"));
expect = argv[8];
return OK;
}
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE) {
- usage2 (_("Invalid host name/address"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
server = optarg;
break;
if (is_intnonneg (optarg))
port = atoi (optarg);
else
- usage (_("Server port must be a positive integer"));
+ usage (_("Port must be a positive integer"));
break;
case 'u': /* username */
username = optarg;
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 755f6eb2ebc46609d8520eb5e4bb979d0eebe55d..3686ff4b15f2fe706b60b4188ea2862b415fcc9a 100644 (file)
--- a/plugins/check_real.c
+++ b/plugins/check_real.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_real";
-
-
-\f
int
main (int argc, char **argv)
{
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_real: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
else if (is_host (optarg))
server_address = optarg;
else
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
break;
case 'e': /* string to expect in response header */
server_expect = optarg;
server_port = atoi (optarg);
}
else {
- usage (_("Server port must be a positive integer\n"));
+ usage (_("Port must be a positive integer\n"));
}
break;
case 'w': /* warning time threshold */
check_warning_time = TRUE;
}
else {
- usage (_("Warning time must be a nonnegative integer\n"));
+ usage (_("Warning time must be a positive integer\n"));
}
break;
case 'c': /* critical time threshold */
print_help ();
exit (STATE_OK);
case '?': /* usage */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
server_address = argv[c++];
}
else {
- usage2 (_("Invalid host name"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
}
-
-
int
validate_arguments (void)
{
-
-\f
void
print_help (void)
{
-
-
void
print_usage (void)
{
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index ae3f88b120f76d2d2442f436dd3be277ebd58266..696af65600628e027ad49bf1ea0857b965ae37e0 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.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_smtp";
-
-
-\f
int
main (int argc, char **argv)
{
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_smtp: could not parse arguments\n"));
/* initialize the HELO command with the localhostname */
#ifndef HOST_MAX_BYTES
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
server_address = optarg;
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'p': /* port */
if (is_intpos (optarg))
server_port = atoi (optarg);
else
- usage (_("Server port must be a positive integer\n"));
+ usage (_("Port must be a positive integer\n"));
break;
case 'f': /* from argument */
from_arg = optarg;
check_critical_time = TRUE;
}
else {
- usage (_("Critical time must be a nonnegative integer\n"));
+ usage (_("Critical time must be a positive integer\n"));
}
break;
case 'w': /* warning time threshold */
check_warning_time = TRUE;
}
else {
- usage (_("Warning time must be a nonnegative integer\n"));
+ usage (_("Warning time must be a positive integer\n"));
}
break;
case 'v': /* verbose */
socket_timeout = atoi (optarg);
}
else {
- usage (_("Time interval must be a nonnegative integer\n"));
+ usage (_("Time interval must be a positive integer\n"));
}
break;
case '4':
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
if (is_host (argv[c]))
server_address = argv[c];
else
- usage2 (_("Invalid host name"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
else {
asprintf (&server_address, "127.0.0.1");
-
-
int
validate_arguments (void)
{
-
-
-\f
void
print_help (void)
{
-
-
void
print_usage (void)
{
[-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname);
printf (_(UT_HLP_VRS), progname, progname);
}
-
-
-
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 11ea9559f1dd440e242183485b0e0de932388119..7d0ebc92ed9a21cc59c39d04e8f464473573f1dd 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.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_snmp";
-
-
-\f
int
main (int argc, char **argv)
{
miblist = strdup (DEFAULT_MIBLIST);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_snmp: could not parse arguments\n"));
/* create the command line to execute */
asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
-
-
-\f
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* usage */
- usage3 ("Unknown argument", optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
}
-
-
/******************************************************************************
@@-
-@@
******************************************************************************/
+
+
int
validate_arguments ()
{
asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
}
-
}
else {
printf (_("Invalid SNMP version: %s\n"), proto);
exit (STATE_UNKNOWN);
}
-
-
-
return OK;
}
-
-
-\f
char *
clarify_message (char *msg)
{
-
int
check_num (int i)
{
-
int
lu_getll (unsigned long *ll, char *str)
{
-
int
lu_getul (unsigned long *ul, char *str)
{
-
/* trim leading whitespace
if there is a leading quote, make sure it balances */
-
/* if there's a leading quote, advance to the trailing quote
set the trailing quote to '\x0'
if the string continues, advance beyond the comma */
-
-
-\f
void
print_help (void)
{
printf (_(UT_SUPPORT));
}
+
+
void
print_usage (void)
{
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index ea74fa8865939a29c71b925b2993e20801650cbc..b78443fe5a1ec3a1f3b2f7057c309ecb478b10b3 100644 (file)
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
#include "common.h"
int ssh_connect (char *haddr, int hport, char *remote_version);
+
+
int
main (int argc, char **argv)
{
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_ssh: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
}
+
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* help */
- usage (_("Unknow argument\n"));
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'V': /* version */
print_revision (progname, revision);
exit (STATE_OK);
*
*-----------------------------------------------------------------------*/
+
int
ssh_connect (char *haddr, int hport, char *remote_version)
{
}
}
+
+
void
print_help (void)
{
printf (_(UT_SUPPORT));
}
+
+
void
print_usage (void)
{
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 3016e1ad5c63fbd441a09527e47c1dd23a67779b..064c65e4a7a2c954571e06aa79ddafc2496f8ae6 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
-\f
int
check_swap (int usp, long unsigned int free_swap)
{
}
+
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
print_help ();
exit (STATE_OK);
case '?': /* error */
- usage (_("Invalid argument\n"));
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
-
-
int
validate_arguments (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 7cef8bb92b8cb180aea81eec6707b3a450f72fc8..285932d5a8d53cb74d8c38b56ef581f19dfb3f60 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
*****************************************************************************/
/* progname "check_tcp" changes depending on symlink called */
-
-
-\f
int
main (int argc, char **argv)
{
status = strdup ("");
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_tcp: could not parse arguments\n"));
/* use default expect if none listed in process_arguments() */
if (EXPECT && server_expect_count == 0) {
return result;
}
-\f
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
- usage2 (_("invalid host name or address"), optarg);
+ usage2 (_("invalid hostname/address"), optarg);
server_address = optarg;
break;
case 'c': /* critical */
if (!is_intnonneg (optarg))
- usage (_("Critical threshold must be a nonnegative integer\n"));
+ usage (_("Critical threshold must be a positive integer\n"));
else
critical_time = strtod (optarg, NULL);
check_critical_time = TRUE;
break;
case 'w': /* warning */
if (!is_intnonneg (optarg))
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
warning_time = strtod (optarg, NULL);
check_warning_time = TRUE;
break;
case 'p': /* port */
if (!is_intpos (optarg))
- usage (_("Server port must be a positive integer\n"));
+ usage (_("Port must be a positive integer\n"));
else
server_port = atoi (optarg);
break;
else if (!strncmp(optarg,"crit",4))
econn_refuse_state = STATE_CRITICAL;
else
- usage (_("Refuse mut be one of ok, warn, crit\n"));
+ usage (_("Refuse must be one of ok, warn, crit\n"));
break;
case 'd':
if (is_intpos (optarg))
return OK;
}
-\f
+
+
#ifdef HAVE_SSL
int
}
#endif
+
+
#ifdef HAVE_SSL
int
check_certificate (X509 ** certificate)
}
#endif
+
+
int
my_recv (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_time.c b/plugins/check_time.c
index 314b768369559fa8f02d158adbcf694cbcef3555..617b9e023a8ca0feb5f4c9f077de0ab760c64770 100644 (file)
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
#include "common.h"
textdomain (PACKAGE);
if (process_arguments (argc, argv) != OK)
- usage (_("Incorrect arguments supplied\n"));
+ usage (_("check_time: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
-
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage3 (_("Unknown argument"), optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'h': /* help */
print_help ();
exit (STATE_OK);
exit (STATE_OK);
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
- usage2 (_("Invalid host name/address"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
server_address = optarg;
break;
case 'w': /* warning-variance */
check_warning_time = TRUE;
}
else {
- usage (_("Warning thresholds must be a nonnegative integer\n"));
+ usage (_("Warning thresholds must be a positive integer\n"));
}
}
else {
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
}
break;
case 'c': /* critical-variance */
check_critical_time = TRUE;
}
else {
- usage (_("Critical thresholds must be a nonnegative integer\n"));
+ usage (_("Critical thresholds must be a positive integer\n"));
}
}
else {
- usage (_("Critical threshold must be a nonnegative integer\n"));
+ usage (_("Critical threshold must be a positive integer\n"));
}
break;
case 'W': /* warning-connect */
if (!is_intnonneg (optarg))
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
warning_time = atoi (optarg);
check_warning_time = TRUE;
break;
case 'C': /* critical-connect */
if (!is_intnonneg (optarg))
- usage (_("Critical threshold must be a nonnegative integer\n"));
+ usage (_("Critical threshold must be a positive integer\n"));
else
critical_time = atoi (optarg);
check_critical_time = TRUE;
break;
case 'p': /* port */
if (!is_intnonneg (optarg))
- usage (_("Server port must be a nonnegative integer\n"));
+ usage (_("Port must be a positive integer\n"));
else
server_port = atoi (optarg);
break;
if (server_address == NULL) {
if (argc > c) {
if (is_host (argv[c]) == FALSE)
- usage2 (_("Invalid host name/address"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
server_address = argv[c];
}
else {
- usage (_("Host name was not supplied\n"));
+ usage (_("Hostname was not supplied\n"));
}
}
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_udp.c b/plugins/check_udp.c
index 05ade04e1d8fde2c1726020bc403aa91ac379942..64ab83a7df6ae7fa30c35f1acdd54fed81c184cf 100644 (file)
--- a/plugins/check_udp.c
+++ b/plugins/check_udp.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_udp";
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage ("\n");
+ usage (_("check_udp: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
- usage2 (_("Invalid host name/address"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
server_address = optarg;
break;
case 'c': /* critical */
if (!is_intnonneg (optarg))
- usage (_("Critical threshold must be a nonnegative integer\n"));
+ usage (_("Critical threshold must be a positive integer\n"));
else
critical_time = atoi (optarg);
check_critical_time = TRUE;
break;
case 'w': /* warning */
if (!is_intnonneg (optarg))
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
warning_time = atoi (optarg);
check_warning_time = TRUE;
break;
case 'p': /* port */
if (!is_intnonneg (optarg))
- usage (_("Server port must be a nonnegative integer\n"));
+ usage (_("Port must be a positive integer\n"));
else
server_port = atoi (optarg);
break;
c = optind;
if (server_address == NULL && c < argc && argv[c]) {
if (is_host (argv[c]) == FALSE)
- usage2 (_("Invalid host name/address"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
server_address = argv[c++];
}
-
-
-\f
void
print_help (void)
{
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 33cba7708cf5f95693ea528c018ce47e09728c98..7f88ec309e2de96cc11bbc8a7646cd3bf401c7c5 100644 (file)
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.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_ups";
data = strdup ("");
if (process_arguments (argc, argv) != OK)
- usage ("Invalid command arguments supplied\n");
+ usage (_("check_ups: could not parse arguments\n"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) !=
STATE_OK) {
- printf ("Invalid response received from hostn");
+ printf ("Invalid response received from host\n");
return ERROR;
}
-
-
/* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable]
[-wv warn_value] [-cv crit_value] [-to to_sec] */
switch (c) {
case '?': /* help */
- usage3 ("Unknown option", optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
case 'H': /* hostname */
if (is_host (optarg)) {
server_address = optarg;
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'u': /* ups name */
server_port = atoi (optarg);
}
else {
- usage2 ("Server port must be a positive integer", optarg);
+ usage2 ("Port must be a positive integer", optarg);
}
break;
case 'c': /* critical time threshold */
check_crit = TRUE;
}
else {
- usage2 ("Critical time must be a nonnegative integer", optarg);
+ usage2 ("Critical time must be a positive integer", optarg);
}
break;
case 'w': /* warning time threshold */
check_warn = TRUE;
}
else {
- usage2 ("Warning time must be a nonnegative integer", optarg);
+ usage2 ("Warning time must be a positive integer", optarg);
}
break;
case 'v': /* variable */
socket_timeout = atoi (optarg);
}
else {
- usage ("Time interval must be a nonnegative integer\n");
+ usage ("Time interval must be a positive integer\n");
}
break;
case 'V': /* version */
- print_revision (progname, "$Revision$");
+ print_revision (progname, revision);
exit (STATE_OK);
case 'h': /* help */
print_help ();
if (is_host (argv[optind]))
server_address = argv[optind++];
else
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
if (server_address == NULL)
-
-
int
validate_arguments (void)
{
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 377a11a692730cb94879807c90c5eb94802df2fc..0417bad165f5b5d42327633ab0282edb7cf61795 100644 (file)
--- a/plugins/check_users.c
+++ b/plugins/check_users.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_users";
perf = strdup("");
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("check_users: could not parse arguments\n"));
/* run the command */
child_process = spopen (WHO_COMMAND);
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
exit (STATE_OK);
case 'c': /* critical */
if (!is_intnonneg (optarg))
- usage (_("Critical threshold must be a nonnegative integer\n"));
+ usage (_("Critical threshold must be a positive integer\n"));
else
cusers = atoi (optarg);
break;
case 'w': /* warning */
if (!is_intnonneg (optarg))
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
wusers = atoi (optarg);
break;
c = optind;
if (wusers == -1 && argc > c) {
if (is_intnonneg (argv[c]) == FALSE)
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
wusers = atoi (argv[c++]);
}
if (cusers == -1 && argc > c) {
if (is_intnonneg (argv[c]) == FALSE)
- usage (_("Warning threshold must be a nonnegative integer\n"));
+ usage (_("Warning threshold must be a positive integer\n"));
else
cusers = atoi (argv[c]);
}
-
-
-\f
void
print_help (void)
{
@@ -214,7 +211,6 @@ system and generates an error if the number exceeds the thresholds specified.\n"
-
void
print_usage (void)
{
diff --git a/plugins/common.h b/plugins/common.h
index fb8ca9c624b36443a057e94562444f31eb8bb1d9..e3f150f9116047e3dd61f9dc38ce0dc1009e1ff2 100644 (file)
--- a/plugins/common.h
+++ b/plugins/common.h
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * $Id$
+ *
*****************************************************************************/
#include "config.h"
diff --git a/plugins/getaddrinfo.c b/plugins/getaddrinfo.c
index 12ac67d6c42d7e281cd142723e6f644c5a9e54c5..569782083d6a9d0b6273d2d890feea2188b708ee 100644 (file)
--- a/plugins/getaddrinfo.c
+++ b/plugins/getaddrinfo.c
*/
/* An emulation of the RFC 2553 / Posix getaddrinfo resolver interface.
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H
diff --git a/plugins/getaddrinfo.h b/plugins/getaddrinfo.h
index 5bcc8844a263bdd105330449b2d7dd20c3eebe6a..d41152459de5c284b4e68eed2b03374fbb04d82c 100644 (file)
--- a/plugins/getaddrinfo.h
+++ b/plugins/getaddrinfo.h
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* Structure and prototypes aken from RFC 2553 */
+/* Structure and prototypes aken from RFC 2553
+ *
+ * $Id$
+ */
struct addrinfo
{
index d151606d722f1c9e47e1477e19f72f6e80f74b83..d1b768bc594bda153372ef5adc03cc25e90f648a 100644 (file)
--- a/plugins/gethostbyname.c
+++ b/plugins/gethostbyname.c
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
*/
#ifdef HAVE_CONFIG_H
index 2b963997c6017dde0b5271753aa6dda40f6c7b45..e420837dd82057590d84735096abcb42a8e3a43b 100644 (file)
--- a/plugins/gethostbyname.h
+++ b/plugins/gethostbyname.h
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
*/
/*************************************************************************
diff --git a/plugins/negate.c b/plugins/negate.c
index a71f1b67147516fbfd97a4c06484ce578c8a7d7c..9e5cf46fd8a490e9bebec8b24b534ac7696cf340 100644 (file)
--- a/plugins/negate.c
+++ b/plugins/negate.c
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
@@-<article>
void print_help (void);
void print_usage (void);
+
+
int
main (int argc, char **argv)
{
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage (_("negate: could not parse arguments\n"));
/* Set signal handling and alarm */
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
else
exit (result);
}
-\f
-
/******************************************************************************
@@-
-@@
******************************************************************************/
+
+
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* help */
- usage3 (_("Unknown argument"), optopt);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
break;
case 'h': /* help */
print_help ();
-@@
******************************************************************************/
+
+
int
validate_arguments ()
{
-
-
-\f
void
print_help (void)
{
-
-
void
print_usage (void)
{
diff --git a/plugins/netutils.c b/plugins/netutils.c
index aee53d35e70b2aca97f924e707d2eb2a3b07c6d0..6702b13f25250439416549681e85f5aa98a8d316 100644 (file)
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+* $Id$
+*
****************************************************************************/
#include "common.h"
send_result = send (sd, send_buffer, strlen (send_buffer), 0);
if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) {
- printf ("send() failed\n");
+ printf ("Send failed\n");
result = STATE_WARNING;
}
@@ -313,7 +315,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
send_result = send (sd, send_buffer, strlen (send_buffer), 0);
if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) {
- printf ("send() failed\n");
+ printf ("Send failed\n");
result = STATE_WARNING;
}
@@ -337,7 +339,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
if (recv_result == -1) {
strcpy (recv_buffer, "");
if (proto != IPPROTO_TCP)
- printf ("recv() failed\n");
+ printf ("Receive failed\n");
result = STATE_WARNING;
}
else
diff --git a/plugins/netutils.h b/plugins/netutils.h
index b2c2a2f5584665e0208207c74ddebaf532d3fff0..2f31bdc83f3b33e30fed9ee6a52cb6bde81e001f 100644 (file)
--- a/plugins/netutils.h
+++ b/plugins/netutils.h
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+* $Id$
+*
******************************************************************************/
#include "config.h"
diff --git a/plugins/popen.c b/plugins/popen.c
index 05fd0ab9a0b32063bed8bddc633ca3a54d43fe27..d527c222906d63c23a912c9fee34b14d17b2e37d 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
* path passed to the exec'd program are esstially empty. (popen create a shell
* and passes the environment to it).
*
+ * $Id$
+ *
******************************************************************************/
#include "common.h"
diff --git a/plugins/urlize.c b/plugins/urlize.c
index d3d97b5a7ffadab9df923dd5f1ef1953bccab78f..9973c1a31d5b1114a948c3e010e157ad948a5dd2 100644 (file)
--- a/plugins/urlize.c
+++ b/plugins/urlize.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 = "urlize";
break;
case '?':
default:
- usage3 (_("Unknown argument"), optopt);
- break;
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+ print_usage ();
+ exit (STATE_UNKNOWN);
}
}
-
-
-\f
void
print_help (void)
{
-
void
print_usage (void)
{
diff --git a/plugins/utils.c b/plugins/utils.c
index bb380301a639aa899c228725cbe3cf425b7aae42..460ff824a1fa7acae0426e412489abbf4265b704 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
}
-
-
-
/******************************************************************************
*
* Copies one string to another. Any previously existing data in
-
-
/******************************************************************************
*
* Returns a pointer to the next line of a multiline string buffer
}
-
-
-
/******************************************************************************
*
* Like strscpy, except only the portion of the source string up to
-
-
/******************************************************************************
*
* Like strscat, except only the portion of the source string up to
}
-
-
/******************************************************************************
*
* Print perfdata in a standard format
diff --git a/plugins/utils.h b/plugins/utils.h
index 35e62ab44c36be7821f1726948520f27c5300666..a3ddc0a27081305a593151b02daa007f25540e6f 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
/* Standardize version information, termination */
+/* $Id$ */
+
void support (void);
char *clean_revstring (const char *revstring);
void print_revision (const char *, const char *);