示例#1
0
int mp_getopt(int *argc, char **argv[], const char *optstring,
                const struct option *longopts, int *longindex) {
    int c;

    while (1) {
        c = getopt_long(*argc, *argv, optstring, longopts, NULL);

        if (c == -1 || c == EOF)
            return c;

        /* Handle default opts */
        switch (c) {
            case 'h':
                print_help();
                exit(0);
            case 'V':
                print_revision();
                exit(0);
            case 'v':
                mp_verbose++;
                break;
            case MP_LONGOPT_EOPT:
                *argv = mp_eopt(argc, *argv, optarg);
                break;
            case 't':
                mp_timeout = (int)strtol(optarg, NULL, 10);
                break;
            default:
                // Let the caller handle this option
                return c;
        };
    }

    return EOF;
}
示例#2
0
void
print_help (void)
{
  char *myport;

  asprintf (&myport, "%d", DEFAULT_PORT);

  print_revision (progname, revision);

  printf ("Copyright (c) 2000 Karl DeBisschop <*****@*****.**>\n");
  printf (COPYRIGHT, copyright, email);

  printf (_("This plugin test the DNS service on the specified host using dig"));

  printf ("\n\n");

  print_usage ();

  printf (_(UT_HELP_VRSN));

  printf (_(UT_HOST_PORT), 'p', myport);

  printf (" %s\n","-l, --lookup=STRING");
  printf ("    %s\n",_("machine name to lookup"));
  printf (" %s\n","-T, --record_type=STRING");
  printf ("    %s\n",_("record type to lookup (default: A)"));
  printf (" %s\n","-a, --expected_address=STRING");
  printf ("    %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l"));
  printf (_(UT_WARN_CRIT));
  printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
  printf (_(UT_VERBOSE));
  printf (_(UT_SUPPORT));
}
示例#3
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf (_(COPYRIGHT), copyright, email);

	printf ("%s\n", _("Check swap space on local machine."));

  printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (" %s\n", "-w, --warning=INTEGER");
  printf ("    %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free"));
  printf (" %s\n", "-w, --warning=PERCENT%%");
  printf ("    %s\n", _("Exit with WARNING status if less than PERCENT of swap space is free"));
  printf (" %s\n", "-c, --critical=INTEGER");
  printf ("    %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of swap space are free"));
  printf (" %s\n", "-c, --critical=PERCENT%%");
  printf ("    %s\n", _("Exit with CRITCAL status if less than PERCENT of swap space is free"));
  printf (" %s\n", "-a, --allswaps");
  printf ("    %s\n", _("Conduct comparisons for all swap partitions, one by one"));
	printf (UT_VERBOSE);

	printf ("\n");
  printf ("%s\n", _("Notes:"));
  printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s."));

	printf (UT_SUPPORT);
}
void print_help(void)
{
  char *mcport;
  asprintf(&mcport, "%d", MEMCACHED_PORT);

  print_revision (progname, revision);

  printf (_(MY_COPYRIGHT), copyright, email);

  printf ("%s\n", _("This program checks results of request sequentially: SET, GET, DELETE, GET"));

  printf ("\n\n");

  print_usage ();

  printf (_(UT_HELP_VRSN));
  printf (_(UT_EXTRA_OPTS));
  printf (_(UT_WARN_CRIT_RANGE));
  printf (_(UT_HOST_PORT), 'P', mcport);
  printf (" -E, --expire=INTEGER\n    expire time(second) for SET command (default: 0)\n");

#ifdef NP_EXTRA_OPTS
  printf ("\n");
  printf ("%s\n", _("Notes:"));
  printf (_(UT_EXTRA_OPTS_NOTES));
#endif

  /* printf (_(UT_SUPPORT)); */
  puts("\nRepository:\n  http://github.com/hirose31/nagios-check_memcached_paranoid/tree/master\n\n");
}
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Ethan Galstad <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("This plugin tests the STATUS of an HP printer with a JetDirect card."));
	printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));

	printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (" %s\n", "-C, --community=STRING");
	printf ("    %s", _("The SNMP community name "));
	printf (_("(default=%s)"), DEFAULT_COMMUNITY);
	printf ("\n");
	printf (" %s\n", "-p, --port=STRING");
	printf ("    %s", _("Specify the port to check "));
	printf (_("(default=%s)"), DEFAULT_PORT);
	printf ("\n");

	printf (UT_SUPPORT);
}
示例#6
0
void print_help (void) {
    print_revision();
    print_revision_snmp();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    printf("\nIf no On/Off-Ports are defines all ports are asumed as should be On.\n");
    printf("\nOn/Off-Ports can be named or nubered. ex: --on '1,Outlet 3,4'\n");

    print_help_default();

    printf(" -o, --on=PORT[,PORTS]\n");
    printf("      Ports which should be On.\n");
    printf(" -O, --off=PORT[,PORTS]\n");
    printf("      Ports which should be Off.\n");

    print_help_snmp();
}
void print_help (void) {
    print_revision();
    print_revision_snmp();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();

    print_help_warn("remaining charge", DEFAULT_CHARGE_WARNING);
    print_help_crit("remaining charge", DEFAULT_CHARGE_CRITICAL);
    printf(" -W\n");
    printf("      Return warning if remaining runtime exceeds limit. "
           "Defaults to %s\n", DEFAULT_RUNTIME_WARNING);
    printf(" -Z\n");
    printf("      Return critical if remaining runtime exceeds limit. "
           "Defaults to %s\n", DEFAULT_RUNTIME_CRITICAL);
    printf(" -e, --extended-status\n");
    printf("      Print extended status.\n");

    print_help_snmp();
}
示例#8
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Ethan Galstad <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("This plugin will check either the average or maximum value of one of the"));
  printf ("%s\n", _("two variables recorded in an MRTG log file."));

  printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (" %s\n", "-F, --logfile=FILE");
  printf ("   %s\n", _("The MRTG log file containing the data you want to monitor"));
  printf (" %s\n", "-e, --expires=MINUTES");
  printf ("   %s\n", _("Minutes before MRTG data is considered to be too old"));
  printf (" %s\n", "-a, --aggregation=AVG|MAX");
  printf ("   %s\n", _("Should we check average or maximum values?"));
  printf (" %s\n", "-v, --variable=INTEGER");
  printf ("   %s\n", _("Which variable set should we inspect? (1 or 2)"));
  printf (" %s\n", "-w, --warning=INTEGER");
  printf ("   %s\n", _("Threshold value for data to result in WARNING status"));
  printf (" %s\n", "-c, --critical=INTEGER");
  printf ("   %s\n", _("Threshold value for data to result in CRITICAL status"));
	printf (" %s\n", "-l, --label=STRING");
  printf ("   %s\n", _("Type label for data (Examples: Conns, \"Processor Load\", In, Out)"));
  printf (" %s\n", "-u, --units=STRING");
  printf ("   %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,"));
  printf ("   %s\n", _("\"Bytes Per Second\", \"%% Utilization\")"));

  printf ("\n");
	printf (" %s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If"));
  printf (" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned.  If"));
  printf (" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING"));
  printf (" %s\n", _("status is returned and a warning message is printed."));

  printf ("\n");
	printf (" %s\n", _("This plugin is useful for monitoring MRTG data that does not correspond to"));
  printf (" %s\n", _("bandwidth usage.  (Use the check_mrtgtraf plugin for monitoring bandwidth)."));
  printf (" %s\n", _("It can be used to monitor any kind of data that MRTG is monitoring - errors,"));
  printf (" %s\n", _("packets/sec, etc.  I use MRTG in conjuction with the Novell NLM that allows"));
  printf (" %s\n", _("me to track processor utilization, user connections, drive space, etc and"));
  printf (" %s\n\n", _("this plugin works well for monitoring that kind of data as well."));

	printf ("%s\n", _("Notes:"));
  printf (" %s\n", _("- This plugin only monitors one of the two variables stored in the MRTG log"));
  printf ("   %s\n", _("file.  If you want to monitor both values you will have to define two"));
  printf ("   %s\n", _("commands with different values for the <variable> argument.  Of course,"));
  printf ("   %s\n", _("you can always hack the code to make this plugin work for you..."));
  printf (" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher.  It can be downloaded from"));
  printf ("   %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");

	printf (UT_SUPPORT);
}
void print_help (void) {
    print_revision();
    print_revision_ldns();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();
    print_help_host();
    print_help_ldns();
    printf(" -D, --domain=DOMAIN\n");
    printf("      The name of the domain to check.\n");
    printf(" -T, --trace-from=DOMAIN\n");
    printf("      The name of the domain to trace from. (default: .)\n");
    printf(" -k, --trusted-keys=FILE\n");
    printf("      File to read trust-anchors from.\n");
    printf(" -R, --resolver=HOST\n");
    printf("      Host name or IP Address of the resolver to use.\n");

    printf("\n");
    print_help_ldns_keyfile();
}
示例#10
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf (_(COPYRIGHT), copyright, email);

	printf ("%s\n", _("This plugin checks the status of the Nagios process on the local machine"));
  printf ("%s\n", _("The plugin will check to make sure the Nagios status log is no older than"));
  printf ("%s\n", _("the number of minutes specified by the expires option."));
  printf ("%s\n", _("It also checks the process table for a process matching the command argument."));

  printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (" %s\n", "-F, --filename=FILE");
  printf ("    %s\n", _("Name of the log file to check"));
  printf (" %s\n", "-e, --expires=INTEGER");
  printf ("    %s\n", _("Minutes aging after which logfile is considered stale"));
  printf (" %s\n", "-C, --command=STRING");
  printf ("    %s\n", _("Substring to search for in process arguments"));
  printf (" %s\n", "-t, --timeout=INTEGER");
  printf ("    %s\n", _("Timeout for the plugin in seconds"));
  printf (UT_VERBOSE);

  printf ("\n");
  printf ("%s\n", _("Examples:"));
  printf (" %s\n", "check_nagios -t 20 -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios");

  printf (UT_SUPPORT);
}
示例#11
0
/* print usage help */
void print_help(void){

	print_revision(progname, NP_VERSION);

	printf("Copyright (c) 2001-2004 Ethan Galstad ([email protected])\n");
	printf (COPYRIGHT, copyright, email);

	printf("%s\n", _("This plugin tests the availability of DHCP servers on a network."));

  printf ("\n\n");

	print_usage();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (UT_VERBOSE);

	printf (" %s\n", "-s, --serverip=IPADDRESS");
  printf ("    %s\n", _("IP address of DHCP server that we must hear from"));
  printf (" %s\n", "-r, --requestedip=IPADDRESS");
  printf ("    %s\n", _("IP address that should be offered by at least one DHCP server"));
  printf (" %s\n", "-t, --timeout=INTEGER");
  printf ("    %s\n", _("Seconds to wait for DHCPOFFER before timeout occurs"));
  printf (" %s\n", "-i, --interface=STRING");
  printf ("    %s\n", _("Interface to to use for listening (i.e. eth0)"));
  printf (" %s\n", "-m, --mac=STRING");
  printf ("    %s\n", _("MAC address to use in the DHCP request"));
  printf (" %s\n", "-u, --unicast");
  printf ("    %s\n", _("Unicast testing: mimic a DHCP relay, requires -s"));

  printf (UT_SUPPORT);
	return;
	}
示例#12
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Ethan Galstad\n");
	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("This plugin checks the number of users currently logged in on the local"));
	printf ("%s\n", _("system and generates an error if the number exceeds the thresholds specified."));

	printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (" %s\n", "-w, --warning=INTEGER");
	printf ("    %s\n", _("Set WARNING status if more than INTEGER users are logged in"));
	printf (" %s\n", "-c, --critical=INTEGER");
	printf ("    %s\n", _("Set CRITICAL status if more than INTEGER users are logged in"));

	printf (UT_SUPPORT);
}
示例#13
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 2000 Karl DeBisschop <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("This plugin wraps the text output of another command (plugin)"));
  printf ("%s\n", _("in HTML <A> tags, thus displaying the child plugin's output as a clickable link in"));
  printf ("%s\n", _("the Nagios status screen.  This plugin returns the status of the invoked plugin."));

  printf ("\n\n");

	print_usage ();

  printf (UT_HELP_VRSN);

  printf ("\n");
  printf ("%s\n", _("Examples:"));
	printf ("%s\n", _("Pay close attention to quoting to ensure that the shell passes the expected"));
  printf ("%s\n\n", _("data to the plugin. For example, in:"));
  printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r 'two words'"));
  printf ("    %s\n", _("the shell will remove the single quotes and urlize will see:"));
  printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r two words"));
  printf ("    %s\n\n", _("You probably want:"));
  printf (" %s\n", _("urlize http://example.com/ \"check_http -H example.com -r 'two words'\""));

	printf (UT_SUPPORT);
}
void print_help (void) {
    print_revision();
    print_revision_ldns();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();
    print_help_host();
    printf(" -D, --domain=DOMAIN\n");
    printf("      The name of the domain to check.\n");
    printf("     --norecursion\n");
    printf("      Do not test for disabled recursion.\n");
    printf("     --notcp\n");
    printf("      Do not test TCP queries.\n");
    printf("     --noudp\n");
    printf("      Do not test UDP queries.\n");
    printf("     --noaxfrn\n");
    printf("      Do not test for disabled AXFR.\n");
}
示例#15
0
void print_help (void) {
    print_revision();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();
    print_help_host();
#ifdef USE_IPV6
    print_help_46();
#endif //USE_IPV6

    printf(" -p, --packets=[NUM]\n");
    printf("      Number of packets to send. (Default to 5)\n");
    printf(" -q, --quick\n");
    printf("      Return as soon as OK is reached.\n");
    printf(" -i, --interval=[SEC]\n");
    printf("      Number of secounds to wait between packets. (Default to 1)\n");
    printf(" -I, --interfact=[DEV]\n");
    printf("      Set the outgoing network device to use.\n");
    printf(" -T, --ttl=[NUM]\n");
    printf("      Set TTL of packets to given value.\n");
    printf(" -w, --warning=<rta>,<pl>%%\n");
    printf("      Return warning if check exceeds TRA or Packet loss limit.\n");
    printf("            (Default to 90ms and 10%%)\n");
    printf(" -c, --critical=<rta>,<pl>%%\n");
    printf("      Return critical if check exceeds TRA or Packet loss limit\n");
    printf("            (Default to 100ms and 20%%)\n");
}
示例#16
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Nagios feature - 1999 Robert Dale <*****@*****.**>\n");
	printf ("(C) 1999 Ragnar Hojland Espinosa <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf (_("This plugin checks a local hard drive with the (Linux specific) SMART interface [http://smartlinux.sourceforge.net/smart/index.php]."));

  printf ("\n\n");

  print_usage ();

  printf (UT_HELP_VRSN);
  printf (UT_EXTRA_OPTS);

  printf (" %s\n", "-d, --device=DEVICE");
  printf ("    %s\n", _("Select device DEVICE"));
  printf ("    %s\n", _("Note: if the device is selected with this option, _no_ other options are accepted"));
  printf (" %s\n", "-i, --immediate");
  printf ("    %s\n", _("Perform immediately offline tests"));
  printf (" %s\n", "-q, --quiet-check");
  printf ("    %s\n", _("Returns the number of failed tests"));
  printf (" %s\n", "-1, --auto-on");
  printf ("    %s\n", _("Turn on automatic offline tests"));
  printf (" %s\n", "-0, --auto-off");
  printf ("    %s\n", _("Turn off automatic offline tests"));
  printf (" %s\n", "-n, --nagios");
  printf ("    %s\n", _("Output suitable for Nagios"));

  printf (UT_SUPPORT);
}
示例#17
0
void
print_help (void)
{
	char *myport;
	xasprintf (&myport, "%d", SSH_DFL_PORT);

	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Remi Paulmier <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("Try to connect to an SSH server at specified server and port"));

  printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (UT_HOST_PORT, 'p', myport);

	printf (UT_IPv46);

	printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);

	printf (" %s\n", "-r, --remote-version=STRING");
  printf ("    %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));

	printf (UT_VERBOSE);

	printf (UT_SUPPORT);
}
示例#18
0
void
print_help (void)
{
	char *myport;
	xasprintf (&myport, "%d", DEFAULT_PORT);

	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Didi Rieder ([email protected])\n");
	printf (COPYRIGHT, copyright, email);

	printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (UT_HOST_PORT, 'p', myport);

	printf (UT_IPv46);

	printf (" %s\n", "-a [--attr]");
  printf ("    %s\n", _("ldap attribute to search (default: \"(objectclass=*)\""));
  printf (" %s\n", "-b [--base]");
  printf ("    %s\n", _("ldap base (eg. ou=my unit, o=my org, c=at"));
  printf (" %s\n", "-D [--bind]");
  printf ("    %s\n", _("ldap bind DN (if required)"));
  printf (" %s\n", "-P [--pass]");
  printf ("    %s\n", _("ldap password (if required)"));
  printf (" %s\n", "-T [--starttls]");
  printf ("    %s\n", _("use starttls mechanism introduced in protocol version 3"));
  printf (" %s\n", "-S [--ssl]");
  printf ("    %s %i\n", _("use ldaps (ldap v2 ssl method). this also sets the default port to"), LDAPS_PORT);

#ifdef HAVE_LDAP_SET_OPTION
	printf (" %s\n", "-2 [--ver2]");
  printf ("    %s\n", _("use ldap protocol version 2"));
  printf (" %s\n", "-3 [--ver3]");
  printf ("    %s\n", _("use ldap protocol version 3"));
  printf ("    (%s %d)\n", _("default protocol version:"), DEFAULT_PROTOCOL);
#endif

	printf (UT_WARN_CRIT);

	printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);

	printf (UT_VERBOSE);

	printf ("\n");
	printf ("%s\n", _("Notes:"));
	printf (" %s\n", _("If this plugin is called via 'check_ldaps', method 'STARTTLS' will be"));
	printf (_(" implied (using default port %i) unless --port=636 is specified. In that case\n"), DEFAULT_PORT);
	printf (" %s\n", _("'SSL on connect' will be used no matter how the plugin was called."));
	printf (" %s\n", _("This detection is deprecated, please use 'check_ldap' with the '--starttls' or '--ssl' flags"));
	printf (" %s\n", _("to define the behaviour explicitly instead."));

	printf (UT_SUPPORT);
}
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf ("Copyright (c) 1999 Ethan Galstad <*****@*****.**>\n");
	printf (COPYRIGHT, copyright, email);

	printf (_("This plugin tests %s connections with the specified host (or unix socket).\n\n"),
	        SERVICE);

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (UT_HOST_PORT, 'p', "none");

	printf (UT_IPv46);

	printf (" %s\n", "-E, --escape");
  printf ("    %s\n", _("Can use \\n, \\r, \\t or \\\\ in send or quit string. Must come before send or quit option"));
  printf ("    %s\n", _("Default: nothing added to send, \\r\\n added to end of quit"));
  printf (" %s\n", "-s, --send=STRING");
  printf ("    %s\n", _("String to send to the server"));
  printf (" %s\n", "-e, --expect=STRING");
  printf ("    %s %s\n", _("String to expect in server response"), _("(may be repeated)"));
  printf (" %s\n", "-A, --all");
  printf ("    %s\n", _("All expect strings need to occur in server response. Default is any"));
  printf (" %s\n", "-q, --quit=STRING");
  printf ("    %s\n", _("String to send server to initiate a clean close of the connection"));
  printf (" %s\n", "-r, --refuse=ok|warn|crit");
  printf ("    %s\n", _("Accept TCP refusals with states ok, warn, crit (default: crit)"));
  printf (" %s\n", "-M, --mismatch=ok|warn|crit");
  printf ("    %s\n", _("Accept expected string mismatches with states ok, warn, crit (default: warn)"));
  printf (" %s\n", "-j, --jail");
  printf ("    %s\n", _("Hide output from TCP socket"));
  printf (" %s\n", "-m, --maxbytes=INTEGER");
  printf ("    %s\n", _("Close connection once more than this number of bytes are received"));
  printf (" %s\n", "-d, --delay=INTEGER");
  printf ("    %s\n", _("Seconds to wait between sending string and polling for response"));

#ifdef HAVE_SSL
	printf (" %s\n", "-D, --certificate=INTEGER[,INTEGER]");
  printf ("    %s\n", _("Minimum number of days a certificate has to be valid."));
  printf ("    %s\n", _("1st is #days for warning, 2nd is critical (if not specified - 0)."));
  printf (" %s\n", "-S, --ssl");
  printf ("    %s\n", _("Use SSL for the connection."));
#endif

	printf (UT_WARN_CRIT);

	printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);

	printf (UT_VERBOSE);

	printf (UT_SUPPORT);
}
示例#20
0
void
print_help (void)
{
	char *myport;

	xasprintf (&myport, "%d", DEFAULT_PORT);

	print_revision (progname, NP_VERSION);

	printf (COPYRIGHT, copyright, email);

	printf (_("Test whether a PostgreSQL Database is accepting connections."));

	printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

	printf (UT_HOST_PORT, 'P', myport);

	printf (UT_IPv46);

	printf (" %s\n", "-d, --database=STRING");
	printf ("    %s", _("Database to check "));
	printf (_("(default: %s)"), DEFAULT_DB);
	printf (" %s\n", "-l, --logname = STRING");
	printf ("    %s\n", _("Login name of user"));
	printf (" %s\n", "-p, --password = STRING");
	printf ("    %s\n", _("Password (BIG SECURITY ISSUE)"));

	printf (UT_WARN_CRIT);

	printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);

	printf (UT_VERBOSE);

	printf ("\n");
	printf (" %s\n", _("All parameters are optional."));
	printf (" %s\n", _("This plugin tests a PostgreSQL DBMS to determine whether it is active and"));
	printf (" %s\n", _("accepting queries. In its current operation, it simply connects to the"));
	printf (" %s\n", _("specified database, and then disconnects. If no database is specified, it"));
	printf (" %s\n", _("connects to the template1 database, which is present in every functioning"));
	printf (" %s\n\n", _("PostgreSQL DBMS."));

	printf (" %s\n", _("The plugin will connect to a local postmaster if no host is specified. To"));
	printf (" %s\n", _("connect to a remote host, be sure that the remote postmaster accepts TCP/IP"));
	printf (" %s\n\n", _("connections (start the postmaster with the -i option)."));

	printf (" %s\n", _("Typically, the nagios user (unless the --logname option is used) should be"));
	printf (" %s\n", _("able to connect to the database without a password. The plugin can also send"));
	printf (" %s\n", _("a password, but no effort is made to obsure or encrypt the password."));

	printf (UT_SUPPORT);
}
示例#21
0
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
{
	int c;
	int option = 0;
	static struct option longopts[] = {
		{"critical", required_argument, 0, 'c'},
		{"warning", required_argument, 0, 'w'},
		{"version", no_argument, 0, 'V'},
		{"help", no_argument, 0, 'h'},
		{0, 0, 0, 0}
	};

	if (argc < 2)
		usage ("\n");

	while (1) {
		c = getopt_long (argc, argv, "+hVvc:w:", longopts, &option);

		if (c == -1 || c == EOF || c == 1)
			break;

		switch (c) {
		case '?':									/* print short usage statement if args not parsable */
			usage5 ();
		case 'h':									/* help */
			print_help ();
			exit (STATE_UNKNOWN);
		case 'V':									/* version */
			print_revision (progname, NP_VERSION);
			exit (STATE_UNKNOWN);
		case 'c':									/* critical */
			critical_range = optarg;
			break;
		case 'w':									/* warning */
			warning_range = optarg;
			break;
		}
	}

	c = optind;
	if (warning_range == NULL && argc > c)
		warning_range = argv[c++];
	if (critical_range == NULL && argc > c)
		critical_range = argv[c++];

	/* this will abort in case of invalid ranges */
	set_thresholds (&thlds, warning_range, critical_range);

	if (thlds->warning->end < 0)
		usage4 (_("Warning threshold must be a positive integer"));
	if (thlds->critical->end < 0)
		usage4 (_("Critical threshold must be a positive integer"));

	return OK;
}
示例#22
0
void
print_help (void)
{
	char *myport;
	asprintf (&myport, "%d", MYSQL_PORT);

	print_revision (progname, NP_VERSION);

	printf (_(COPYRIGHT), copyright, email);

	printf ("%s\n", _("This program tests connections to a MySQL server"));

  printf ("\n\n");

	print_usage ();

  printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);

  printf (UT_HOST_PORT, 'P', myport);
  printf (" %s\n", "-s, --socket=STRING");
  printf ("    %s\n", _("Use the specified socket (has no effect if -H is used)"));

  printf (" %s\n", "-d, --database=STRING");
  printf ("    %s\n", _("Check database with indicated name"));
  printf (" %s\n", "-f, --file=STRING");
  printf ("    %s\n", _("Read from the specified client options file"));
  printf (" %s\n", "-g, --group=STRING");
  printf ("    %s\n", _("Use a client options group"));
  printf (" %s\n", "-u, --username=STRING");
  printf ("    %s\n", _("Connect using the indicated username"));
  printf (" %s\n", "-p, --password=STRING");
  printf ("    %s\n", _("Use the indicated password to authenticate the connection"));
  printf ("    ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!"));
  printf ("    %s\n", _("Your clear-text password could be visible as a process table entry"));
  printf (" %s\n", "-S, --check-slave");
  printf ("    %s\n", _("Check if the slave thread is running properly."));
  printf (" %s\n", "-w, --warning");
  printf ("    %s\n", _("Exit with WARNING status if slave server is more than INTEGER seconds"));
  printf ("    %s\n", _("behind master"));
  printf (" %s\n", "-c, --critical");
  printf ("    %s\n", _("Exit with CRITICAL status if slave server is more then INTEGER seconds"));
  printf ("    %s\n", _("behind master"));

  printf ("\n");
  printf (" %s\n", _("There are no required arguments. By default, the local database is checked"));
  printf (" %s\n", _("using the default unix socket. You can force TCP on localhost by using an"));
  printf (" %s\n", _("IP address or FQDN ('localhost' will use the socket as well)."));

	printf ("\n");
	printf ("%s\n", _("Notes:"));
	printf (" %s\n", _("You must specify -p with an empty string to force an empty password,"));
	printf (" %s\n", _("overriding any my.cnf settings."));

	printf (UT_SUPPORT);
}
示例#23
0
static int process_arguments (int argc, char **argv) {

	int c;
        int escape = 0;
        char *temp;
	
        int option = 0;
        static struct option longopts[] = {
                {"critical", required_argument, 0, 'c'},
                {"warning", required_argument, 0, 'w'},
                {"timeunit", required_argument, 0, 'u'},
                {"verbose", no_argument, 0, 'v'},
                {"version", no_argument, 0, 'V'},
                {"help", no_argument, 0, 'h'},
                {0, 0, 0, 0}
        };

	while ( 1 ) {

		c = getopt_long ( argc, argv, "+hvVu:c:w:", longopts, &option );

		if ( c == -1 || c == EOF || c == 1 ) break;
	
		switch ( c ) {
			case '?':
				usage5 ();
			case 'h':
				print_help ();
				exit ( STATE_OK );
			case 'v':
				verbose++;
				if (verbose >= 3) {
					printf("Verbose mode enabled\n");
				}
				break;
    			case 'V':
      				print_revision (progname, NP_VERSION);
      				exit (STATE_OK);
			case 'u':
				timeunit = optarg;
				break;
			case 'c':
				critical = optarg;
				break;
			case 'w':
				warning = optarg;
				break;
			} // end case
		} // end while

	c = optind;
	set_thresholds(&my_thresholds, warning, critical);
	return validate_arguments ();

} // end process_arguments
int
main (int argc, char **argv)
{
  int result = STATE_UNKNOWN;

  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  if (argc < 2)
    usage4 (_("Could not parse arguments"));
  else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
    print_revision (progname, NP_VERSION);
    exit (STATE_OK);
  }
  else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
    print_help ();
    exit (STATE_OK);
  }
  else if (!is_integer (argv[1]))
    usage4 (_("Arguments to check_dummy must be an integer"));
  else
    result = atoi (argv[1]);

  switch (result) {
  case STATE_OK:
    printf (_("OK"));
    break;
  case STATE_WARNING:
    printf (_("WARNING"));
    break;
  case STATE_CRITICAL:
    printf (_("CRITICAL"));
    break;
  case STATE_UNKNOWN:
    printf (_("UNKNOWN"));
    break;
  default:
    printf (_("UNKNOWN"));
    printf (": ");
    printf (_("Status %d is not a supported error state\n"), result);
    return STATE_UNKNOWN;
  }

  if (argc >= 3)
    printf (": %s", argv[2]);

  printf("\n");

  return result;
}
示例#25
0
void
print_help (void)
{

  print_revision (progname, NP_VERSION);

  printf ("Copyright (c) 1999 Didi Rieder <*****@*****.**>\n");
  printf (COPYRIGHT, copyright, email);

  printf ("%s\n", _("This plugin will use the fping command to ping the specified host for a fast check"));

  printf ("%s\n", _("Note that it is necessary to set the suid flag on fping."));

  printf ("\n\n");

  print_usage ();

  printf (UT_HELP_VRSN);
  printf (UT_EXTRA_OPTS);

  printf (UT_IPv46);

  printf (" %s\n", "-H, --hostname=HOST");
  printf ("    %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
  printf (" %s\n", "-w, --warning=THRESHOLD");
  printf ("    %s\n", _("warning threshold pair"));
  printf (" %s\n", "-c, --critical=THRESHOLD");
  printf ("    %s\n", _("critical threshold pair"));
  printf (" %s\n", "-b, --bytes=INTEGER");
  printf ("    %s (default: %d)\n", _("size of ICMP packet"),PACKET_SIZE);
  printf (" %s\n", "-n, --number=INTEGER");
  printf ("    %s (default: %d)\n", _("number of ICMP packets to send"),PACKET_COUNT);
  printf (" %s\n", "-T, --target-timeout=INTEGER");
  printf ("    %s (default: fping's default for -t)\n", _("Target timeout (ms)"));
  printf (" %s\n", "-i, --interval=INTEGER");
  printf ("    %s (default: fping's default for -p)\n", _("Interval (ms) between sending packets"));
  printf (" %s\n", "-S, --sourceip=HOST");
  printf ("    %s\n", _("name or IP Address of sourceip"));
  printf (" %s\n", "-I, --sourceif=IF");
  printf ("    %s\n", _("source interface name"));
  printf (UT_VERBOSE);
  printf ("\n");
  printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));
  printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
  printf (" %s\n", _("packet loss to trigger an alarm state."));

  printf ("\n");
  printf (" %s\n", _("IPv4 is used by default. Specify -6 to use IPv6."));

  printf (UT_SUPPORT);
}
示例#26
0
void print_help (void) {
    print_revision();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();
}
示例#27
0
void
print_help (void)
{
  char *myport;

  xasprintf (&myport, "%d", DEFAULT_PORT);

  print_revision (progname, NP_VERSION);

  printf ("Copyright (c) 2000 Karl DeBisschop <*****@*****.**>\n");
  printf (COPYRIGHT, copyright, email);

  printf (_("This plugin test the DNS service on the specified host using dig"));

  printf ("\n\n");

  print_usage ();

  printf (UT_HELP_VRSN);

  printf (UT_EXTRA_OPTS);

  printf (UT_HOST_PORT, 'p', myport);

  printf (" %s\n","-4, --use-ipv4");
  printf ("    %s\n",_("Force dig to only use IPv4 query transport"));
  printf (" %s\n","-6, --use-ipv6");
  printf ("    %s\n",_("Force dig to only use IPv6 query transport"));
  printf (" %s\n","-l, --query_address=STRING");
  printf ("    %s\n",_("Machine name to lookup"));
  printf (" %s\n","-T, --record_type=STRING");
  printf ("    %s\n",_("Record type to lookup (default: A)"));
  printf (" %s\n","-a, --expected_address=STRING");
  printf ("    %s\n",_("An address expected to be in the answer section. If not set, uses whatever"));
  printf ("    %s\n",_("was in -l"));
  printf (" %s\n","-A, --dig-arguments=STRING");
  printf ("    %s\n",_("Pass STRING as argument(s) to dig"));
  printf (" %s\n","-r, --retries=INTEGER");
  printf ("    %s\n",_("Number of retries passed to dig, timeout is divided by this value (Default: 3)"));
  printf (UT_WARN_CRIT);
  printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
  printf (UT_VERBOSE);

  printf ("\n");
  printf ("%s\n", _("Examples:"));
  printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\"");
  printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com");

  printf (UT_SUPPORT);
}
示例#28
0
void
print_help (void)
{
	print_revision (progname, NP_VERSION);

	printf (COPYRIGHT, copyright, email);

	printf ("%s\n", _("Negates the status of a plugin (returns OK for CRITICAL and vice-versa)."));
	printf ("%s\n", _("Additional switches can be used to control which state becomes what."));

	printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);

	printf (UT_TIMEOUT, timeout_interval);
	printf ("    %s\n", _("Keep timeout longer than the plugin timeout to retain CRITICAL status."));
	printf (" -T, --timeout-result=STATUS\n");
	printf ("    %s\n", _("Custom result on Negate timeouts; see below for STATUS definition\n"));

	printf(" -o, --ok=STATUS\n");
	printf(" -w, --warning=STATUS\n");
	printf(" -c, --critical=STATUS\n");
	printf(" -u, --unknown=STATUS\n");
	printf(_("    STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without single\n"));
	printf(_("    quotes. Numeric values are accepted. If nothing is specified, permutes\n"));
	printf(_("    OK and CRITICAL.\n"));
	printf(" -s, --substitute\n");
	printf(_("    Substitute output text as well. Will only substitute text in CAPITALS\n"));

	printf ("\n");
	printf ("%s\n", _("Examples:"));
	printf (" %s\n", "negate /usr/local/nagios/libexec/check_ping -H host");
	printf ("    %s\n", _("Run check_ping and invert result. Must use full path to plugin"));
	printf (" %s\n", "negate -w OK -c UNKNOWN /usr/local/nagios/libexec/check_procs -a 'vi negate.c'");
	printf ("    %s\n", _("This will return OK instead of WARNING and UNKNOWN instead of CRITICAL"));
	printf ("\n");
	printf ("%s\n", _("Notes:"));
	printf (" %s\n", _("This plugin is a wrapper to take the output of another plugin and invert it."));
	printf (" %s\n", _("The full path of the plugin must be provided."));
	printf (" %s\n", _("If the wrapped plugin returns OK, the wrapper will return CRITICAL."));
	printf (" %s\n", _("If the wrapped plugin returns CRITICAL, the wrapper will return OK."));
	printf (" %s\n", _("Otherwise, the output state of the wrapped plugin is unchanged."));
	printf ("\n");
	printf (" %s\n", _("Using timeout-result, it is possible to override the timeout behaviour or a"));
	printf (" %s\n", _("plugin by setting the negate timeout a bit lower."));

	printf (UT_SUPPORT);
}
void
print_help (void)
{
	char *myport;
	xasprintf (&myport, "%d", MYSQL_PORT);

	print_revision (progname, NP_VERSION);

	printf (_(COPYRIGHT), copyright, email);

	printf ("%s\n", _("This program checks a query result against threshold levels"));

  printf ("\n\n");

	print_usage ();

	printf (UT_HELP_VRSN);
	printf (UT_EXTRA_OPTS);
	printf (" -q, --query=STRING\n");
	printf ("    %s\n", _("SQL query to run. Only first column in first row will be read"));
	printf (UT_WARN_CRIT_RANGE);
	printf (UT_HOST_PORT, 'P', myport);
	printf (" %s\n", "-s, --socket=STRING");
	printf ("    %s\n", _("Use the specified socket (has no effect if -H is used)"));
	printf (" -d, --database=STRING\n");
	printf ("    %s\n", _("Database to check"));
	printf (" %s\n", "-f, --file=STRING");
	printf ("    %s\n", _("Read from the specified client options file"));
	printf (" %s\n", "-g, --group=STRING");
	printf ("    %s\n", _("Use a client options group"));
	printf (" -u, --username=STRING\n");
	printf ("    %s\n", _("Username to login with"));
	printf (" -p, --password=STRING\n");
	printf ("    %s\n", _("Password to login with"));
	printf ("    ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!"));
	printf ("    %s\n", _("Your clear-text password could be visible as a process table entry"));

	printf ("\n");
	printf (" %s\n", _("A query is required. The result from the query should be numeric."));
	printf (" %s\n", _("For extra security, create a user with minimal access."));

	printf ("\n");
	printf ("%s\n", _("Notes:"));
	printf (" %s\n", _("You must specify -p with an empty string to force an empty password,"));
	printf (" %s\n", _("overriding any my.cnf settings."));

	printf (UT_SUPPORT);
}
示例#30
0
void print_help (void) {
    print_revision();
    print_copyright();

    printf("\n");

    printf("Check description: %s", progdesc);

    printf("\n\n");

    print_usage();

    print_help_default();
    printf(" -b, --bond=BOND\n");
    printf("      Check bond named BOND.\n");
}