summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 70b519b)
raw | patch | inline | side by side (parent: 70b519b)
author | Benoit Mortier <opensides@users.sourceforge.net> | |
Sun, 22 Oct 2006 22:03:31 +0000 (22:03 +0000) | ||
committer | Benoit Mortier <opensides@users.sourceforge.net> | |
Sun, 22 Oct 2006 22:03:31 +0000 (22:03 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1514 f882894a-f735-0410-b71e-b25c423dba1c
plugins-root/check_icmp.c | patch | blob | history | |
plugins/check_apt.c | patch | blob | history | |
plugins/check_procs.c | patch | blob | history |
index 2f03552f948538faf0c4ee067520251e8b6c0778..728d4a000649639098dae59b9531d18777026f94 100644 (file)
#include <arpa/inet.h>
#include <signal.h>
+#include "common.h"
+#include "runcmd.h"
+#include "utils.h"
+#include "regex.h"
+
/** sometimes undefined system macros (quite a few, actually) **/
#ifndef MAXTTL
# define MAXTTL 255
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 2de8e77637fc0994807793212e4f6c5193040a4a..902b455f7b3213d8289dfa628a7fc028d4ae2edb 100644 (file)
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.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$
-
+*
+* $Id$
+*
******************************************************************************/
const char *progname = "check_apt";
result = max_state(result, STATE_OK);
}
- printf("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n",
+ printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
state_text(result),
packages_available,
(upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade",
regres=regcomp(&ireg, include_ptr, REG_EXTENDED);
if(regres!=0) {
regerror(regres, &ireg, rerrbuf, 64);
- die(STATE_UNKNOWN, "%s: Error compiling regexp: %s", progname, rerrbuf);
+ die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"), progname, rerrbuf);
}
if(do_exclude!=NULL){
regres=regcomp(&ereg, do_exclude, REG_EXTENDED);
if(regres!=0) {
regerror(regres, &ereg, rerrbuf, 64);
- die(STATE_UNKNOWN, "%s: Error compiling regexp: %s",
+ die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"),
progname, rerrbuf);
}
}
regres=regcomp(&sreg, crit_ptr, REG_EXTENDED);
if(regres!=0) {
regerror(regres, &ereg, rerrbuf, 64);
- die(STATE_UNKNOWN, "%s: Error compiling regexp: %s",
+ die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"),
progname, rerrbuf);
}
if(result != 0){
exec_warning=1;
result = STATE_UNKNOWN;
- fprintf(stderr, "'%s' exited with non-zero status.\n",
+ fprintf(stderr, _("'%s' exited with non-zero status.\n"),
cmdline);
}
if(result != 0){
exec_warning=1;
result = STATE_CRITICAL;
- fprintf(stderr, "'%s' exited with non-zero status.\n",
+ fprintf(stderr, _("'%s' exited with non-zero status.\n"),
cmdline);
}
printf(_(UT_TIMEOUT), timeout_interval);
- printf(_("\n\
- -U, --upgrade=OPTS\n\
- [Default] Perform an upgrade. If an optional OPTS argument is provided,\n\
- apt-get will be run with these command line options instead of the\n\
- default (%s).\n\
- Note that you may be required to have root privileges if you do not use\n\
- the default options.\n\
- -d, --dist-upgrade=OPTS\n\
- Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS\n\
- can be provided to override the default options.\n\
- -n, --no-upgrade\n\
- Do not run the upgrade. Probably not useful (without -u at least).\n\
- -i, --include=REGEXP\n\
- Include only packages matching REGEXP. Can be specified multiple times;\n\
- the values will be combined together. Any patches matching this list\n\
- cause the plugin to return WARNING status. Others will be ignored.\n\
- Default is to include all packages.\n\
- -e, --exclude=REGEXP\n\
- Exclude packages matching REGEXP from the list of packages that would\n\
- otherwise be included. Can be specified multiple times; the values\n\
- will be combined together. Default is to exclude no packages.\n\
- -c, --critical=REGEXP\n\
- If the full package information of any of the upgradable packages match\n\
- this REGEXP, the plugin will return CRITICAL status. Can be specified\n\
- multiple times like above. Default is a regexp matching security\n\
- upgrades for Debian and Ubuntu:\n\
- \t%s\n\
- Note that the package must first match the include list before its\n\
- information is compared against the critical list.\n\
- \n\n"),
- UPGRADE_DEFAULT_OPTS, SECURITY_RE);
-
+ printf (" %s\n", "-U, --upgrade=OPTS");
+ printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,"));
+ printf (" %s\n", _("apt-get will be run with these command line options instead of the"));
+ printf (" %s", _("default "));
+ printf ("(%s).\n", UPGRADE_DEFAULT_OPTS);
+ printf (" %s\n", _("Note that you may be required to have root privileges if you do not use"));
+ printf (" %s\n", _("the default options."));
+ printf (" %s\n", "-d, --dist-upgrade=OPTS");
+ printf (" %s\n", _("Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS"));
+ printf (" %s\n", _("can be provided to override the default options."));
+ printf (" %s\n", " -n, --no-upgrade");
+ printf (" %s\n", _("Do not run the upgrade. Probably not useful (without -u at least)."));
+ printf (" %s\n", "-i, --include=REGEXP");
+ printf (" %s\n", _("Include only packages matching REGEXP. Can be specified multiple times"));
+ printf (" %s\n", _("the values will be combined together. Any patches matching this list"));
+ printf (" %s\n", _("cause the plugin to return WARNING status. Others will be ignored."));
+ printf (" %s\n", _("Default is to include all packages."));
+ printf (" %s\n", "-e, --exclude=REGEXP");
+ printf (" %s\n", _("Exclude packages matching REGEXP from the list of packages that would"));
+ printf (" %s\n", _("otherwise be included. Can be specified multiple times; the values"));
+ printf (" %s\n", _("will be combined together. Default is to exclude no packages."));
+ printf (" %s\n", "-c, --critical=REGEXP");
+ printf (" %s\n", _("If the full package information of any of the upgradable packages match"));
+ printf (" %s\n", _("this REGEXP, the plugin will return CRITICAL status. Can be specified"));
+ printf (" %s\n", _("multiple times like above. Default is a regexp matching security"));
+ printf (" %s\n", _("upgrades for Debian and Ubuntu:"));
+ printf (" \t\%s\n", SECURITY_RE);
+ printf (" %s\n", _("Note that the package must first match the include list before its"));
+ printf (" %s\n\n\n", _("information is compared against the critical list."));
+
printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
printf (" %s\n", "-u, --update=OPTS");
printf (" %s\n", _("First perform an 'apt-get update'. An optional OPTS parameter overrides"));
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index 31a2bed922d130527ec6abaec8bd90e04b918f85..2c8c37913063cc8e5f9e7b8115fce6d0a9cf01f2 100644 (file)
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
print_usage ();
- printf(_("\n\
-Required Arguments:\n\
- -w, --warning=RANGE\n\
- Generate warning state if metric is outside this range\n\
- -c, --critical=RANGE\n\
- Generate critical state if metric is outside this range\n"));
-
- printf(_("\n\
-Optional Arguments:\n\
- -m, --metric=TYPE\n\
- Check thresholds against metric. Valid types:\n\
- PROCS - number of processes (default)\n\
- VSZ - virtual memory size\n\
- RSS - resident set memory size\n\
- CPU - percentage cpu\n"));
+ printf ("%s\n", _("Required Arguments:"));
+ printf (" %s\n", "-w, --warning=RANGE");
+ printf (" %s\n", _("Generate warning state if metric is outside this range"));
+ printf (" %s\n", "-c, --critical=RANGE");
+ printf (" %s\n", _("Generate critical state if metric is outside this range"));
+
+ printf ("%s\n", _("Optional Arguments:"));
+ printf (" %s\n", "-m, --metric=TYPE");
+ printf (" %s\n", _("Check thresholds against metric. Valid types:"));
+ printf (" %s\n", _("PROCS - number of processes (default)"));
+ printf (" %s\n", _("VSZ - virtual memory size"));
+ printf (" %s\n", _("RSS - resident set memory size"));
+ printf (" %s\n", _("CPU - percentage cpu"));
/* only linux etime is support currently */
#if defined( __linux__ )
- printf(_("\
- ELAPSED - time elapsed in seconds\n"));
+ printf (" %s\n", _("ELAPSED - time elapsed in seconds"));
#endif /* defined(__linux__) */
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
- printf(_("\
- -v, --verbose\n\
- Extra information. Up to 3 verbosity levels\n"));
-
- printf(_("\n\
-Optional Filters:\n\
- -s, --state=STATUSFLAGS\n\
- Only scan for processes that have, in the output of `ps`, one or\n\
- more of the status flags you specify (for example R, Z, S, RS,\n\
- RSZDT, plus others based on the output of your 'ps' command).\n\
- -p, --ppid=PPID\n\
- Only scan for children of the parent process ID indicated.\n\
- -z, --vsz=VSZ\n\
- Only scan for processes with vsz higher than indicated.\n\
- -r, --rss=RSS\n\
- Only scan for processes with rss higher than indicated.\n"));
-
- printf(_("\
- -P, --pcpu=PCPU\n\
- Only scan for processes with pcpu higher than indicated.\n\
- -u, --user=USER\n\
- Only scan for processes with user name or ID indicated.\n\
- -a, --argument-array=STRING\n\
- Only scan for processes with args that contain STRING.\n\
- -C, --command=COMMAND\n\
- Only scan for exact matches of COMMAND (without path).\n"));
+ printf (" %s\n", "-v, --verbose");
+ printf (" %s\n", _("Extra information. Up to 3 verbosity levels"));
+
+ printf ("%s\n", "Optional Filters:");
+ printf (" %s\n", "-s, --state=STATUSFLAGS");
+ printf (" %s\n", _("Only scan for processes that have, in the output of `ps`, one or"));
+ printf (" %s\n", _("more of the status flags you specify (for example R, Z, S, RS,"));
+ printf (" %s\n", _("RSZDT, plus others based on the output of your 'ps' command)."));
+ printf (" %s\n", "-p, --ppid=PPID");
+ printf (" %s\n", _("Only scan for children of the parent process ID indicated."));
+ printf (" %s\n", "-z, --vsz=VSZ");
+ printf (" %s\n", _("Only scan for processes with vsz higher than indicated."));
+ printf (" %s\n", "-r, --rss=RSS");
+ printf (" %s\n", _("Only scan for processes with rss higher than indicated."));
+ printf (" %s\n", "-P, --pcpu=PCPU");
+ printf (" %s\n", _("Only scan for processes with pcpu higher than indicated."));
+ printf (" %s\n", "-u, --user=USER");
+ printf (" %s\n", _("Only scan for processes with user name or ID indicated."));
+ printf (" %s\n", "-a, --argument-array=STRING");
+ printf (" %s\n", _("Only scan for processes with args that contain STRING."));
+ printf (" %s\n", "-C, --command=COMMAND");
+ printf (" %s\n", _("Only scan for exact matches of COMMAND (without path)."));
printf(_("\n\
RANGEs are specified 'min:max' or 'min:' or ':max' (or 'max'). If\n\
process owner, parent process PID, current state (e.g., 'Z'), or may\n\
be the total number of running processes\n\n"));
- printf(_("\
-Examples:\n\
- check_procs -w 2:2 -c 2:1024 -C portsentry\n\
- Warning if not two processes with command name portsentry. Critical\n\
- if < 2 or > 1024 processes\n\n\
- check_procs -w 10 -a '/usr/local/bin/perl' -u root\n\
- Warning alert if > 10 processes with command arguments containing \n\
- '/usr/local/bin/perl' and owned by root\n\n\
- check_procs -w 50000 -c 100000 --metric=VSZ\n\
- Alert if vsz of any processes over 50K or 100K\n\
- check_procs -w 10 -c 20 --metric=CPU\n\
- Alert if cpu of any processes over 10%% or 20%%\n\n"));
+ printf ("%s\n", _("Examples:"));
+ printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry");
+ printf (" %s\n", _("Warning if not two processes with command name portsentry."));
+ printf (" %s\n\n", _("Critical if < 2 or > 1024 processes"));
+ printf (" %s\n", "check_procs -w 10 -a '/usr/local/bin/perl' -u root");
+ printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing"));
+ printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root"));
+ printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ");
+ printf (" %s\n\n", _("Alert if vsz of any processes over 50K or 100K"));
+ printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU");
+ printf (" %s\n\n", _("Alert if cpu of any processes over 10%% or 20%%"));
printf (_(UT_SUPPORT));
}