Setting up and Installing MonaLisa Alerts
MonaLisa Alerts is a powerful way to set up simple alerts and triggers based on the MonaLisa backend. It is used to drive email alerts and website alerts here at Nebraska, and can be configured to do (almost) anything. This document describes how to get it set up and working.
Prerequisites
There are several prerequistes for the monalisa_alerts 0.3.1 version. They are:- Python 2.2
- A database, and a login which includes create table permissions.
- Python modules for the database.
- The "FormEncode" and "SQLObject" python modules.
The easiest way to setup a database (if you don't already have one) is with mysql. On a SL3 box, this can be done with the following command:
yum install mysql-server mysql mysql-devel MySQL-pythonFor Postgres support (OpenSSL and Postgres development libraries should be preinstalled), use this recipe:
wget http://t2.unl.edu/Members/brian/psycopg-1-1-21-tar.gzThen, download and install the following two RPMs:
wget http://www.egenix.com/files/python/egenix-mx-base-2.0.6-py2.2_1.i386.rpm
rpm -i egenix-mx-base-2.0.6-py2.2_1.i386.rpm
yum install mx
tar zxf psycopg-1-1-21-tar.gz
cd psycopg-1.1.21
./configure --with-postgres-includes=`pg_config --includedir`/pgsql --with-postgres-libraries=`pg_config --libdir`
make
make install
Next, you need to know the database URI. Here's the explanation the SQLObject gives:
The connection URI must follow the standard URI syntax:
scheme://[user[:password]@]host[:port]/database[?parameters]
Scheme is one of sqlite, mysql, postgres, firebird, interbase, maxdb, sapdb, sybase, mssql.
Examples:
mysql://user:password@host/database
mysql://host/database?debug=1
postgres://user@host/database?debug=&cache=
postgres://host:5432/database
sqlite:///full/path/to/database
sqlite:/C|/full/path/to/database
sqlite:/:memory:
Note that there is a special syntax to specify full path on w32 systems (useable for sqlite and firebird); also sqlite can manipulate special in-memory databases.
Parameters are: debug (default: False), debugOutput (default: False), cache (default: True), autoCommit (default: True), debugThreading (default: False).
Installation
MonaLisa Alerts is based on a MonaLisa backend. As such, this version must be installed on a system with MonaLisa. Standalone versions are in the works.First, download this RPM. You can install it with the following command:
rpm -i monalisa_alerts-0.3.1-1.noarch.rpmIf you do not wish to install the RPM, you may download this tarball (not current version), and then:
tar zxf monalisa_alerts-0.3.tar.gzTo have the alerts system start up automatically at boot, execute the following commands as root:
cd monalisa_alerts-0.3
python setup.py build
sudo python setup.py install
chmod a+x /etc/init.d/ML-alerts
/sbin/chkconfig --level 345 ML-alerts on
MonaLisa Module Installation (Older versions of MonaLisa)
For MonaLisa versions 1.5.4 and below, you must follow these steps in order to enable the MonaLisa module:- Change directory to PipeResultWriter. Compile the code using the ./comp script ( in the same directory ). Your java environment must be set up; source $OSG_LOCATION/setup.sh usually takes care of this.
- Enable the filter. In the $MonaLisa_HOME/Service/VDTFarm directory, edit the ml.properties file and add the following entries:
- add the directory to the class loader
lia.Monitor.CLASSURLs=file:\${MonaLisa_HOME}/Service/usr_code/FilterExamples/PipeResultWriter/You may have to append this directory onto a list of several others. - Enable the filter:
lia.Monitor.ExternalFilters=PipeResultWriter
Again, you may have to append the PipeResultWriter to the end of several other filters, depending on your setup. - Set the configuration file:
PipeResultWriter.ConfigFile=${MonaLisa_HOME}/Service/usr_code/FilterExamples/PipeResultWriter/conf.propertiesAgain, this is still all in the ml.properties file. - Now, edit the config file the you set up in the PipeResultWriter.ConfigFile option above. There are two things you need to do:
- Edit the PIPE_NAME line to point to the name of your pipe. The tarball should already have already created one named MLResultsPipe, and you should use that. Make sure it is owned by daemon:root. If it is not, then just delete it; MonaLisa will recreate it when it loads the module.
- Edit PREDICATES to reflect the information that you want flowing through the pipe to your XML filter. Any information you want to collect in your XML file must be reflected here! The conf.properties file documents the format of this line thoroughly.
- Finally, restart MonaLisa. As root,
/etc/init.d/MLD restart
Watch the logfile, $MonaLisa_HOME/Service/VDTFarm/ML0.log for any start up errors.
Running Alerts:
Now that the MonaLisa module has been installed, the alerts system can do its work. First, edit /etc/Alert.xml to reflect your site and add your alerts. UNL's current setup is in there; you may use that as a guide. In addition to that, this website will document the various options as they are made.There are several ways to manipulate the alerts system. You can use the standard RC commands:
/etc/init.d/ML-alerts start
/etc/init.d/ML-alerts stop
/etc/init.d/ML-alerts restart
You may also use the separate scripts which do the same thing:
start-alerts.sh
stop-alerts.sh
restart-alerts.sh
Finally, you can invoke the program directly (not recommended):
Ml-Alerts.py