That is how I do this.
adduser -m omonitor # linux # or pw useradd omonitor -m # freebsd su - omonitor tar xvzf /path/to/omonitor.tar.gz cd omonitor/etc/
mysql:
mysql> CREATE DATABASE omonitor DEFAULT CHARACTER SET utf8; mysql> GRANT all ON omonitor.* to omonitor@localhost IDENTIFIED BY 'somepassword';sqlite:
cd ~omonitor mkdir data/ chmod g+w data/ # make this folder writable by httpd or apache user! use chgrp or whatever
etc/server.inc.php
<? $WEBURL="http://www.yourhost.com/omonitor/"; // path to mysql socket depends on your OS/distribution $PDO_DSN="mysql:unix_socket=/tmp/mysql.sock;dbname=omonitor"; $PDO_USER='omonitor'; $PDO_PASSWORD='somepassword'; /* // if you use sqlite then use these lines $DATABASE="/home/omonitor/data/data-sqlite"; $PDO_DSN="sqlite:$DATABASE"; $PDO_USER=''; $PDO_PASSWORD=''; */ ?>
cd /path/to/bin/ php setup.php init
etc/localhost
SERVERS="localhost" PHP="/usr/bin/php" # or PHP="/usr/local/bin/php" # for freebsd users
etc/clients
[/.*/] UP 1h LOAD 5.0 10.0 DISK * 90 95
hosts
with list of hostnames you want to ping for connectivity test
first.host.name second.host.name # ...
*/5 * * * * omonitor /bin/sh /path/to/bin/server urlchecker pinger cleaner
cp /path/to/etc/freebsd-omonitor.sh /usr/local/etc/rc.d/omonitor.sh chmod +x /usr/local/etc/rc.d/omonitor.sh vi /usr/local/etc/rc.d/omonitor.sh # fix user and path /usr/local/etc/rc.d/omonitor.sh start... or
/etc/xinetd.d/omonitor
):
service omonitor { type = UNLISTED socket_type = stream port = 1975 protocol = tcp wait = no user = somebody server = /usr/bin/php server_args = /path/to/bin/acceptor.php disable = no instances = 100 cps = 1000 1 }Then make xinetd reload config
killall -1 xinetd
Alias /omonitor /path/to/omonitor/www <Directory /path/to/omonitor/www> Allow from all Allow override all DirectoryIndex index.php </Directory>Then restart Apache.
logs/server.log for the problems.
Configure it further
Customize etc/clients
, etc/alerts
to your needs.
Installing agent on Unix
Unpacking
If you have not unpacked it when configure server, then to it as described in server installation.
Configuring
Create (or add to) localhost
SERVERS="server.host.name"
#SERVERS="localhost"
Configuring cron to run agent
Add to crontab
*/5 * * * * omonitor /bin/sh /path/to/bin/client proc disk cpu dmsg
Installing agent on Windows
Unpacking
Put somewhere the win/
subfolder from omonitor archive to windows box
that is running 24x7 and is domain member
Install and configure PHP
Get latest php and pecl installation for windows; at the time of writing they are
php-5.2.8-Win32.zip
and pecl-5.2.6-Win32.zip.
Unpack php zip to c:\php\
and pecl zip (php_win32service.dll is enough) to c:\php\ext\
.
Add path c:\php
to PATH environment (my computer-properties-additional-environment variables)
Copy c:\php\php.ini-recommended
to c:\php\php.ini
and make sure it has
short_open_tag = On
error_reporting = E_ALL & ~E_NOTICE
register_globals = Off
register_argc_argv = On
extension=php_sockets.dll
extension=php_win32service.dll
com.allow_dcom = true
Configure omonitor windows agent
Create omon.config.php
in the folder you unpacked:
<?
//$DOMAIN = "domain.name";// if you have Active Directory
$DNSDOMAIN = "domain.name"; // if your DNS is not Active Directory
$SERVER = "server.host.name";
//$DEBUG=false;
?>
Create file stations
with list of hosts and tests for them:
some-pc-host proc disk
# another-host.domain.name proc disk
Test it
Test it out running php run-all-tests.php
Register as a service
Run php omon-service.php register
then run services.msc
and setup service account that may query domain members for WMI data.
Start the service.