Révision c80ab783
Initial version
| plugins/other/snmp__wmsstreamingrtspplayers | ||
|---|---|---|
| 1 |
#!/usr/bin/perl -w |
|
| 2 |
# |
|
| 3 |
# Copyright (C) 2006 Andy Linton, CityLink, New Zealand |
|
| 4 |
# |
|
| 5 |
# This program is free software; you can redistribute it and/or |
|
| 6 |
# modify it under the terms of the GNU General Public License |
|
| 7 |
# as published by the Free Software Foundation; version 2 dated June, |
|
| 8 |
# 1991. |
|
| 9 |
# |
|
| 10 |
# This program is distributed in the hope that it will be useful, |
|
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 13 |
# GNU General Public License for more details. |
|
| 14 |
# |
|
| 15 |
# You should have received a copy of the GNU General Public License |
|
| 16 |
# along with this program; if not, write to the Free Software |
|
| 17 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 18 |
# |
|
| 19 |
# Derived from SNMP plugin code written by |
|
| 20 |
# Jimmy Olsen, Dagfinn Ilmari Mannsaaker |
|
| 21 |
# |
|
| 22 |
####################################################################### |
|
| 23 |
# |
|
| 24 |
# You must enable SNMP for Windows Media Services by running: |
|
| 25 |
# |
|
| 26 |
# regsvr32 "%systemroot%\system32\windows media\server\wmssnmp.dll |
|
| 27 |
# |
|
| 28 |
####################################################################### |
|
| 29 |
# |
|
| 30 |
# $Log: snmp__wmsStreamingRtspPlayers,v $ |
|
| 31 |
# Revision 1.2 2007/08/09 22:19:32 root |
|
| 32 |
# Modified using 'rcsedit' |
|
| 33 |
# |
|
| 34 |
# Revision 1.1 2007/08/09 22:18:54 root |
|
| 35 |
# Checked in using 'rcsedit' |
|
| 36 |
# |
|
| 37 |
#%# family=snmpauto |
|
| 38 |
#%# capabilities=snmpconf |
|
| 39 |
|
|
| 40 |
use strict; |
|
| 41 |
use Net::SNMP; |
|
| 42 |
|
|
| 43 |
my $DEBUG = 0; |
|
| 44 |
my $MAXLABEL = 20; |
|
| 45 |
|
|
| 46 |
my $host = $ENV{host} || undef;
|
|
| 47 |
my $port = $ENV{port} || 161;
|
|
| 48 |
my $community = $ENV{community} || "public";
|
|
| 49 |
my $iface = $ENV{interface} || undef;
|
|
| 50 |
|
|
| 51 |
my $response; |
|
| 52 |
|
|
| 53 |
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") |
|
| 54 |
{
|
|
| 55 |
print "require 1.3.6.1.4.1.311.1.7.13.9.0 [0-9]\n"; # Number |
|
| 56 |
exit 0; |
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_wmsStreamingRtspPlayers$/) |
|
| 60 |
{
|
|
| 61 |
$host = $1; |
|
| 62 |
if ($host =~ /^([^:]+):(\d+)$/) |
|
| 63 |
{
|
|
| 64 |
$host = $1; |
|
| 65 |
$port = $2; |
|
| 66 |
} |
|
| 67 |
} |
|
| 68 |
elsif (!defined($host)) |
|
| 69 |
{
|
|
| 70 |
print "# Debug: $0 -- $1\n" if $DEBUG; |
|
| 71 |
die "# Error: couldn't understand what I'm supposed to monitor."; |
|
| 72 |
} |
|
| 73 |
|
|
| 74 |
my ($session, $error) = Net::SNMP->session( |
|
| 75 |
-hostname => $host, |
|
| 76 |
-community => $community, |
|
| 77 |
-port => $port |
|
| 78 |
); |
|
| 79 |
|
|
| 80 |
if (!defined ($session)) |
|
| 81 |
{
|
|
| 82 |
die "Croaking: $error"; |
|
| 83 |
} |
|
| 84 |
|
|
| 85 |
if (defined $ARGV[0] and $ARGV[0] eq "config") |
|
| 86 |
{
|
|
| 87 |
print "host_name $host\n"; |
|
| 88 |
print "graph_title wmsStreamingRtspPlayers |
|
| 89 |
graph_args --base 1000 -l 0 |
|
| 90 |
graph_vlabel wmsStreamingRtspPlayers |
|
| 91 |
graph_category streaming |
|
| 92 |
graph_info This graph shows wmsStreamingRtspPlayers. |
|
| 93 |
wmsStreamingRtspPlayers.label wmsStreamingRtspPlayers |
|
| 94 |
wmsStreamingRtspPlayers.draw LINE2 |
|
| 95 |
wmsStreamingRtspPlayers.info The wmsStreamingRtspPlayers |
|
| 96 |
"; |
|
| 97 |
|
|
| 98 |
exit 0; |
|
| 99 |
} |
|
| 100 |
|
|
| 101 |
print "wmsStreamingRtspPlayers.value ", &get_single ($session, "1.3.6.1.4.1.311.1.7.13.9.0"), "\n"; |
|
| 102 |
|
|
| 103 |
sub get_single |
|
| 104 |
{
|
|
| 105 |
my $handle = shift; |
|
| 106 |
my $oid = shift; |
|
| 107 |
|
|
| 108 |
print "# Getting single $oid...\n" if $DEBUG; |
|
| 109 |
|
|
| 110 |
$response = $handle->get_request ($oid); |
|
| 111 |
|
|
| 112 |
if (!defined $response->{$oid})
|
|
| 113 |
{
|
|
| 114 |
return undef; |
|
| 115 |
} |
|
| 116 |
else |
|
| 117 |
{
|
|
| 118 |
return $response->{$oid};
|
|
| 119 |
} |
|
| 120 |
} |
|
| 121 |
|
|
Formats disponibles : Unified diff