Skip to content

Tutorial ManagerClientConsole

sqall01 edited this page Oct 26, 2018 · 19 revisions

Tutorial - AlertR Manager Client Console

In this document a tutorial for the version 0.501 is given.

Table of Contents

Tutorial

Tutorial

This tutorial describes the basic configuration of the AlertR Manager Client Console. It can be used as foundation to develop an own AlertR system setup. This tutorial assumes you have set up the AlertR Server according to the provided Server Tutorial.

The client is described as the following by the installation:

sqall@towel:~$ python alertRinstaller.py -l

[...]
AlertR Manager Client Console
-----------------------------
Instance:
managerClientConsole

Type:
manager

Version:
0.400-1

Dependencies:
1: urwid (pip packet: urwid) (lowest version: 1.1.1)

Description:
This client is a manager client for the alert system. It shows the current state of all sensors, the sensor and alert clients and if the alert system is activated or not.
[...]

Installation

In order to install the AlertR Manager Client Console, we first have to fulfill all prerequisites. On a Debian/Ubuntu Linux you can install everything with the following commands:

root@towel:/home/sqall# apt-get install python-pip

root@towel:/home/sqall# pip install urwid

Afterwards, you can use the installation script provided by AlertR to install the client.

sqall@towel:~$ wget https://raw.githubusercontent.com/sqall01/alertR/master/alertRinstaller.py

sqall@towel:~$ mkdir managerClientConsole

sqall@towel:~$ python alertRinstaller.py -i managerClientConsole -t ./managerClientConsole/

Configuration

The following describes the configuration of the AlertR Manager Client Console. It shows a basic configuration that can be used as a template for own installations.

Certificate

For security reasons, the AlertR system enforces a TLS connection. During the installation of the AlertR server, you created a certificate file with the name alertr_server.crt. This file is needed by the client in order to verify the connection. Please copy it to the host you are installing this client on. This tutorial assumes that you have stored the certificate file in the following location: /home/sqall/managerClientConsole/config/alertr_server.crt.

User Credentials

The client has to authenticate itself before it can work with the server. Therefore, we need to set up user credentials on the AlertR server for this client. We execute the following command with the manageUsers.py script of the server which is located in the installation directory of the server (see Users Management for further information):

alertr@towel:/home/alertr/server# python manageUsers.py -a -u user_console -p password_console -t manager -i managerClientConsole

Please make sure that the AlertR Server is not running while adding a user.
Otherwise it can lead to an inconsistent state and a corrupted database.
Are you sure to continue?
(y/n): y

Configuration File

Every AlertR installation has a template configuration file with detailed comments that describe the functionality of each option. To use it as a draft, you can just copy the template file and modify your new configuration file.

sqall@towel:~/managerClientConsole/config$ cp config.xml.template config.xml

The configuration file itself is split into the following parts:

  • General
  • SMTP
  • Update
  • Manager

In this tutorial, we are going through each of these parts separately and describe why we configured it like that.

General

The general section is used for options such as certificate file location. In our tutorial configuration, the section looks like this:

	<general>

		<log
			file="/home/sqall/managerClientConsole/config/logfile.log"
			level="INFO" />

		<server
			host="localhost"
			port="44556"
			caFile="/home/sqall/managerClientConsole/config/alertr_server.crt" />

		<client
			certificateRequired="False"
			certFile="/absolute/path/to/client.crt"
			keyFile="/absolute/path/to/client.key" />

		<credentials
			username="user_console"
			password="password_console" />

		<connection
			persistent="False" />

	</general>

Section log is used to configure the log file setup. The file attribute sets the location for the log file. Please note that this has to be the absolute path to the location. Make sure it exists and is writable by the user that starts the AlertR client. Otherwise the client will not start. For example, the directory /var/log is usually only writable by the "root" user and users of the group "syslog". If you want the client log file in this directory, please create a sub-directory for the AlertR client log file and set the correct permissions on it. The level attribute sets the log level. Possible values are DEBUG, INFO, WARNING, ERROR, CRITICAL.

Section server is used to configure the server connection setup. The host and port attribute sets the address and port of the AlertR server. The port was previously configured in the server configuration file. The address can either be a name that can be resolved by the DNS system or an IP address. The caFile attribute sets the location of the certificate file that is used to authenticate the server (see Certificate). Please make sure that the location is an absolute path to the file.

Section client is used to configure the client connection setup. The certificateRequired attribute determines if the client needs a certificate to connect to the server or not. The certFile and keyFile are used to determine the client certificate and key file. Since this tutorial is not using client certificates, we do not have to set sane values here.

Section credentials is used to configure the login credentials of this client. The credentials were configured in a previous step of this Tutorial and must be the same as in this configuration file.

Section connection is used to configure the connection to the server. The persistent attribute is used to configure if the connection to the server has to be persistent. This means that if the client disconnects, a sensorAlert is created by the server.

SMTP

The smtp section is used for options that configure the used SMTP server. In our tutorial configuration, the section looks like this:

	<smtp>

		<general
			activated="True"
			fromAddr="managerClientConsole@alertr.de"
			toAddr="myalarmaddress@example.org" />

		<server
			host="127.0.0.1"
			port="25" />

	</smtp>

Section general is used to configure the basic options of the eMail notification. The eMail notification is used if problems on the AlertR client occur that can not be solved (like connection problems). The activated attribute determines if the eMail notification is activated or not. If it is deactivated, the rest of the options in the whole smtp section are ignored. The fromAddr attribute sets the used eMail address from which the eMail notification is sent. The toAddr attribute determines the eMail address the notification is sent to.

Section server is used to configure the SMTP server that is used to send the eMail notification. The host attribute sets the address and the port attribute sets the port of the used SMTP server. At the moment, only "127.0.0.1" is allowed as address and port 25. This means you have to set up a local SMTP server in order to send eMail notifications. Personally, I would suggest to set up a local Postfix SMTP server that can forward eMails like in this Tutorial. Please note that the local SMTP server has to accept eMails from localhost without any authentication since it is not supported by AlertR yet.

Update

The update section is used to give the online repository for updates. In our tutorial configuration, the section looks like this:

	<update>

		<server
			host="raw.githubusercontent.com"
			port="443"
			location="/sqall01/alertR/master/"
			caFile="/etc/ssl/certs/DigiCert_High_Assurance_EV_Root_CA.pem" />

	</update>

Section server is used to configure the remote update repository. Normally, the default configuration can be used here (which is this repository). The host attribute gives the remote server location of the repository. The port attribute gives the port on which the repository is reachable (AlertR uses HTTPS for it). The location attribute sets the location on the remote repository. The caFile attribute gives the local location of the certificate that is used to verify the HTTPS connection. The default value is the location on Debain/Ubuntu distributions of the current certificate that is used by Github.

Manager

The manager section configures special options of this client. In our tutorial configuration, the section looks like this:

	<manager>

		<general
			description="Console Manager Towel" />

		<console
			timeShowSensorAlert="3600"
			maxCountShowSensorAlert="3"
			maxCountShowSensorsPerPage="6"
			maxCountShowAlertsPerPage="2"
			maxCountShowManagersPerPage="4"
			maxCountShowAlertLevelsPerPage="3" />

	</manager>

The context has two main sections: general and console. The following describes the settings of each section.

Section general is used to configure the basic manager settings. The description attribute gives the description of this manager client.

Section console is used to configure the graphical properties of the console. The timeShowSensorAlert attribute sets the time in seconds that received sensorAlerts are displayed in a list before they are removed. The maxCountShowSensorAlert attribute sets the number of shown sensorAlerts in the list before the oldest is removed. The maxCountShowSensorsPerPage, maxCountShowAlertsPerPage, maxCountShowManagersPerPage, and maxCountShowAlertLevelsPerPage attributes sets the number of items (sensors, alerts, managers, and alertLevels) shown on a page.

Starting the Client

Since this client is used directly by the user, it has no autostart options. Just start the client directly.

sqall@towel:~/managerClientConsole$ ./alertRclient.py

The output should look something like this:

manager console screenshot

Troubleshooting

If you experience problems, please check the log file first. If it is not helpful, change the log level to DEBUG and check again.

If you still have problems and do not know how to solve them, you can ask on the community page on reddit or you can use the Github Issues.

Clone this wiki locally