This is how I set up Cacti to monitor some output from lmsensors. Note that this will almost definitely need to be customised to your site, as the output from lmsensors will almost certainly differ according to your chipset.

This assumes you have Cacti setup and working, and lmsensors set up and working.

Grab the script from here

Another script that is neater, faster and easier to customise with your selection of temperatures and fan speeds is

Note that this script merely takes the output of sensors and parses it for values it knows about. Also note that it merely grabs (and tidies slightly) the variables temp1 temp2 temp3 and fan1 fan2 fan3 -- if you want to monitor more sensors you'll need to adjust this.

The script outputs the three fan speeds, then the three temperatures, seperated by spaces, to standard out.

Add a Data Input

Go to the data input page in cacti, and click 'add'. Fill in the fields with appropriate values, eg

Name: Get LM Sensors Input String: perl <path_cacti>/scripts/ Output String: <fan1> <fan2> <fan3> <temp1> <temp2> <temp3>

For each of the Output Strings listed above, add a 'Data Input Source Field', setting the name to something sensible like Fan1, the dataname to the variable name in Output String, the type to 'output' and select 'Field Used to Update RRA'

Add a Data Source

Go to the Data Source page in cacti, and click 'add'. Again, fill in with appropriate values. Note the following:

  • Data Source Type: pick GAUGE
  • Data Input Source: 'Get LM Sensors' (Assuming you called your Data input this in the previous step)
  • Minimum and Maximum Value: make sure these are sensible. Ie, if you are monitoring fans, they can run up to several thousand RPM
  • Associated RRA's: pick all of them

Add a Graph

Go to the Graph control panel page in cacti and click 'add' Most of the information here is up to you to decide. Scales etc are best suited for your preferences.

Once the graph object has been created, you need to edit the graph items. For each item you want to place on this graph, add a line or whatever.

I normally do the following for each graph item

  • a LINE1 of some suitable colour, with the AVERAGE consolodation function, and a suitably descriptive Text Format:
  • GPRINTS for each of the following consolodation functions: CURRENT, AVERAGE, MAX, MIN, in that order, again with suitable text formats:
  • the last GPRINT has a "Hard Return" set.

lib/main.php:944: Notice: PageInfo: Cannot find action page

lib/main.php:839: Notice: PageInfo: Unknown action