You were never here, you didn't see anything..

Gentoo Server Config – 3


This is part 3, but it is really an addendum to part 2. My hard drive SMART data stopped showing up. In fact I am not even sure how I got it in the first place unless perhaps I set the UID bit on smartctl… At any rate, these are the steps required to make sure you get SMART data from your drives when using phpsysinfo.

First, install sudo via:

emerge -aq sudo

And configure it to allow the apache user to run smartctl without the use of a password. This is accomplished with the folowing line added via “visudo”:

## Give apache permissions to use smartctl for phpsysinfo 
apache ALL=NOPASSWD: /usr/sbin/smartctl

Comment included for good measure. Don’t want other admins wondering what is going on.

Next, from the install path find and edit the file “plugins/SMART/class.SMART.inc.php”. The line number 60 should include:

if (CommonFunctions::executeProgram('smartctl', '--all'.((PSI_PLUGIN_SMART_DEVICE) ? ' --device '.PSI_PLUGIN_SMART_DEVICE : '').' '.$disk, $buffer, PSI_DEBUG)) {

Which needs to be changed to read:

if (CommonFunctions::executeProgram('sudo', '/usr/sbin/smartctl --all'.((PSI_PLUGIN_SMART_DEVICE) ? ' --device '.PSI_PLUGIN_SMART_DEVICE : '').' '.$disk, $buffer, PSI_DEBUG)) {

This should get things going.

Source for the fix originally came from:
http://mewbies.com/how_to_install_phpsysinfo_nix_tutorial.html

(No, I was not creative enough to nail this one)

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!