generating graphs for the lm_sensor package

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Guest

Post by Guest »

Hello,

I’m trying to put up a script for collecting data out of the lm_sensor package, where you can gather information’s about your i2c-system (fan speed, cpu temp and so on)

When I’m ready I can send you the script, if you want?

But if some one have already done some thing like this I would be very appreciated, if you can give me this script.

This brings me to an idea, why do not put up an archive for such information gathering scripts. (like the module archive at webmin) ?

Please let me know what you are thing about this.

--
cu t.scholz (exolon)
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I have considered making such a script, but my experience with lm_sensors is minimal. This sort of thing would be very useful for cacti though, as you would be able to easily monitor server temps.

-Ian
Guest

Post by Guest »

Hello rax,

I finished the script to collect all the lm_sensor data. It is very easy because the data is stored in the /proc pseudo file system.

After installing the lm_sensor package you can find all under /proc/sys/dev/sensors/???
Depending on your chip. For me it is an:
- Winbound 83782d (MSI-BX-Master) and on my Asus P2B I have a
- Winbound 83781d

You can find a cool List under: http://mbm.livewiredev.com/

With this packed an normal list of information’s look like:

alarms beep fan1 fan2 fan3 fan_div
in0 in1 in2 in3 in4 in5 in6 in7 in8
pwm1 pwm2 pwm3 pwm4
sensor1 sensor2 sensor3
temp1 temp2 temp3 vid

So you can get all the things witch you also can see in your bios settings.
Like all the voltage, fan speed, cpu/board temp, …

………………………………….

For an example here is my config within cacti:

# Data Input Source Configuration
- Name: The name of this data source; only used by the front end.
[Get Sensors]

- Input String: The data that in sent; which includes the filename and input sources in <> brackets.
[perl <path_cacti>/scripts/sensors.pl <item> <dir> <awkno>]

- Output String: The data that is returned from the input program; defined as <> brackets.
[<value>]

# Current Data Input Source Fields
Name | Data | Name | Input/Output | Update | RRA
-------------------------------------------------------------
[awkno (z.B. 1, 2, 3): | awkno | Input | No]
[dir (z.B. /proc/sys/dev/sensors/w83782d-i2c-0-2d/): | dir | Input | No ]
[Input (z.B. fan1,fan2,fan3,temp1,temp2,temp3): | item | Input | No ]
[Output | value | Output | Yes ]

# rrdtool Data Source Configuration
perl /www/cacti/scripts/sensors.pl temp1 /proc/sys/dev/sensors/w83782d-i2c-0-2d/ 3

- awkno (z.B. 1, 2, 3):
[3]

- dir (z.B. /proc/sys/dev/sensors/w83782d-i2c-0-2d/):
[/proc/sys/dev/sensors/w83782d-i2c-0-2d/]

- input (z.B. fan1,fan2,fan3,temp1,temp2,temp3):
[temp1]

………………………………….

As you can see the script uses 3 inputs an 1 output

With the input awkno you can specify witch value you want, because some lm_sensor data have a format like this:
60.0 50.0 24.5 <- first is the absolute max second is a warn level and third is the real actual data.


So here comes the script:

#!/usr/bin/perl

$cmd = "cat";
$item = $ARGV[0];
$dir = $ARGV[1];
$awkno = $ARGV[2];

$value = `$cmd $dir$item | awk '{print $$awkno }'`;
chomp $value;

………………………………….

Why I am telling you all this, is because the data is collected but not shown correct in the graph !
I can see the data in the text area under the graph, but nothing is shown up in the graph a both.

# Here is the source:
/usr/local/rrdtool-1.0.33/bin/rrdtool graph -
--imgformat=PNG
--start="-86400"
--title="Sensors"
--base=1000
--height=120
--width=500
--alt-autoscale-max
--vertical-label="lm_sensors"
DEF:06c575658472fa="/www/cacti/rra/system_sens_fan3.rrd":system_sens_fan3:AVERAGE
DEF:fe5614f42ba989="/www/cacti/rra/system_sens_temp1.rrd":system_sens_temp1:AVERAGE
DEF:9d74cff571fbb3="/www/cacti/rra/system_sens_temp2.rrd":system_sens_temp2:AVERAGE
CDEF:cdef9d74cff571fbb3=9d74cff571fbb3,300,*
AREA:06c575658472fa#CAF100:"Seed:4141rpm"
AREA:fe5614f42ba989#FF6044:"Motherboardtemp. 29.0ºC"
AREA:cdef9d74cff571fbb3#3D168B:"CPU temp. 24.5ºC"

And the rrdtool Data Source Configuration

/usr/local/rrdtool-1.0.33/bin/rrdtool create
/www/cacti/rra/system_sens_fan3.rrd
--step 300
DS:system_sens_fan3:ABSOLUTE:600:0:10000
RRA:AVERAGE:0.5:1:600
RRA:AVERAGE:0.5:6:700
RRA:AVERAGE:0.5:24:775
RRA:AVERAGE:0.5:288:797
RRA:MAX:0.5:1:600
RRA:MAX:0.5:6:700
RRA:MAX:0.5:24:775
RRA:MAX:0.5:288:797


!!! I hope you can tell me what is wrong with my setting. !!!


Btw: why must the max value be bigger than the maximum value ??? you mean bigger than the minimum value?
Maximum Value: The maximum value of data that is allowed to be collected (number must be smaller than max value).

--
cu t.scholz (exolon)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests