Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_hddtemp.sh

Rating
12 votes
Favoured:
0
Hits
103991
Files:
FileDescription
check_hddtemp.shVersion 1.0 (8 sept. 2008)

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting ethangalstad.me/nagios. Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

Monitor ATA and S-ATA drive temperature.
A very simple script that gets the harddrive temperature from S.M.A.R.T. by using hddtemp

syntax and example:
./check_hddtemp.sh
./check_hddtemp.sh /dev/sda 40 50


since hddtemp needs superuser access you will need to set up sudo:
nagios ALL=(root) NOPASSWD:/usr/lib/nagios/plugins/check_hddtemp.sh

I have only testet it on nagios 2 and debian etch
Reviews (5)
bywj@ds-science, December 10, 2018
Good Plugin. I use it to monitor different servers within the rack to validate our climate control monitoring system.

To get results in Fahrenheit, make the following edit (line 70)

HEAT=`$HDDTEMP $DEVICE -n -uF`
Just to hopefully save someone else some heartache, if you have your command defined and sudo privileges granted, make sure to use "getenforce" and verify SELinux isn't interfering with your plans!
bykrasko, July 28, 2012
You need to define nagios command with sudo prefix, for example:

define command{
command_name check_hddtemp
command_line sudo $USER1$/contrib/check_hddtemp.sh /dev/$ARG1$ 40 50
}

And you will also probbly need to do not require tty for nagios user sudo. Add following line into /etc/sudoers:

Defaults:nagios !requiretty
byhronny, July 25, 2012
Check location of the script in sudoers file. I had the same problem because my installation is under /usr/local/nagios/

The correct line in sudoers file is:
nagios ALL=(root) NOPASSWD:/usr/local/nagios/libexec/check_hddtemp.sh

this works for me!
bynishith, July 11, 2012
This plugin is working from command line. Please have a look.


root@localhost/]#./check_hddtemp.sh /dev/sda 40 50
OK: Temperature is below warn treshold (/dev/sda is 34)

But, it is giving below error in "Nagios Web Interface".

UNKNOWN: please make sure script is running as root

I have set it up in "sudoers" file, but still no luck.