OTRS and Nagios Integration

This post describes how to automate System Monitoring with OTRS and Nagios.

OTRS is an Open source Ticket Request used to manage customer telephone calls and e-mails. The system
supports network service, sales, pre-sales, internal IT, helpdesk etc. department to react quickly to inquiries.
Nagios is a system and network monitoring system that can be used to monitor many network services like
SMTP, HTTP etc… on remote hosts. It alerts the recipient groups when any system goes down or malfunctions.

OTRS is an Open source Ticket Request used to manage customer telephone calls and e-mails. The systemsupports network service, sales, pre-sales, internal IT, helpdesk etc. department to react quickly to inquiries.Nagios is a system and network monitoring system that can be used to monitor many network services likeSMTP, HTTP etc… on remote hosts. It alerts the recipient groups when any system goes down or malfunctions.

Requirements

  1. Running Instance of OTRS.
  2. Running Instance of Nagios.
  3. Latest release of SystemMonitoring Module.
  4. Mail Transfer Agent for communication between OTRS and Nagios.
  5. Following Perl Modules need to be present

Installing SystemMonitoring Module

In this example both OTRS and Nagios are installed on different machines.

Login to OTRS as Admin. Click on Admin Section and click “Package Manager”

 

Click on “Choose File” option on the left side of the Package Manager section. Select the SystemMonitoring-2.0.4.opm and click “Install”.

On successful installation “SystemMonitoring” appears on the “Local Repository section” of Package Manager.

Configuring OTRS

 

Select “Core::PostMaster” from the Results Section. Goto “PostMaster::PreFilterModule###00-SystemMonitoring”.

Set the following fields values to reflect your settings.

<FromAddressRegExp>

Only mails matching this <From:> address will be considered for Nagios Filter. One needs to adjust this setting to the from address the Nagios installation uses for outgoing mails.

Default: <‘nagios@mysystem.com’>

The default values (as shown below) should be suitable for a standard OTRS-Nagios integration for other fields.

 

Similarly select Nagios::Acknowledge

Set the following fields values to reflect your settings.

<Nagios::Acknowledge::Type> : Set this value to “Pipe”

For using the pipe mechanism Nagios and OTRS should use the same login names for agents. All agents which are working with OTRS have to be in the Nagios user database as well.

For creating users in Nagios run the following command

htpasswd /usr/local/nagios/etc/htpasswd.users <username>

Enter the password when prompted.

For creating users in OTRS, login as root go to Users Section and click Add Button

Set <Nagios::Acknowledge::HTTP::User> and <Nagios::Acknowledge::HTTP::Password >

The default values (as shown below) should be suitable for a standard OTRS-Nagios integration for other fields.

A combination of Host and Service is used to identify a message. In the case of a new failure OTRS automatically generates a new ticket from the e-mail. If there is an open ticket or a ticket in process which corresponds to the combination of Host and Service attributes, an update message of the monitoring system is attached to the existing ticket. If the ticket has been closed a new ticket is generated whenever a new failure occurs.

Configuring Nagios

 

Nagios uses contact objects to show to a user those things for which the user is listed as a contact person.

Make a contact definition entry for contact person. Make contact group definitions and put your contacts into one

or more groups for use in the hostgroup and services object definitions. To do this go to

“etc/objects/contacts.cfg” and add the following lines.

define contact

{

contact_name otrs@ibstest.com

contactgroups admins

use generic-contact

alias Postmaster

host_notification_period 24×7

service_notification_period 24×7

host_notification_options d,u,r,n

service_notification_options w,u,c,r,n

host_notification_commands notify-host-by-email

service_notification_commands notify-service-by-email

email otrs@xxx.com

}

define contactgroup

{

contactgroup_name admins

alias Nagios Administrators

 

members nagiosadmin,otrs@ibstest.com

}

Everything that Nagios does is defined in command objects. Nagios calls external programs via command

objects. To do this go to “etc/objects/contacts.cfg” and add the following lines.

define command

{

command_name check_otrs

command_line /opt/otrs/bin/otrs.NagiosCheck.pl -c $ARG1$ -N

}

define service

{

use generic-service

host_name xxx.xxx.com

service_description OTRS Number of Tickets

check_command check_otrs!

/opt/otrs/Kernel/Config/NagiosCheck.pm

}

define host

{

host_name xxx.xxx.com

use generic-host

alias Postmaster

address xxx.xxxx.xxx.xxx

max_check_attempts 4

checks_enabled 1

active_checks_enabled 1

passive_checks_enabled 1

check_interval 1

process_perf_data 0

retain_status_information 1

retain_nonstatus_information 1

notification_interval 1

contact_groups admins

notification_period 24×7

notification_options d,u,r

notifications_enabled 1

stalking_options o,d,u

}

Grant permission to the new users in Nagios. To do this go to “etc/objects/cgi.cfg” and set the following:

use_authentication=1

Add the users created in the following entries. Any number of users can be added separated by commas.

authorized_for_system_information

authorized_for_configuration_information

authorized_for_system_commands

authorized_for_all_services

authorized_for_all_hosts

authorized_for_all_service_commands

authorized_for_all_host_commands

Once configured restart Nagios and you can see the OTRS Service in Nagios.

To generate tickets in OTRS from the mails received set the following.

Configure POP3 in PostMaster Mail Account and click Run Now.

/opt/otrs/bin/PostMasterMailbox.pl

This will automatically generate tickets based on the System Monitoring Module Configuration.

Leave a comment

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a comment