Révision ae04f889
Initial version
| plugins/other/snmp___bri_se_ | ||
|---|---|---|
| 1 |
#!/bin/bash |
|
| 2 |
# |
|
| 3 |
# Munin plugin snmp__bri_se_ |
|
| 4 |
# |
|
| 5 |
# Version: 0.2, released on 30/02/2009, tested on Debian GNU/Linux 4.0 (etch) |
|
| 6 |
# using Cisco 5350 gateways. |
|
| 7 |
# |
|
| 8 |
# This plugin reports the number of BRI channels currently in use on SE/foo |
|
| 9 |
# using SNMP community bar. |
|
| 10 |
# |
|
| 11 |
# Requirements: bash, snmpget, rev, cut, which |
|
| 12 |
# |
|
| 13 |
# Copyright (c) 2009 by Kees Meijs <kees@kumina.nl> for Kumina bv. |
|
| 14 |
# |
|
| 15 |
# This work is licensed under the Creative Commons Attribution-Share Alike 3.0 |
|
| 16 |
# Unported license. In short: you are free to share and to make derivatives of |
|
| 17 |
# this work under the conditions that you appropriately attribute it, and that |
|
| 18 |
# you only distribute it under the same, similar or a compatible license. Any |
|
| 19 |
# of the above conditions can be waived if you get permission from the copyright |
|
| 20 |
# holder. |
|
| 21 |
|
|
| 22 |
# HOW TO? |
|
| 23 |
# |
|
| 24 |
# Symlink snmp___bri_se_ to /etc/munin/plugins/snmp_HOSTNAME_COMMUNITY_bri_se_SEOFGATEWAY |
|
| 25 |
# For example: snmp_1.2.3.4_public_bri_se_3 to check community "public" on host "1.2.3.4" |
|
| 26 |
# using SE #3. |
|
| 27 |
|
|
| 28 |
# More strict checking |
|
| 29 |
set -e |
|
| 30 |
|
|
| 31 |
# Check for snmpget |
|
| 32 |
SNMPGET=$(which snmpget) |
|
| 33 |
|
|
| 34 |
# Catch command line arguments |
|
| 35 |
JOB=$1 |
|
| 36 |
|
|
| 37 |
# Set variables |
|
| 38 |
HOSTNAME=$(echo $0 | rev | cut -d '_' -f 5 | rev) |
|
| 39 |
COMMUNITY=$(echo $0 | rev | cut -d '_' -f 4 | rev) |
|
| 40 |
SE=$(echo $0 | rev | cut -d '_' -f 1 | rev) |
|
| 41 |
|
|
| 42 |
# Configure Munin |
|
| 43 |
case "$1" in |
|
| 44 |
"config") |
|
| 45 |
echo "host_name $HOSTNAME" |
|
| 46 |
echo "graph_title BRI usage on SE-$SE" |
|
| 47 |
echo "graph_vlabel Number of used BRI channels" |
|
| 48 |
echo "graph_scale no" |
|
| 49 |
echo "graph_category network" |
|
| 50 |
for CHANNEL in $(seq 0 7); do |
|
| 51 |
echo "chan_$CHANNEL.label SE-$SE/$CHANNEL used channels" |
|
| 52 |
done |
|
| 53 |
exit 0;; |
|
| 54 |
esac |
|
| 55 |
|
|
| 56 |
# Return fetched SNMP values |
|
| 57 |
for CHANNEL in $(seq 0 7); do |
|
| 58 |
echo -n "chan_$CHANNEL.value " |
|
| 59 |
$SNMPGET -v 1 -c $COMMUNITY $HOSTNAME 1.3.6.1.4.1.9.10.19.1.1.9.1.3.$SE.$CHANNEL | rev | cut -d ' ' -f 1 | rev |
|
| 60 |
done |
|
| 61 |
|
|
| 62 |
# Exit cleanly |
|
| 63 |
exit 0 |
|
Formats disponibles : Unified diff