HOWTO: SIM - system intergrity monitor

ProWebUK

Verified User
Joined
Jun 9, 2003
Messages
2,326
Location
UK
[HOWTO= SIM - SYSTEM INTERGRITY MONITOR]

Two-a-t just reminded me i have not updated the server checklist for over a month now so i nthought id put up a HOWTO for SIM, its a simple script to install, basically just follow the readme. I will go through it in a bit more detail and make sure everyone can install it :)

## ok, So what is SIM?

SIM is a simple script, east to install and configure. Its probably the most useful script you will come across as a server administrator. It runs from CRON every 5 minutes (default time, can be changed) and checks for software such as apache, proftpd, DNS, SSH, MySQL, PGSQL, XINETD and SMTP to make sure they are running, if they are not, it will restart them automatically for you.

## How do i install it?

to inbstall it follow the simple guide below :)

## what if it goes wrong

Unfortunately, i cant guarantee it will work, it is for (i think) all versions of red hat and possibly others, i have installed it on ensim (red hat 7.3) and plesk (red hat 9) and had no problems. NOTE: I DO TAKE RESPONSIBILITY FOR ANY PROBLEMS THIS MAY CAUSE - it has not been tested by me with a DA server.

###### Installation ######

-- Information --

Commands are shown like this:
# command

Information is shown like this:
// information

Things you need to change are shown like this
*chnage_this_-_the_asterix_are_for_show_only_-_ remove_them_ when_you_edit_the_line*

##### Lets get started! #####

// make a temporary directory

# mkdir sim

// go into the directory you just made

# cd sim

// Download the latest copy of SIM

# wget http://www.rfxnetworks.com/downloads/sim-current.tar.gz

// Untar the file you just downloaded

# tar zxvf sim-current.tar.gz

// go into the untarred directory

# cd sim-2*

// Run the install file
// To uninstall replace the -i with -u

# ./setup -i

// Press enter a few times to read the license

// It should say SIM installation completed

// press enter if it hasnt already taken you to next section

// Sim should give a message like this:

SIM 2.5-3 must now be configured for use on this system, Press
return to run the autoconf script (/usr/local/sim/autoconf).

// Press enter to go through the configuration file, settings dont matter to much here.

// once thats finished and your back to command line do the following to get back to root

# cd

// now you need to edit the config file

# /usr/local/sim/conf.sim

// i recommend you read through all parts CAREFULLY, enable what you want monitored and check its all correct, most will be fine as default but its always best to make sure :)

// Chnage the following line to have your own email addresses

EMAIL="*root*" # address/user to send alerts to

// it should be chnaged to something like:

EMAIL="*[email protected]*" # address/user to send alerts to

// Next bit, select what you want monitored here (chnage the true and false parts)

SERV_FTP="true" # FTP Service
SERV_HTTP="true" # HTTP Service
SERV_DNS="true" # DNS Service
SERV_SSH="true" # SSH Service
SERV_MYSQL="true" # MySQL Service
SERV_PGSQL="false" # PGSQL Service
SERV_EWP="false" # Ensim Web Appliance Service
SERV_XINET="false" # XINET Sevice
SERV_SMTP="false" # SMTP Service

// Now make sure this is correct, it should be fine :)

FTP_NAME="proftpd" # name of FTP service as appears in 'ps'
HTTP_NAME="httpd" # name of HTTP service as appears in 'ps'
DNS_NAME="named" # name of DNS service as appears in 'ps'
SSH_NAME="sshd" # name of SSH service as appears in 'ps'
MYSQL_NAME="mysqld" # name of MySQL service as appears in 'ps'
PGSQL_NAME="postmaster" # name of PGSQL service as appears in 'ps'
EWP_NAME="ocwhttpd" # name of Ensim Web Appliance service as appears in 'ps'
XINET_NAME="xinetd" # name of XINET service as appears in 'ps'
SMTP_NAME="sendmail" # name of SMTP service as appears in 'ps'

// Unless you have chnaged ports leave the current ones as they are :)

// Finally all paths should be checked - again, should be fine as default but cant guarantee it

FTP_INIT="/etc/init.d/proftpd" # path to FTP service init script
HTTP_INIT="/etc/init.d/httpd" # path to HTTP service init script
DNS_INIT="/etc/init.d/named" # path to DNS service init script
SSH_INIT="/etc/init.d/sshd" # path to SSH service init script
MYSQL_INIT="/etc/init.d/mysqld" # path to MySQL service init script
PGSQL_INIT="/etc/init.d/postgresql" # path to PGSQL service init script
EWP_INIT="/etc/init.d/webppliance" # path to Ensim Web Appliance service init script
XINET_INIT="/etc/init.d/xinetd" # path to XINET service init script
SMTP_INIT="/etc/init.d/sendmail" # path to SMTP service init script

// You can leave the resr although i recommend you read through the rest and if you want to make modifications, make them :) (at your own risk of course)

// ok so you have it configured :) , now you have to get the script to run :)

# cd
# /usr/local/sim/sim -j

// if it says:

SIM 2.5-3 <[email protected]>
========================
Installed SIM cronjob.

// everything is now done!

// if it says:

SIM 2.5-3 <[email protected]>
========================
Removed SIM cronjob.

// type the following command again:

# /usr/local/sim/sim -j

// it should now show:

SIM 2.5-3 <[email protected]>
========================
Installed SIM cronjob.


// ok so its installed and configured, now to test it. Type the following command (note this will restart apache) THIS IS NOT REQUIRED

# service httpd stop

// you should notice that within 5 minutes apache has been restarted and is runninng like normal. If you didnt have sim and apache crashed, you would need to manually restart apache - see how useful this script is :D

// if you did the above test: type the following commands:

# cd
# /usr/local/sim/sim -s

// If it restarted it, you should see a line something similar to this

- Service Summary:
HTTP [restarted - 1 events]
MYSQL [online - 0 events]
.. other services.....

[/HOWTO]

Hope you all like it and enjoy it :)
 
Last edited:
Hi,

DirectAdmin automatically restarts downed services every minute, making SIM useful for services other than those monitored by DA. DA will always restart the service before SIM is able to, so your best bet is to keep SIM off for anything that is installed/supported by DA.

Additionally, DA does not use sendmail, it uses Exim, so those lines relating to sendmail will need to be changed. I don't think the sendmail init script is symlinked to exim, and exim does not run as "sendmail" on DA systems.

Regardless, thanks for the howto :)!
 
Last edited:
just turned smtp monitoring off :) , what does DA monitor and restart?? (helps out if anything like this comes up in the future :p )
 
loopforever is right, httpd restarted within one minute, so it supposed to be done by DA.
 
I've got it now... but i just read that DA should do it... why doesn't DA send me any mail =(
 
Peter said:
I've got it now... but i just read that DA should do it... why doesn't DA send me any mail =(

Is the service actually down? - try stopping one of the monitored services and see if it makes any difference..
 
Anyone have an updated link? I get access forbidden at the prompt and the link won't open in a browser.
 
loopforever said:
It monitors:

Apache
DirectAdmin
Exim
MySQL
Named
ProFTP
sshd
vm-pop3d

Is this still the case? I've got one box that apache drops out at random times, and doesn't recover until manually reset. Does this "feature" need to be activated someplace?

Thanks
 
would it hurt to let SIM monitor http?

Just wondering if anyone has experience letting both DA and SIM monitor HTTP - I know that SIM will catch some types of apache problems that DA might not be able to look for, so it may be advantageous to use both if they don't interfere with one another. Anyone have any thoughts?
 
DirectAdmin automatically restarts downed services every minute - where the main path/file for restarts downed services?
 
hostpc.com said:
Is this still the case? I've got one box that apache drops out at random times, and doesn't recover until manually reset. Does this "feature" need to be activated someplace?

Thanks

I've noticed this as well, this is caused when there are one or more processes still running but not accessible. DA still sees the proces so it does not restart it.
 
How do you get SIM to monitor DA? My version only looks at Esmin. (Used it a lot on that box when i had it. :)

Thanks,
-drmike
 
I'm having problems with MySQL, it started 2 days ago. Sometimes MySQL doesn't accept more connections. It shows 'Too many Connections'.

Can I use this script to solve the problem, or will SIM not see this problem en don't restart the service?
 
If it's reporting to many connections MySQL is still working properly and it's hitting the configuration limit for either that user account, database, or server-wide connection limit to keep it from bringing the whole server down. You might try finding out where this limit is set and increasing it a bit.
 
SMTP restart failed, could not find /etc/init.d/sendmail.

how to find the actual path
 
Back
Top