To install HddStatus on your system you need PHP (with cURL support), Smartmontools and an internet connection. All you have to do is put the HddStatus script (written in PHP) somewhere on your hard disk.

Getting the script and user id

HddStatus is currently in beta. You can register online to create an account to monitor one hard disk. Please, contact with the following information if you would like to monitor more disks:
  • Username registered online
  • Number of systems where you plan to install the script
  • Operating System(s)
  • Total number of hard disks you plan to monitor
Your account will be adjusted accordingly. Once you are fully registered (email confirmation required), a download link will appear.

Install the script

The script is written in PHP, therefore anybody can look at it (it is not encrypted in any way). There is nothing hidden in it and this makes it easier to trust it. Put it in any directory, then make sure that PHP is installed on your system by executing:

[yourserver thepath]# php hddstatuscheck.php

If everything went fine, you should see some lines describing the options available for the script, like:

Executing requested action : help
Usage: hddstatuscheck <action> <options>
  Actions (only one):
    autodiscovery (find hard disks that support S.M.A.R.T.)
    help (show this help)
    showcfg (read and output the configuration file)
    showver (show script version)
  Options (zero or more):
    --savecfgonexit (mostly useful with 'autodiscovery')
    --discover3ware (useful only with 'autodiscovery')
    --discoverareca (useful only with 'autodiscovery')
    --discoverlsi (useful only with 'autodiscovery')

otherwise either PHP is not installed or the script is unreadable. In order to install PHP on your system, you should run a command like:

[yourserver thepath]# yum install php5-cli

Your system might use a different package manager (like apt-get) or use a different package name (like php-cli or simply php). Complete this step before proceeding to the next one.

Check requirements

Execute the following command to verify that requirements are satisfied:

[yourserver thepath]# php hddstatuscheck.php checkrequirements

The output should look like:

Executing requested action : checkrequirements
'smartctl' found at /usr/sbin/smartctl
'cat' found at /bin/cat
'uname' found at /bin/uname
cURL is available
Preliminary tests were successful. Good!
You will see some error message if anything wasn't found. The main requirements are Smartmontools and cURL. Most systems have a package manager (like yum or apt-get) and the commands to install those required components are:

[yourserver thepath]# yum install smartmontools
[yourserver thepath]# yum install php5-curl

The exact package names might slightly differ. Once you have installed the missing packages, repeat that command to verify their availability to the script.

Configure it

Now let the script discover supported drives for you and generate the skeleton of the configuration file by executing the following command:

[yourserver thepath]# php hddstatuscheck.php autodiscovery --savecfgonexit

The output will be something like:

Executing requested action : autodiscovery
Found sda : reports SMART data
      "path": "/dev/sda",
      "desc": "sda",
      "model": "ST3500320NS",
      "firmware": "MA07",
      "serial": "xxxxxxxx"
      "smartctloptions": ""

New hard disk found : Model=<ST3500320NS> Firmware=<MA07> Serial=<xxxxxxxx>
Saving configuration to hddstatuscheck.cfg

Now edit the resulting configuration file with your favourite text editor (this tutorial uses nano):

[yourserver thepath]# nano hddstatuscheck.cfg

You must enter your real UserId and UserPass. In the hdds section you are allowed to modify only the desc field that contains the description of that drive. This description should be kept short, yet descriptive enough to let you identify the drive. Once you have done with the editing, you can run the following command to see what the script will actually parse:

[yourserver thepath]# php hddstatuscheck.php showcfg

The output should look like:

Executing requested action : showcfg
  "UserId": "myrealuserid",
  "UserPass": "myrealpassword",
  "DCName": "Rome office",
  "RoomName": "Room 1",
  "ServerName": "Server 1",
      "path": "/dev/sda",
      "desc": "sda",
      "model": "ST3500320NS",
      "firmware": "MA07",
      "serial": "xxxxxxxx"
      "smartctloptions": ""

Inform HddStatus servers about your new hard disks

Now that you have configured everything on your side, you have to inform HddStatus servers about your new hard disks. The command that, from now on, you will execute is:

[yourserver thepath]# php hddstatuscheck.php sendreport

If any hard disk in the configuration file is currently unknown the HddStatus servers (i.e. not linked to your account) HddStatus will add it to the suggestions archive for your account. Visit HddStatus web site, log in using your user id and password and convert suggestions to valid entries. If the new hard disk replaces one that is no longer in the system, remove the old one from valid entries. This procedure makes it very easy to add new hard disks to your account. Once you have successfully added your hard disk(s) to your account, simply repeat the

[yourserver thepath]# php hddstatuscheck.php sendreport

command again. On HddStatus web site, under your account, you will now see that the report for your hard disk has been properly processed by the HddStatus servers.

Automate report sending with crontab

In the future, the script might evolve into a fully featured daemon. At the moment, you must configure your system to send new reports to HddStatus servers every once in a while. You can use crontab for this task. Run the following command:

[yourserver thepath]# crontab -e

And add a line like the following:

35 3,11,19 * * * cd /root/hddstatus ; php /root/hddstatus/hddstatuscheck.php sendreport > /dev/null 2> /dev/null

NOTE: "35" is the minute when to execute the command and "3,11,19" means that the command must be executed at 3, 11 and 19 o'clock. Use different (random) values in your setup to spread the load on the servers. It is useless to send a report every minute (your account will be banned if you do so). Sending a report every day would be absolutely fine. Sending it every 2 to 12 hours would be ok too.

What to do if you add, remove or replace a drive

It is quite easy. Just go to the "Configure it" step above and follow the process. The autodiscovery option will add to the current configuration any new drive it finds. Remember to remove from the configuration file the entries for the hard disks that are no longer in your system.