Omonitor - Installation

Updated 2009-05-03 by Oles Hnatkevych

Installing server (on Unix)

If you have a small network, then using xinetd service will be enough. Comparing to old inetd new xinetd can provide ip-address of remote host, and has more flexible configuration.

That is how I do this.


Make sure you have xinetd, apache, mysql or sqlite3, fping, php (pcre, pdo_mysql or pdo_sqlite, sockets, posix, pcntl, date; list of loaded modules you can find running 'php -m')


Add a new user account to run omonitor and unpack archive:
adduser -m omonitor 	# linux
# or
pw useradd omonitor -m	# freebsd

su - omonitor
tar xvzf /path/to/omonitor.tar.gz
cd omonitor/etc/

Preparing database

MySQL is preffered as I experienced problems with Sqlite3 handling simultaneous updates for some reason.


mysql> GRANT all ON omonitor.* to omonitor@localhost IDENTIFIED BY 'somepassword';
cd ~omonitor
mkdir data/
chmod g+w data/ # make this folder writable by httpd or apache user! use chgrp or whatever

Configure server

Create etc/

// path to mysql socket depends on your OS/distribution

// if you use sqlite then use these lines

Create database

This script will create all tables also check that all needed php modules are available.
cd /path/to/bin/
php setup.php init

Configure agent

Create etc/localhost
# or
PHP="/usr/local/bin/php" # for freebsd users

Configure server basic checks

Create etc/clients
UP      1h
LOAD    5.0 10.0
DISK    * 90 95

Configure server pinger

Create hosts with list of hostnames you want to ping for connectivity test
# ...

Configure cron for server

Add to crontab:
*/5 * * * * omonitor /bin/sh /path/to/bin/server urlchecker pinger cleaner

Configure server to accept client connections

You have two choices: xinetd service or a standalone daemon. Daemon has to be restarted when you change php configuration, xined service does not. Daemon has to be started when your system comes up, xined service does it by itself. Daemon should handle lot of connections better.

Configure server as a standalone daemon

cp /path/to/etc/ /usr/local/etc/rc.d/
chmod +x /usr/local/etc/rc.d/
vi /usr/local/etc/rc.d/ # fix user and path
/usr/local/etc/rc.d/ start
... or

Configure server as a xinetd service

Create xinted service (put to /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

Configure apache

Add to Apache config:
Alias /omonitor /path/to/omonitor/www
<Directory /path/to/omonitor/www>
	Allow from all
	Allow override all
	DirectoryIndex index.php
Then restart Apache.

Test it out

Go to Look for logs/server.log for the problems.

Configure it further

Customize etc/clients, etc/alerts to your needs.

Installing agent on Unix


If you have not unpacked it when configure server, then to it as described in server installation.


Create (or add to) 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


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 and 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
com.allow_dcom = true

Configure omonitor windows agent

Create omon.config.php in the folder you unpacked:
//$DOMAIN = "";// if you have Active Directory
$DNSDOMAIN = ""; // if your DNS is not Active Directory
$SERVER = "";
Create file stations with list of hosts and tests for them:
some-pc-host proc disk
# 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.