• contact
  • linkblog
Home

Graphing your servers motherboard temperature and fan RPM speeds

rene — Thu, 04/16/2009 - 07:30

Cacti, the "complete network graphing solution", is a powerful web application that provides rrdtool graphing templates and data collection methods. Think web based system graphing and collection platform.

There is a small learning curve in creating advanced graphs, though once you flatten this curve you're able to harness the power of Cacti to do fancy things like graphing your motherboard temperature and fan RPM speeds.

Heres how

Install and configure lm-sensors

lm-sensors is the hardware monitoring tool that will provide essential information on your hardware health such as motherboard temperature, CPU core temperature and fan RPM speed.

Install and configuring in Ubuntu is as easy as

$ sudo apt-get install lm-sensors
$ sudo sensors-detect

A series of questions will be asked by sensors-detect though choosing the default answers should hopefully work. If not, its best to consult the lm-sensors installation wizard guide on the lm-sensors wiki.

Install cacti

Installing cacti should be fairly straight forward too within Ubuntu. Your mileage may vary with other distributions but with Debian based systems such as Ubuntu run

$ sudo apt-get install cacti

If you have any problems configuring Cacti, /usr/share/doc/cacti/ if your friendly document directory that may provide you with some help.

Install and test a Cacti collection script

You will be passing information to Cacti via a script which needs to use the standard cacti data input template defined in the cacti manual.

<fieldname_1>:<value_1> <fieldname_2>:<value_2> ... <fieldname_n>:<value_n>

Ive created a perl script to filter out the useful stuff outputted from the 'sensors' application. It will output information in the format cacti expects. Below is an example of the output

$ /usr/local/bin/sensors_cacti 
fan1:1266 fan2:0 fan3:1973 fan4:1295 in0:1.04 in1:1.89 in2:3.26 ..

You can download this script called sensors_cacti here

Feel free to hack some of your own code or use mine though be sure that the output conforms to what cacti expects.

Cacti Data Input Method

Once you log into cacti, go to Data Input Methods->Add to create a new data input method which will have following attributes

Name: lm_sensors
Input Type: Script/Command
Input String: /usr/local/bin/sensors_cacti

The 'Input String' is the path to the script that will generate the output cacti will use to fill its rrdtool databases. The script will need to be executable by the Web server system account on your box.

The 'Input Fields' section stays blank though the 'Output Fields' section will need to be filled out. The 'Output Fields' are the fields that your script will output. Cacti needs to know what these fields are so it can create and update its rrdtool databases based on the values for these fields. Also the 'Name' of the fields needs to match the field name which your script outputs.

Im capturing and graphing core CPU temperature, fan RPM speed and motherboard temperature so the output of the script would be

fan1:1266 fan2:0 fan3:1979 fan4:1293 in0:1.06 in1:1.89 ..

Data Template

Go to Data template->Add and create a template with the following attributes

Data Templates
Name: lm_sensors

Data Source
Name: |host_description| - lm sensors
Data Input Method: lm_sensors

You will then need to create a 'Data Source Item' for each lm-sensors label (ie; in1,fan1). Ive created 21 different data sources for the Data Template that will hold data for various temperatures and RPM speeds of my motherboard so this part is time consuming.

An example of a Data Source Items attributes for the lm-sensors label fan1 are

Internal Data Source Name: fan1
Minimum Value: 0
Maximum Value: 0
Data Source Type: GAUGE
Heartbeat: 600
Output Field: fan1 - fan1

Graph Templates

Go to Graph Templates->Add and create the motherboard temperature graph. Again as we are potentially dealing with many lm-sensor labels (ie; in1, fan1, Core0,temp1) creating this template could become time consuming.

Use these attributes for the motherboard temperature Graph Template

Template
Name: Motherboard Temperature

Graph Template
Title: |host_description| - Motherboard Temperature
Vertical Label: Celsius

Click Create->Graph Template Items->Add.

Graph Template Items
Data Source: lm_sensors - (temp1)
Color: FF0000
Graph Item Type: AREA
Value: Celcius
Text Format: temp1

Create another Graph Template Items for temp2 and any other lm-sensors temp labels you have. You can add average, minimum and maximum values to your graph by creating a GPRINT graph item type using the appropriate CF types.

Create the graph!

After all this work we can now create a real graph by going to Graph Management->Add

Graph Template Selection
Selected Graph Template: Motherboard Temperature
Host: Localhost (127.0.0.1)

Supplemental Graph Template Data
Data Source [temp1]: Localhost - lm_sensors (temp1)
Data Source [temp2]: Localhost - lm_sensors (temp2)

Click Save and allow cacti to populate the rrd databases with a bit of data which can be graphed. This can usually take up to 30 minutes as the cacti rrd poller runs every 5 minutes from within cron.

You can find my data and graph templates in xml here and here which can be imported into Cacti.


photos im taking

photo.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgSpiderman!photo.jpgJazz night the RSLChinese new year in melbournephoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpgphoto.jpg

connect with me

search rene.bz

what im reading

  • It’s going to take five years - six words that can save your startup
  • 5 Types of Emails You Should be Automatically Filtering
  • Google CEO Eric Schmidt Circa 1986
  • When CEOs Have Warren Buffett In Their Boardroom
  • How NodeJS saved my web application
  • Want more startup hubs? Show us your faces
  • Notes from a production MongoDB deployment
  • Debian refuses to package the embedded PHP library. Reason ? "it's a rotten language whose use should not be encouraged". WTF ?
  • MySQL and Memcached: End of an Era?
  • People Don't Hate Change - They Hate You Trying to Change Them
  • The Data Deluge
  • Palm Says Revenue Will Be Lower Than Expected, Cites Slow Sales
  • Do You Follow Too Many People On Twitter? Use ManageTwitter.
  • Future iPads To Have Front-facing Cameras, Flash (Bulbs, Not Software)
  • PHOTO: In "Life, below 600px," Paddy Donnelly talks
  • 5 Ways to Stop Second Guessing Yourself
  • I Don’t Want a Freaking Computer
  • Man Checks-In Everywhere But Foursquare Rehab
  • How to Kill a Radical Idea
  • MEETorDIE Quantifies The Cost Of Wasteful Meetings
more

what im bookmarking

  • http://www.megacz.com/thoughts/advice/ibm.rsa.html
  • VMware KB: Timekeeping best practices for Linux guests
  • Linux installation kickstart for Oracle database - Oracle Wiki
  • IBM developerWorks: Wikis - Linux for Power Architecture - RHEL5 - Root on dm-multipath device
  • jQuery: » The Official jQuery Podcast – Episode 13 – David Walsh
  • BBC - BBC World Service Programmes - Digital Planet, 16/02/2010
  • gdgt weekly 074 - gdgt
  • PXE virtual network with Virtualbox and Cobbler | number 9
  • bootstrapping Puppet from Cobbler | number 9
  • willypick @ MindSay double NAT
  • BBC iPlayer rejects open source plugins, takes Flash-only path • The Register
  • Puppet Red Hat Centos – puppet
  • Augeas — Main
  • IT Conversations | StackOverflow | Episode 84
  • IT Conversations | O'Reilly Media Gov 2.0 Summit | Panel: John Markoff, Vinton Cerf, Jack Dorsey, Tim Sparapani
  • Shot of Jaq » Jaqback, Issue 4
  • Shot of Jaq » Developing The Devop
  • TWiST #40 Bonus Interview with Penn State | This Week in Startups (TWiST)
  • The Pipeline 3: Jason Fried | 5 by 5
  • Risky Business #140 -- Former NSA tech director, info assurance, Brian Snow | Risky Business
more

podcasts im listening to

  • jQuery: » The Official jQuery Podcast – Episode 13 – David Walsh
  • BBC - BBC World Service Programmes - Digital Planet, 16/02/2010
  • gdgt weekly 074 - gdgt
  • IT Conversations | StackOverflow | Episode 84
  • IT Conversations | O'Reilly Media Gov 2.0 Summit | Panel: John Markoff, Vinton Cerf, Jack Dorsey, Tim Sparapani
more
  • contact
  • linkblog