lepermime
Joined: 08 Apr 2003 Posts: 23
|
Posted: Thu Jun 12, 2003 2:21 pm Post subject: lm_sensors graphing howto (BASIC) |
|
|
For all of those out there who want to graph more "stuff" but don't have the indepth knowledge of snmp to create your own MIB structure the following might be very handy.
After getting Sensors up and running (Im not going to cover that, there are quite a few tweaks that you might need to do per board and quite frankly it can be a real pain in the butt, some of it is trial and error) the first thing needed is a shell script to pull data from sensors STDOUT:
#!/bin/sh
for line in `sensors -f|tr -s ' '|cut -d' ' -f1,2|tr -d ' '|tr '\260' '|'|sed s/\|F//g`
do
NAME=`echo $line|cut -d':' -f1`
VALUE=`echo $line|cut -d':' -f2`
echo $NAME
echo $VALUE
done
I saved this in /etc/snmp/sensormib.sh Yes I know it isn't exactly the best place to put an executable script but it works.
After doing this go into your /etc/snmp/snmpd.conf and add the following line under section for extending snmp
exec .1.3.6.1.4.1.2021.5822.10 LM.Sensors "/etc/snmp/sensormib.sh"
This will run the script and return values in a MIB structure whenever anything in the .1.3.6.1.4.1.2021.5822.20 MIB subtree is called. As you can see right now I am only pulling for a few specific values that all motherboards I have return. I did have to tweak the /etc/sensors.conf file to work with what I wanted the names to be.
Here is the output from an snmpwalk on localhost with this script added in:
enterprises.ucdavis.2789.51.1.1 = 1
enterprises.ucdavis.2789.51.2.1 = "LM.Sensors"
enterprises.ucdavis.2789.51.3.1 = "\"/etc/snmp/sensormib.sh\""
enterprises.ucdavis.2789.51.100.1 = 0
enterprises.ucdavis.2789.51.101.1 = "w83627hf-isa-0290"
enterprises.ucdavis.2789.51.101.2 = "w83627hf-isa-0290"
enterprises.ucdavis.2789.51.101.3 = "Adapter"
enterprises.ucdavis.2789.51.101.4 = "ISA" Hex: 49 53 41
enterprises.ucdavis.2789.51.101.5 = "Algorithm"
enterprises.ucdavis.2789.51.101.6 = "ISA" Hex: 49 53 41
enterprises.ucdavis.2789.51.101.7 = "VCore1"
enterprises.ucdavis.2789.51.101.8 = ""
enterprises.ucdavis.2789.51.101.9 = "VCore2"
enterprises.ucdavis.2789.51.101.10 = ""
enterprises.ucdavis.2789.51.101.11 = "+3.3V"
enterprises.ucdavis.2789.51.101.12 = "+3.28"
enterprises.ucdavis.2789.51.101.13 = "+5V" Hex: 2B 35 56
enterprises.ucdavis.2789.51.101.14 = "+4.94"
enterprises.ucdavis.2789.51.101.15 = "+12V" Hex: 2B 31 32 56
enterprises.ucdavis.2789.51.101.16 = "+12.01"
enterprises.ucdavis.2789.51.101.17 = "-12V" Hex: 2D 31 32 56
enterprises.ucdavis.2789.51.101.18 = "-12.39"
enterprises.ucdavis.2789.51.101.19 = "-5V" Hex: 2D 35 56
enterprises.ucdavis.2789.51.101.20 = "-4.95"
enterprises.ucdavis.2789.51.101.21 = "V5SB" Hex: 56 35 53 42
enterprises.ucdavis.2789.51.101.22 = "+5.53"
enterprises.ucdavis.2789.51.101.23 = "VBat" Hex: 56 42 61 74
enterprises.ucdavis.2789.51.101.24 = "+3.16"
enterprises.ucdavis.2789.51.101.25 = "fan1" Hex: 66 61 6E 31
enterprises.ucdavis.2789.51.101.26 = "5672" Hex: 35 36 37 32
enterprises.ucdavis.2789.51.101.27 = "temp1"
enterprises.ucdavis.2789.51.101.28 = "+102.2"
enterprises.ucdavis.2789.51.101.29 = "temp2"
enterprises.ucdavis.2789.51.101.30 = "+112.1"
enterprises.ucdavis.2789.51.101.31 = "temp3"
enterprises.ucdavis.2789.51.101.32 = "+491.9"
enterprises.ucdavis.2789.51.101.33 = "vid" Hex: 76 69 64
enterprises.ucdavis.2789.51.101.34 = "+1.30"
enterprises.ucdavis.2789.51.101.35 = "alarms"
enterprises.ucdavis.2789.51.101.36 = "Chassis"
enterprises.ucdavis.2789.51.101.37 = "beep_enable"
enterprises.ucdavis.2789.51.101.38 = ""
enterprises.ucdavis.2789.51.101.39 = "Sound"
enterprises.ucdavis.2789.51.101.40 = "Sound"
enterprises.ucdavis.2789.51.102.1 = 0
Temperature is returned in fahrenheit(sp) and other values are returned standard. there are other values that running sensors from a console will return but they are not always standard. This has already helped me a great deal in catching heat problems which might show up in other areas. And we all know how bad having a fan die on you can be. Now you can catch it before it happens.
BTW if anyone has implemented this already directly in the MIB tree I would appreciate information on how to do that. This is simply a quick and dirty solution I came up with in an afternoon. And to go along with that I have a question.
Does anyone know how to create aggregate graphs. IE: Ones listing temperatures of all systems on a single graph, so you can see temps or fanspeed or anything else in relation to other systems, on the same graph.
[/img] |
|