smartmontools - hdd temperature checker script

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

gotchi
Posts: 9
Joined: Mon Jul 31, 2006 11:47 am
Location: Austria
Contact:

Post by gotchi »

is there no one who can help me ?
sithgunner
Posts: 5
Joined: Thu Feb 08, 2007 2:16 am

Post by sithgunner »

Hi. I updated the original template to make sure the path to the script looks inside cacti installation folder and made some little changes to the script to make it simple.

I'm looking to make this to automatically find all the hard disks and give option to make multiple graphs against each hard disks, but since I'm new to cacti template editing, I'm quite stuck, I hope someone can help out here.

to use, just extract the script to cacti_installed_dir/scripts/ and make it executable and import the 2 xmls.
Attachments
cacti-smartmon-hddtemp.zip
updated template and script.
(3.21 KiB) Downloaded 1051 times
richbourne
Posts: 1
Joined: Tue Sep 11, 2007 4:13 am

hash version does not exist

Post by richbourne »

Hi,

I get a "hash version does not exist" error when importing the xml files. I am using 0.8.6i.

Has anyone else seen this?

Thanks,
Rich
grassu
Posts: 2
Joined: Wed Sep 19, 2007 5:13 am

more than one device in graph

Post by grassu »

Hi,

thanks for your template. It works very well. I monitor now my /dev/hda device. One question - and sorry if it is perhaps a silly question (I'm new to cacti) - is it possible to put more than one device into one graph?

thanks for help,

grassu
toolman667
Posts: 5
Joined: Mon Nov 03, 2008 6:58 pm

Post by toolman667 »

sithgunner wrote: I'm looking to make this to automatically find all the hard disks and give option to make multiple graphs against each hard disks, but since I'm new to cacti template editing, I'm quite stuck, I hope someone can help out here.

Hey everyone!

Sorry to bump this old thread, I just thought I would stop by and say thank you for the initial writing of this script.

I'd also like to contribute some changes to it, most notably changing the Data Collection method to a Data Query (so it can receive a list of hard drives to get smart data from).

To install, copy "query_smart_disks.sh" to (cacti_path)/scripts/, and "unix_smartd.xml" to (cacti_path)/resource/script_queries/. Then just import the included Data, Graph, and Data Query Templates into cacti.

Also the OP mentioned adding your polling user (usually www-data on debian) to the /etc/sudoers file:
maXXmaster wrote: user, so sudo it, here is the line you have to add in /etc/sudoers:

nobody ALL=NOPASSWD:/usr/local/sbin/smartctl

*nobody can be replaced by the user you let the datagathering run
You still need to do this (change the path to smartctl), as the bash script calls smartctl, which needs root access to access the disks for temperature readings. (I've tried adding www-data to the disk group, with more finicky results)

This was created in cacti 0.8.7b. Should import just fine, and doesn't contain any different than default RRAs.
Attachments
cacti_smartd_query.tgz
updated 12/25/08 - Changed from perl script single device query, to bash script/xml multiple device query.
(3.57 KiB) Downloaded 831 times
h1d
Posts: 3
Joined: Wed May 13, 2009 10:17 pm

Post by h1d »

I had to alter the bash script on the 'awk' part from '$10' to '$4' on my Ubuntu 9.04 smartmontools ( ver 5.38 ) as it was picking the wrong value after grep'ing for the right line. Also make sure the path to 'smartctl' is proper in the bash script. (I had to change to /usr/sbin, instead of /usr/local/sbin)
DUGi
Posts: 5
Joined: Wed Mar 18, 2009 4:06 am

sudo does not work via crontab

Post by DUGi »

Hello,

I tried to follow toolman667 guide but actually it does not work well for me
Script is working fine when I run it from shell:

[cactiuser@*** ~]$ /bin/sh /var/www/html/cacti/scripts/query_smart_disks.sh get temp /dev/sda
43

but it is not working via crontab:
10/21/2009 11:23:02 AM - SPINE: Poller[0] Host[26] ERROR: Empty result [***]: '/bin/sh /var/www/html/cacti/scripts/query_smart_disks.sh get temp /dev/sda'

I'm using user "cactiuser"

OS: CENTOS 5
Linux blue.abinternal.com 2.6.18-164.2.1.el5.plus #1 SMP Fri Oct 9 12:34:43 EDT 2009 i686 i686 i386 GNU/Linux

crontab:
*/1 * * * * /home/cactiuser/mypoller 2>&1

mypoller:
/usr/bin/php -q /var/www/html/cacti/poller.php > /home/cactiuser/poller.log

/etc/sudoers:
cactiuser ALL = NOPASSWD: /usr/sbin/smartctl

any ideas why sudo is not working via crontab ?
DUGi
Posts: 5
Joined: Wed Mar 18, 2009 4:06 am

sudo problem solved

Post by DUGi »

Commenting
#Defaults requiretty
in /etc/sudoers solved problem
I don't know if it is proper way how to set it up but it works now
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests