Application Monitoring with openITCOCKPIT
Velocity Sensor
OpenITCOCKPIT [1] is an open source framework based on the modular Naemon monitoring suite that allows deep insights into applications and IT processes, in addition to infrastructure monitoring. It can be combined with tools for ticketing, change management, and IT documentation.
A commercial version of openITCOCKPIT is available if you need to implement advanced monitoring, such as event correlation or SAP systems monitoring. In this article, we will use the free version of openITCOCKPIT [2].
Basic Installation
In our example, we will install openITCOCKPIT without a cluster connection, but with all front-end modules (see the "System Requirements" box). We recommend Naemon for the installation (root privileges needed) and the operation, but Nagios is also supported.
Because openITCOCKPIT can be installed using the Apt package manager, the first step is to enter the repository and then retrieve the key:
$ echo 'deb https://apt.open-itcockpit.com trusty main' > /etc/apt/sources.list.d/openitcockpit.list
Alternatively, you can enter:
$ add-apt-repository 'deb https://apt.open-itcockpit.com trusty main'
To get the latest packages, you can specify nightly
in addition to the trusty
option:
$ apt-key adv --recv --keyserver hkp://keyserver.ubuntu.com A7D3EAFA
Now, an update is needed to read the new repositories:
$ apt-get update $ apt-get install openitcockpit{,-naemon,-statusengine-naemon,-npcd}
You do not need to select any options to query the configuration, because Nginx already exists. Then, start the configuration with:
$ /usr/share/openitcockpit/app/SETUP.sh
The update to the latest version is then the final step.
During setup, the user or users are created that are permitted to log on locally to openITCOCKPIT. After setup, these details can only be changed on the front end; the credentials cannot otherwise be changed and viewed. When updating, you also create an initial backup of the data input. After the update command openitcockpit update
, the installation is complete and you can turn to the front end.
Monitoring Dashboard
To begin, log in with the user account that you created during the setup. You are now looking at the monitoring dashboard (Figure 1). By default, it displays hosts, services, and scheduled downtime at a glance. Additional graphics can be inserted (e.g., charts or complex maps) by clicking the Add Widget button and new tabs by pressing the plus sign.
After logging in, you also should visit the Administration | Debugging page, which includes information about the current version of openITCOCKPIT, active processes, the openITCOCKPIT server's IP address, memory usage, and an overview of individual worker queues.
In the open source version of openITCOCKPIT, some modules are unlocked from the outset. If you purchased the Enterprise version, enter the supplied license key in the Administration | Registration item. The modules you purchased are then released for installation. You can then install them using the Administration | Package Manager. It is important to run the openitcockpit-update
command on the back end after each individual packet installation. The complete version contains the modules check_ nrpe (always available by default), AutoreportModule, MKModule (for check_mk
), DistributeModule, MapModule, IdoitModule, and EventcorrelationModule. After installing and updating, the individual modules appear on the left in the menu structure.
You have two options to create a user: Either set up local users or import users from LDAP if you have a directory in place. This is done below Administration | System Settings, where the access credentials and addresses are stored.
Every user can be assigned to a user group, and you can assign different parameters to the groups – for example, whether certain maps may be accessed. The Administration | Manage User Roles item contains two predefined standard roles. It is important that the permissions are adjusted after installing a new module, so you still see all the modules as the administrator.
The next step is to create the hosts, for which you need to change from Basic Monitoring | Hosts to New in the menu. In the window, define the data for the container in which you want the host to reside. It is important to select a host template. Such a template is made available by default, but you can create any number of them. It may be necessary (e.g., for ESX) to select other settings than for Exchange Server. In Basic configuration, specify only information about the host itself and the type of notifications; under Expert settings, you can make a selection in the Checkcommand drop-down (Figure 2). You specify what exactly is to be verified, as well as the applicable thresholds, and when the status is critical. Here, you also define how often to go through a check before it transitions from a soft state to a hard state.
Setting Up Monitoring Services
In the next step, you will be setting up the services, true to the motto "One service for each host." Here, you define what openITCOCKPIT monitors on the host and how. As for the hosts, you can generate service templates up front or edit the existing ones. This has the advantage that you no longer need to enter the notification settings and checks by hand.
To monitor larger IT environments comfortably, openITCOCKPIT offers service template groups. As a result, identical hosts do not need to be provided manually with the same checks. To accomplish this, you create a new service template group, by selecting the container in which the predefined service templates reside; then, add as many service templates as you like to the group. In the next step, you can assign a host or whole host groups to the group. Because openITCOCKPIT currently only lets you drag service template groups onto hosts/host groups, we recommend waiting with this step until all the hosts have been created. If you retroactively add a new host, you have to perform an allocation again. A pull method is on the openITCOCKPIT roadmap and is already in development.
Using the Shell, Macros, and Maps
The Basic Monitoring | Commands item lets you edit the command line and customize it to suit your needs. The commands are divided into four categories: Service, Host, Notification, and Event. Additionally, you can define arguments here and test commands in the integrated shell. The shell gives you direct access to the openITCOCKPIT back end and executes all commands as the Nagios user. Tip: You can edit the macros used in the commands (e.g., $USER$
) under Expert Monitoring | User Defined Macros.
We recommend using macros in openITCOCKPIT, which can save you a huge amount of time and does not hard code security-relevant data into commands. Because the admin login data on many of the hosts are identical in most IT departments, the values can be stored here and the macros then used for the individual checks. Thus, you do not have to change all the checks or commands manually after a password change.
Maps are a neat approach to visualizing IT environments and services and availability of applications in a clear-cut way. To do this, add a map in the Maps module and then edit the map in the editor. You can upload a background image and add various gadgets, items, or icons by simply dragging and dropping on the map. After positioning, a pop-up window appears, where you can set the host and the service to be monitored. The various visualizations of a system landscape, from single red-green maps to huge graphical landscapes, can be created. A widget also lets you integrate maps into in the dashboard on the homepage.
Monitoring a MS SQL Database
To set up database monitoring, you first need to consider what plugin to use. After all, you have a variety of ways to handle monitoring and therefore many plugins that can accomplish the task.
In our example, we used the check_mssql_ health
plugin by ConSol Labs, because it can read and monitor a large amount of information from a Microsoft SQL database out of the box. For installation instructions, a download link, and information about the use of the plugin, visit the ConSol labs website [3].
If you install the plugin on the openITCOCKPIT system according to the installation instructions, it will be available in the /opt/openitc/nagios/libexec
folder. Now you can remotely monitor a variety of information from the database, as long as the database management system is available at the port you use and you set up a user with the appropriate permissions in the database.
As a first step, you will always want to test a plugin in the openITCOCKPIT shell, so you can make sure it is working correctly, the database is accessible, and you have sufficient access permissions in place. For help, enter
./check_mssql_health --help
to get a detailed description of the plugin and sample queries on the ConSol Labs website.
We used the following query to test whether the database is accessible, whether the user has sufficient permissions to access the database, and how long it takes:
$ ./check_mssql_health --hostname <hostname> --username <username> --password <password> --port <port> --commit --mode connection-time --warning <warning> --critical <critical>
The output for the query relating to the connection time is: OK - 0.96 seconds to connect as user | connection_time=0.96;1;5.
The query can be made without specifying threshold values for warning
and critical
because the plugin applies default threshold values (in this case 1 for warning and 5 for critical). If the plugin is usable in the openITCOCKPIT shell and you are familiar with its various query and monitoring capabilities, you can adopt the check as a command in the front end of openITCOCKPIT.
In openITCOCKPIT, you create a new command in the Basic monitoring | Commands section by pressing the +New button. Depending on the desired query and monitoring, it might make sense to create a number of commands. You can use them flexibly for various databases (hostname, port, user, password, mode, thresholds, etc.) through the use of variable arguments ($ARG1$
, $ARG2$
, etc.). You define what kind of a command it is: service check, host check, notification, or event handler.
In our case, it is a service check, because we want to use the command in services and service templates. The name can be changed freely, but we recommend putting some thought into naming to ensure greater clarity – many commands can be used in large environments, and a carefully considered nomenclature pays dividends.
The Command line section contains the command that is called later by the service in the openITCOCKPIT server's shell and hands over the appropriate output to the service. To keep things clear-cut and flexible, you should use as many variables (i.e., $USER1$
, $HOSTADDRESS$
, $_HOSTMSSQLINFO$
, $ARG1$
, etc.) as possible or as necessary. $USER1$
is a user-defined macro and contains the path in the shell to the directory that contains the plugins (/opt/openitc/nagios/libexec
). In the openITCOCKPIT front end, the macros are created and defined in the Expert Monitoring | User Defined Macros section.
$HOSTADDRESS$
is a standard Nagios macro and contains the IP address of each host on which the service will be used later. The $_HOSTMSSQLINFO$
variable is a host macro that can be created and defined in the respective host settings of the expert section. In our case, this variable contains information about the port, username, and password of the database host. In this way, a service created later can be used without adaptation on various database hosts.
Under Description, enter an appropriate description for the command. In the Argument section, type an intuitive description of each argument ($ARG1$
, $ARG2$
, etc.) that is available in the service and service template created later, which very much simplifies the task of defining values for each variable. In the Command Shell at the end of the dialog, you can test the available plugin, without having to connect to the server. After creating the command, you now need to set up a service template for the desired query.
Creating a Service Template
You should create a separate service template for each monitor. A large number of service templates may come together, depending on the capabilities of the plugins and the desired monitoring.
You create new service templates in the Basic Monitoring | Service Templates field by pressing the +New button. To continue, you first define the container that will hold the service template. You can use the container structure to define who has what kind of access to which objects in openITCOCKPIT.
Objects in the root container are available by default to all users, which makes sense for the service templates, because you do not want to create them twice. You can choose the template name, but you determine this in advance, because larger environments use very many templates.
To assign a description, at least the following areas should be filled Notification period, Notification interval, the status message, graphing, and the active checks. For reasons of space, we cannot give a detailed description of the individual items here.
In the Expert settings tab, define the values for the arguments to be passed in to the command as defaults. These values can later be customized for every service that is used on any other host. Here, you also can see the intuitive descriptions of the variables that you defined in the command.
Service Template and Host Groups
To facilitate a subsequent service template roll-out, it is useful to group all service templates and all hosts for a specific monitoring scenario in service template groups and host groups. To do so, you first must add one or more new Microsoft SQL servers to the MSSQL_ALL host group only and assign the service template group to the hostgroup with the Allocate hostgroup selection item – the services included in the service template group are now assigned to all hosts in one fell swoop.
Pressing the Refresh Configuration Monitoring button (top right next to the system clock) applies any customizations to your monitoring configuration in openITCOCKPIT and enables monitoring – our Microsoft SQL database is now monitored by openITCOCKPIT. We have thus taken the first step in application monitoring.
Conclusions
Availability monitoring is not rocket science and can be achieved with free open source tools like openITCOCKPIT, which lets you monitor all applications and application landscapes. In this way, IT managers have a handy tool that tells them exactly where in the IT landscape something is going wrong.