Nagios check command parameter

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pradeepanan
Posts: 41
Joined: Wed Sep 30, 2015 1:58 pm

Nagios check command parameter

Post by pradeepanan »

Hi All,

I am new to nagios so please dont mind if my question sounds trivial.
Whenever I add devices to montior, in check command parameter option i have some default commands to add which I have followed so far. However I am trying to explore few thing where I find difficult to understand the function of options used in those commands.
For example
$USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -C opennms-Priv -P 2c -l "GPS Sync Check:" --ereg="SYNC OK"

In above command , i am not sure the use of -o , -l , --ereg, etc

I have no luck after researching through google. Is ay way I could learn the function of those options? Is there any documentation for that?

Any idea would be much helpful.

Thanks
Pradeep
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios check command parameter

Post by rkennedy »

You should be able to run this from the CLI to pull up a 'help' menu. /usr/local/nagios/libexec/check_snmp -h. For reference, most plugins will have an accessible help menu.
[root@suse11 libexec]# ./check_snmp -h
check_snmp v2.0.3 (nagios-plugins 2.0.3)
Copyright (c) 1999-2014 Nagios Plugin Development Team
<[email protected]>

Check status of remote machines and obtain system information via SNMP


Usage:
check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
[-A authpasswd] [-x privproto] [-X privpasswd]

Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[section][@file]
Read options from an ini file. See
https://www.nagios-plugins.org/doc/extra-opts.html
for usage and examples.
-H, --hostname=ADDRESS
Host name, IP Address, or unix socket (must be an absolute path)
-p, --port=INTEGER
Port number (default: 161)
-n, --next
Use SNMP GETNEXT instead of SNMP GET
-P, --protocol=[1|2c|3]
SNMP protocol version
-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]
SNMPv3 securityLevel
-a, --authproto=[MD5|SHA]
SNMPv3 auth proto
-x, --privproto=[DES|AES]
SNMPv3 priv proto (default DES)
-C, --community=STRING
Optional community string for SNMP communication (default is "public")
-U, --secname=USERNAME
SNMPv3 username
-A, --authpassword=PASSWORD
SNMPv3 authentication password
-X, --privpasswd=PASSWORD
SNMPv3 privacy password
-o, --oid=OID(s)
Object identifier(s) or SNMP variables whose value you wish to query
-m, --miblist=STRING
List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'
for symbolic OIDs.)
-d, --delimiter=STRING
Delimiter to use when parsing returned data. Default is "="
Any data on the right hand side of the delimiter is considered
to be the data that should be used in the evaluation.
-w, --warning=THRESHOLD(s)
Warning threshold range(s)
-c, --critical=THRESHOLD(s)
Critical threshold range(s)
--rate
Enable rate calculation. See 'Rate Calculation' below
--rate-multiplier
Converts rate per second. For example, set to 60 to convert to per minute
--offset=OFFSET
Add/substract the specified OFFSET to numeric sensor data
-s, --string=STRING
Return OK state (for that OID) if STRING is an exact match
-r, --ereg=REGEX
Return OK state (for that OID) if extended regular expression REGEX matches
-R, --eregi=REGEX
Return OK state (for that OID) if case-insensitive extended REGEX matches
--invert-search
Invert search result (CRITICAL if found)
-l, --label=STRING
Prefix label for output from plugin
-u, --units=STRING
Units label(s) for output data (e.g., 'sec.').
-D, --output-delimiter=STRING
Separates output on multiple OID requests
-t, --timeout=INTEGER
Seconds before connection times out (default: 10)
-e, --retries=INTEGER
Number of retries to be used in the requests
-O, --perf-oids
Label performance data with OIDs instead of --label's
-v, --verbose
Show details for command-line debugging (Nagios may truncate output)

This plugin uses the 'snmpget' command included with the NET-SNMP package.
if you don't have the package installed, you will need to download it from
http://net-snmp.sourceforge.net before you can use this plugin.

Notes:
- Multiple OIDs (and labels) may be indicated by a comma or space-delimited
list (lists with internal spaces must be quoted).
- See:
https://www.nagios-plugins.org/doc/guid ... HOLDFORMAT
for THRESHOLD format and examples.
- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'
- Note that only one string and one regex may be checked at present
- All evaluation methods other than PR, STR, and SUBSTR expect that the value
returned from the SNMP query is an unsigned integer.

Rate Calculation:
In many places, SNMP returns counters that are only meaningful when
calculating the counter difference since the last check. check_snmp
saves the last state information in a file so that the rate per second
can be calculated. Use the --rate option to save state information.
On the first run, there will be no prior state - this will return with OK.
The state is uniquely determined by the arguments to the plugin, so
changing the arguments will create a new state file.

Send email to [email protected] if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
[email protected]
Is that what you were looking for?
Former Nagios Employee
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Nagios check command parameter

Post by bwallace »

On your Nagios server navigate to /usr/local/nagios/libexec and run --help as well as --usage
./check_snmp --help
./check_snmp --usage

Or, the online man page
http://nagios-plugins.org/doc/man/index.html

What exactly are you trying to monitor?
Be sure to check out the Knowledgebase for helpful articles and solutions!
pradeepanan
Posts: 41
Joined: Wed Sep 30, 2015 1:58 pm

Re: Nagios check command parameter

Post by pradeepanan »

Perfect! This is what i was looking exactly. Thanks for providing me great sourcehttps://support.nagios.com/forum/images/icons/emblem-OK.png
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Nagios check command parameter

Post by bwallace »

Glad to help! Were there any other questions or may we lock this thread?
Be sure to check out the Knowledgebase for helpful articles and solutions!
pradeepanan
Posts: 41
Joined: Wed Sep 30, 2015 1:58 pm

Re: Nagios check command parameter

Post by pradeepanan »

Apology for delayed response. This thread can be locked
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Nagios check command parameter

Post by bwallace »

No worries, closing thread now....
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked