Created
March 6, 2012 01:51
-
-
Save hplc/1982824 to your computer and use it in GitHub Desktop.
Gather machine hardware informations from snmp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Put it in /etc/rc.local, let it run every time machine boot. | |
filename=`date +%Y%m%d-%H%M%S` | |
cd /etc/records | |
hostname >> $filename | |
ifconfig eth0|grep inet|grep -v inet6|awk '{print $2}' >> $filename | |
dmesg|grep -i Memory|grep available >> $filename | |
sudo df -h|grep sda >> $filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Hostname: iso.3.6.1.2.1.1.5.0 = STRING: "R4C5-Dell-DE051" | |
# iso.3.6.1.2.1.4.20.1.1.192.168.60.181 = IpAddress: 192.168.60.181 | |
# CPU: iso.3.6.1.2.1.25.3.2.1.3.768 = STRING: "GenuineIntel: Intel(R) Pentium(R) 4 CPU 2.80GHz" | |
# Physical memory: iso.3.6.1.2.1.25.2.3.1.5.1 = INTEGER: 506644 | |
# Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1 | |
# Tested in Ubuntu Linux 3.0.0-12-generic | |
snmpcmd="snmpget -v 1 -c public 192.168.60." | |
for i in 181 182 | |
do | |
$snmpcmd$i iso.3.6.1.2.1.1.5.0 | |
$snmpcmd$i iso.3.6.1.2.1.4.20.1.1.192.168.60.$i | |
$snmpcmd$i iso.3.6.1.2.1.25.3.2.1.3.768 | |
$snmpcmd$i iso.3.6.1.2.1.25.2.3.1.5.1 | |
$snmpcmd$i .1.3.6.1.4.1.2021.9.1.6.1 | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment