#!@@PERL@@ # -*- perl -*- # vim: ft=perl =head1 NAME snmp__rdp_users - Munin plugin to monitor the number of remote users connected to a Microsoft Windows Remote Desktop server. =head1 APPLICABLE SYSTEMS Microsoft Windows servers running Remote Desktop Services (or Terminal Services, as it used to be known). It requires an SNMP server to be enabled on the machine to be monitored. =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 users currently logged into the Remote Desktop server. =head1 MIB INFORMATION This plugin requires support for the HOST-RESOURCES-MIB (RFC 2790). It reports the hrSWRunName column of hrSWRunTable. =head1 MAGIC MARKERS #%# family=snmpauto #%# capabilities=snmpconf =head1 BUGS Unlikely to work on non-Windows RDP servers, since it relies on the name of the server process being 'rdpclip.exe'. But is there even such a thing as a non-Windows RDP server? =head1 AUTHOR Copyright (C) 2004 Rune Nordbøe Skillingstad Documented and updated to use Munin::Plugin::SNMP by Matthew Boyle. =head1 LICENSE GPLv2. =cut use strict; use Munin::Plugin::SNMP; my $oid = "1.3.6.1.2.1.25.4.2.1.2"; if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') { print "require ${oid}. rdpclip\\.exe\n"; 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 Number of RDP users graph_args --base 1000 -l 0 graph_vlabel number of RDP users graph_scale no graph_category system graph_info This graph shows the number of remote users on the Windows system. users.label users users.draw LINE2 users.info Number of users logged in. EOC exit 0; } my($session, $error) = Munin::Plugin::SNMP->session(); die "Failed to create session: $error" unless $session; my $process_names = $session->get_entries(-columns => [ $oid ]); my $user_count = $process_names ? grep /^rdpclip\.exe$/i, values %$process_names : 'U'; print "users.value ", $user_count, "\n";