Demo entry 6349667

snmp.sh

   

Submitted by anonymous on Feb 25, 2017 at 18:52
Language: Bash. Code size: 513 Bytes.

#!/bin/bash
echo "time		cpu		memory		temp	" >> huawei.log
while true
do
	date=`date  "+%X"`
	cpu=`snmpwalk -v 1 -c Yunanbao 192.168.1.254 1.3.6.1.4.1.2011.6.3.4.1.2  | awk {'print $4'}`
	memory=`snmpwalk -v 1 -c Yunanbao 192.168.1.254 1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7 | grep '603979777' | awk {'print $4'}`
	temp=`snmpwalk -v 1 -c Yunanbao 192.168.1.254 1.3.6.1.4.1.2011.5.25.31.1.1.1.1.11 | grep '603979777' | awk {'print $4'}`
	echo "${date}	${cpu}	${memory}	${temp}	" >> huawei.log
	sleep 10
done

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).