check_junos - Monitor Juniper™ Switches

Usage / Command line options

% ./check_junos.pl -h
check_junos 0.1 [http://oss.teamix.org/projects/monitoringplugins]

This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the 3-Clause
BSD License (see http://opensource.org/licenses/BSD-3-Clause).

Monitor Juniper™ Switches.

Usage: check_junos [-v|--verbose] [-H <host>] [-p <port>] [-t <timeout]
[-U <user>] [-P <password] check-tuple [...]

 -?, --usage
   Print usage information
 -h, --help
   Print detailed help screen
 -V, --version
   Print version information
 --extra-opts=[section][@file]
   Read options from an ini file. See http://nagiosplugins.org/extra-opts
   for usage and examples.
 -H, --host=HOSTNAME
   Hostname/IP of Juniper box to connect to (default: localhost)
 -p, --port=PORT
   Port to connect to (default: 22)
 -U, --user=USERNAME
   Username to log into box as (default: root)
 -P, --password=PASSWORD
   Password for login username (default: <prompt>)
 -t, --timeout=INTEGER
   Seconds before plugin times out (default: 15)
 -v, --verbose
   Show details for command-line debugging (can repeat up to 3 times)

This plugin connects to a Juniper™ Switch device and checks various of its
components.

A check-tuple consists of the name of the check and, optionally, a "target" 
which more closely specifies which characteristics should be checked, and
warning and critical thresholds:
checkname[,target[,warning[,critical]]]

The following checks are available:
  * interfaces: Status of interfaces. If a target is specified, only the
    specified interface(s) will be taken into account. The special target
    '@with_description' selects all interfaces with a non-empty description.

    If an aggregated interface is encountered, the physical interfaces will
    be checked as well.

  * interface_forwarding: Check the forwarding state of interfaces as provided
    by 'show ethernet-switching interfaces'. Storm control, MAC limit and
    BPDUs will be considered CRITICAL states. If a target is specified, only
    the specified interface(s) will be taken into account. Targets may be
    specified as <interface_name>:<forwarding_state> in which case a CRITICAL
    state is assumed if the specified interface is not in the specified state.

  * chassis_environment: Check the status of verious system components
    (as provided by 'show chassis environment'). If a target is specified,
    only the specified component(s) will be taken into account. If specified,
    the thresholds will be checked against the temperature of the components.

  * system_storage: Check the amount of used space of system filesystems. If a
    target is specified, only the specified filesystem(s) will be taken into
    account (specified either by filesystem name or mount point). The
    threshold will be checked against the amount (percent) of used space.

Warning and critical thresholds may be specified in the format documented at
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT.

Quickstart

Check the status of all interfaces with a description (it's a good idea anyway to document all relevant interfaces):

% ./check_junos.pl -H switch -U nagios interfaces,@with_description
Password:
check_junos OK - all interfaces up (including all LAG member interfaces) | 'ge-1/0/0-input-bytes'=2547411598B;;;0; 'ge-1/0/0-output-bytes'=2835429939B;;;0; …

Check the forwarding state of all interfaces:

% ./check_junos.pl -H switch -U nagios interface_forwarding
Password:
check_junos OK - forwarding state of all interfaces OK

Check the global chassis environment status (similar to check_snmp_environment):

% ./check_junos.pl -H switch -U nagios chassis_environment
Password:
check_junos OK - 39 components OK | 'FPC_1_CPU-temp'=43;; 'FPC_1_EX-PFE1-temp'=52;; …

Check the amount of used space on /var (log files, etc.):

% ./check_junos.pl -H switch -U nagios system_storage,/var,80,90
Password:
check_junos OK - all filesystems within thresholds | 'fpc1-/var'=5%;80;90;0;100 'fpc2-/var'=4%;80;90;0;100 'fpc3-/var'=1%;80;90;0;100

Specifying passwords

The password for the login username may either be specified using the "-P" switch on the command line or using an INI file and the "--extra-opts" option.

% cat /etc/nagios3/plugin.ini
[junos]
password=geheim
% ./check_junos_vc.pl <…> --extra-opts=junos@/etc/nagios3/plugin.ini <check-tuples>

For more details about the "--extra-opts" option, see http://nagiosplugins.org/extra-opts.

If no password has been specified, the plugin will prompt for it.

Command line format

% ./check_junos_vc.pl -H switch [options] check-tuple […]

Format of a "check-tuple"

checkname[,target[,warning[,critical]]]
  • Multiple checktuples may be specified as space separated list, e.g. "interfaces,@with_description interface_forwarding"
  • Options are separated by commas (",") from the check name and other options, e.g. "system_storage,/var,80,90"
    • Trailing "," may be omitted, e.g. "chassis_environment" is the same as "chassis_environment,,,"
    • The 2nd option specifies the target. A target more strictly specifies information relevant for each check.
    • Leaving out the target or leaving it empty means that no restrictions apply to which information is relevant for the check (e.g. check the status of all interfaces when not specifying a target in the "interfaces" check).
    • The 3rd (warning) and 4th (critical) options specify thresholds, see http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT for details.
    • If no target but thresholds should be used, just leave the target option empty, e.g. "system_storage,,80,90"

Implemented checks

See help output above.