SlapMonitor

  • Last Update:2012-10-12
  • Version:001
  • Language:en

Agenda

  • What is SlapMonitor
  • What is Wallix LogBox
  • How does slapmonitor works
  • How to configure a lamp software to send consumption log to logbox server

This guide has been created to teach how to use slapmonitor to send apache and mariadb consumption information (of a lamp software) to an existing logbox server.

What is SlapMonitor

Slapmonitor is a tiny python script located in slapos.toolbox (http://git.erp5.org/gitweb/slapos.toolbox.git/blob/HEAD:/slapos/monitor.py) written to monitor CPU / RAM usage for apache and mysql and generate some output (sqlite3 database, xml, ...). With SlapReport, generic lamp stack now support logbox as a log service and allow to push log files through SSH to an already existing logbox server.

What is Wallix LogBox

Wallix LogBox is a software developed by Wallix to meet the specific needs of log management. Available as a hardware appliance or as software, Wallix LogBox enables unified and simplified access to any type of log, regardless of its format or origin. By defining alerts based on the detection of regular expressions within the logs, system administrators can easily identify, understand and solve network problems.

Wallix LogBox collects logs from various sources on the fly: operating systems, software, servers, network devices and so on. It natively integrates the most commonly-used transport protocols (Syslog, Unix/Linux, network devices via UDP, TCP or SSL, SNMP, LEA, SSH and SCP, FTP)

How does slapmonitor works

When enabled in a lamp software, SlapMonitor tracks the CPU / RAM usage of apache and mysql. While the apache instance and/or the mysql instance are running, the service store the CPU / RAM usage in a sqlite database. And if the service SlapReport is activated, logs are pushed (through ssh) to the LogBox server and all sent logs are marked as reported in the database so that they are not send again even if the connection fails.
Example of log:
2012-7-23 13:8:46 Instance mysqld Memory Consumption: 1.90925341346
2012-7-23 13:8:46 Instance mysqld CPU Consumption: CPU:0.0 CPU_TIME:1.87

How to configure a lamp software to send consumption log to logbox server

You need to configure your lamp software to push apache and mariadb consumption logs to logbox server.

First, you have to activate slapmonitor as a service by configuring the corresponding section in both stack/lamp/instance-apache-php.cfg and stack/lamp/instance-mariadb.cfg :

# Deploy slapmonitor
...stack/lamp/instance-apache-php.cfg
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/apache.pid
database-path = $${basedirectory:log}/slapmonitor.db
shell-path = ${dash:location}/bin/dash
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor

...stack/lamp/instance-mariadb.cfg
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/mariadb.pid
database-path = $${basedirectory:log}/slapmonitor.db
shell-path = ${dash:location}/bin/dash
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor
Restart your instance.

At this stage, your consumption log should be stored in a file named slapmonitor.db located in the log folder of the instance base-directory.

Now you can configure slapreport to push the consumtion log to an existing logbox server.

Configure the Wallix LogBox Server

Connect to your logbox server, go to the "Input section" and create an ssh input. Give a name to your "logbox input" and copy/past the public key of the user (slapuserXX) running the software (should be located in .../slapuserXX/.ssh, if not you have to create it).

Configure the Software Instance:

Edit the "slapreport" section in both stack/lamp/instance-apache-php.cfg and stack/lamp/instance-mariadb.cfg and indicate the ssh parameter of the logbox server:

...stack/lamp/instance-apache-php.cfg
[slapreport]
recipe = slapos.cookbook:slapreport
pid-file = $${basedirectory:run}/apache.pid
consumption-log-path = $${basedirectory:log}/instance_consumption.log
database-path = $${basedirectory:log}/slapmonitor.db
logbox-ip = 87.98.152.12
logbox-port = 5122
logbox-user = admin
logbox-passwd = passer
shell-path = ${dash:location}/bin/dash
slapreport-path = ${buildout:bin-directory}/slapreport
path = $${basedirectory:services}/slapreport

...stack/lamp/instance-mariadb.cfg
[slapreport]
recipe = slapos.cookbook:slapreport
pid-file = $${basedirectory:run}/apache.pid
consumption-log-path = $${basedirectory:log}/instance_consumption.log
database-path = $${basedirectory:log}/slapmonitor.db
logbox-ip = 87.98.152.12
logbox-port = 5122
logbox-user = admin
logbox-passwd = passer
shell-path = ${dash:location}/bin/dash
slapreport-path = ${buildout:bin-directory}/slapreport
path = $${basedirectory:services}/slapreport
Restart your instance.

Your consumption log should now be pushed to the logbox server. You can check by clicking the "display the logs" button of your "logbox input".

What is next

Coming soon...