Welcome to the blog of mechanised.com

This blog is mainly a technical repository of information on Virtualisation tools and management for our hosting service.

Also for HP's Bladesystem that we use at both our datacentres.

Other articles are also included on .Net development and MS SQL Server as well as other interesting things we come across.

Tuesday 27 April 2010

How to monitor an LSI MegaRAID controller within OpenFiler

Use wget to download the MegaCLI package from LSI you need the MegaCLI - Linux version

Extract the files eg.

rpm2cpio MegaCli-8.00.11-1.i386.rpm | cpio -idmv

and make sure you move the binaries into /opt/MegaRAID/MegaCli/

cd /etc/cron.hourly

Create a new hourly script to check the drives and send an email alert if there's a problem

vi MegaRAIDcron

#!/bin/bash
cd /opt/MegaRAID/MegaCli
./MegaCli64 -AdpAllInfo -aALL | grep "Degraded" > degraded.txt
./MegaCli64 -AdpAllInfo -aALL | grep "Failed" >> degraded.txt
cat degraded.txt | grep "1" > /dev/null
if [[ $? -eq 0 ]];
then
./MegaCli64 -LdPdInfo -aALL | mailx -s 'Degraded RAID on '$HOSTNAME -r $HOSTNAME@youremail.com alert@youremail.com
fi

:wq

chmod 775 MegaRAIDcron

You can test this works by running the script manually but replace the grep "1" on the 5th line with grep "0" so it'll send an alert if there are 0 failures instead of 1. Don't forget to change it back!

This script was adapted from this post on the Openfiler forums.

You can also send a daily/weekly overview email (to make sure it's still working!) by creating a similar file as above in the cron.daily or cron.weekly folder.

#!/bin/bash
cd /opt/MegaRAID/MegaCli
./MegaCli64 -LDInfo -Lall -aALL >/tmp/MegaCli64.txt
mailx -s 'RAID INFO on '$HOSTNAME -r $HOSTNAME@youremail.com -v -a /tmp/MegaCli64.txt you@youremail.com

Friday 16 April 2010

Removing Linux server headers

Quick reminder to remove Apache and PHP server headers:

Edit /etc/httpd/conf/httpd.conf
Find ServerTokens and change to ServerTokens Prod

Edit /etc/php5/php.ini
Find expose_php and change to expose_php = Off

This will make sure fingerprinting a server for vulnerabilities is slightly reduced.