Repository
Munin (master)
Last change
2019-09-30
Graph Categories
Family
snmpauto
Capabilities
Language
Perl
License
GPL-2.0-only
Authors

snmp__users

Name

snmp__users - Munin plugin to check the number of logged in users on an SNMP device.

Applicable Systems

Any SNMP-capable device that reports the HOST-RESOURCES-MIB::hrSystemNumUsers.0 OID.

Configuration

As a rule SNMP plugins need site specific configuration. The default configuration (shown here) will only work on insecure sites/devices.

[snmp_*]
     env.version 2
     env.community public

In general SNMP is not very secure at all unless you use SNMP version 3 which supports authentication and privacy (encryption). But in any case the community string for your devices should not be “public”.

Please see ‘perldoc Munin::Plugin::SNMP’ for further configuration information.

Interpretation

The number of user sessions for which this host is storing state information. A session is a collection of processes requiring a single act of user authentication and possibly subject to collective job control.

Mib Information

This plugin requires support for the HOST-RESOURCES-MIB (RFC 2790). It reports the contents of the hrSystemNumUsers.0 OID.

Magic Markers

#%# family=snmpauto
#%# capabilities=snmpconf

Bugs

None known.

Author

Copyright (C) 2010 Matthew Boyle
Copyright (C) 2004-2005 Dagfinn Ilmari Mannsåker
Copyright (C) 2004 Jimmy Olsen

License

GPLv2.

Pod Errors

Hey! The above document had some coding errors, which are explained below:

  • Around line 53:

    Non-ASCII character seen before =encoding in ‘Mannsåker’. Assuming UTF-8

#!/usr/bin/perl -w

=head1 NAME

snmp__users - Munin plugin to check the number of logged in users on an
SNMP device.

=head1 APPLICABLE SYSTEMS

Any SNMP-capable device that reports the
HOST-RESOURCES-MIB::hrSystemNumUsers.0 OID.

=head1 CONFIGURATION

As a rule SNMP plugins need site specific configuration.  The default
configuration (shown here) will only work on insecure sites/devices.

   [snmp_*]
	env.version 2
        env.community public

In general SNMP is not very secure at all unless you use SNMP version
3 which supports authentication and privacy (encryption).  But in any
case the community string for your devices should not be "public".

Please see 'perldoc Munin::Plugin::SNMP' for further configuration
information.

=head1 INTERPRETATION

The number of user sessions for which this host is storing state
information.  A session is a collection of processes requiring a
single act of user authentication and possibly subject to collective
job control.

=head1 MIB INFORMATION

This plugin requires support for the HOST-RESOURCES-MIB (RFC 2790).  It
reports the contents of the hrSystemNumUsers.0 OID.

=head1 MAGIC MARKERS

  #%# family=snmpauto
  #%# capabilities=snmpconf

=head1 BUGS

None known.

=head1 AUTHOR

  Copyright (C) 2010 Matthew Boyle
  Copyright (C) 2004-2005 Dagfinn Ilmari Mannsåker
  Copyright (C) 2004 Jimmy Olsen

=head1 LICENSE

GPLv2.

=cut

use strict;
use Munin::Plugin::SNMP;

if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
	# .iso.org.dod.internet.mgmt.mib-2.host.hrSystem.hrSystemNumUsers.0
	print "require 1.3.6.1.2.1.25.1.5.0 [0-9]\n"; # Number
	exit 0;
}

if (defined $ARGV[0] and $ARGV[0] eq "config") {
	my ($host) = Munin::Plugin::SNMP->config_session();

	print "host_name $host\n" unless $host eq 'localhost';
	print <<"EOC";
graph_title Logged in users
graph_args --base 1000 -l 0
graph_vlabel number of users
graph_scale no
graph_category system
graph_info This graph shows the number of users currently logged in to the system.
users.label users
users.draw LINE2
users.info Number of users
EOC
	exit 0;
}

my $session = Munin::Plugin::SNMP->session();
print "users.value ", $session->get_single('1.3.6.1.2.1.25.1.5.0'), "\n";