-
Notifications
You must be signed in to change notification settings - Fork 3
/
monitor4250.sh
executable file
·44 lines (39 loc) · 1.44 KB
/
monitor4250.sh
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
39
40
41
42
43
44
#!/usr/bin/env bash
###
# Copyright (c) 2012, Chris Rushton
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
##
ip=<ip address>
community=<community string>
sleeptime=1
NUM=1
echo -e "\t\t\tDate\tUptime\t\tCPU\tMEM\tSess\tCPS"
while (true)
do
date=$(date)
cpu=$(snmpget -OqUv -v2c -c $community $ip 1.3.6.1.4.1.9148.3.2.1.1.1.0)
mem=$(snmpget -OqUv -v2c -c $community $ip 1.3.6.1.4.1.9148.3.2.1.1.2.0)
sess=$(snmpget -OqUv -v2c -c $community $ip 1.3.6.1.4.1.9148.3.2.1.1.5.0)
cps=$(snmpget -OqUv -v2c -c $community $ip 1.3.6.1.4.1.9148.3.2.1.1.6.0)
uptime=$(snmpget -OqUv -v2c -c $community $ip 1.3.6.1.2.1.1.3.0)
echo -e "$date\t$uptime\t$cpu%\t$mem%\t$sess\t$cps"
sleep $sleeptime
if [ $NUM -lt 60 ];
then
let NUM=$NUM+1
else
NUM=1
echo -e "\t\t\tDate\tUptime\t\tCPU\tMEM\tSess\tCPS"
fi
done