-
Notifications
You must be signed in to change notification settings - Fork 0
/
z3_collector_1shot
executable file
·39 lines (27 loc) · 1.7 KB
/
z3_collector_1shot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
##
## Script used with a teracom.cc Ethernet controller TCW121/TCW122
##
## I am not affiliated with teracom.cc, these are scripts I needed
## for myself that I am releasing in the public domain.
##
## ----------------------------------------------------------------
##
## Single shot read (from device via snmp) and store in the RRD db
##
cd `dirname $0`
source ./zz_config
D1=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.1.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
D2=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.2.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
V1=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.7.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
V2=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.8.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
T1=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.9.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
if [ "$T1" == "200.000000" ] ; then let "T1=0"; else let "T1 = T1 / 10"; fi
T2=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.10.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
if [ "$T2" == "200.000000" ] ; then let "T2=0"; else let "T2 = T2 / 10"; fi
H1=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.11.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
if [ "$H1" == "200.000000" ] ; then let "H1=0"; else let "H1 = H1 / 10"; fi
H2=`snmpget -v 1 -c public $MONDEV .1.3.6.1.4.1.38783.3.12.0 | cut -d\ -f4 | awk '{ printf("%f\n",$1/10) }'`
if [ "$H2" == "200.000000" ] ; then let "H2=0"; else let "H2 = H2 / 10"; fi
echo rrdtool update $MONDEVRRD "N:${D1}:${D2}:${V1}:${V2}:${T1}:${T2}:${H1}:${H2}"
rrdtool update $MONDEVRRD "N:${D1}:${D2}:${V1}:${V2}:${T1}:${T2}:${H1}:${H2}"