Nagios监控集成

名称itop-nagios-integration
版本1.0.0
发布日期2016-09-27
说明

集成Nagios页到iTop中,并通过Nagios创建工单

iTop版本要求(最低)2.0
关键词:nagiosmonitoring
代码:itop-config-mgmt
作者:Combodo
下载:http://www.combodo.com/itop-extensions/itop-nagios-integration-1.0.0-173.zip

非常老的扩展,采用过期的技术…

本页描述了两个主题:

  1. 显示(在一个单独的选项卡“监视”)生产中设备的监控状态(取自外部监控系统,如Nagios, CheckMK, Zabbix, Shinken……)的iTop扩展。

  2. 一个简单的命令行脚本,通过监控系统在iTop中创建事件工单

iTop的监控选项卡

特性

显示一个附加的“监控”选项卡,包含一个显示监控系统中的设备状态的IFRAME到(Nagios或其他类似)。这个额外的选项卡自动显示在所有的生产设备上。

版本历史

版本发布日期备注
1.0.02016-09-23第一版

限制

由于浏览器的安全规则,以下情况下,监控的内容iframe将不能在iTop中显示:

  • 使用HTTPS(安全)连接,而来自监控应用程序的页面则在HTTP协议(非安全),或

  • Nagios 网页服务器在DENY or SAMEORIGIN的情况下,HTTP X-Frame-Options头(参阅X帧选项定义获取更多信息)

该集成不关心对监控系统的认证。根据您的监控系统的配置,您可能需要进行身份验证,以便查看“监控”选项卡的内容。

要求

您必须有一个启动和运行的监控系统,提供了一个状态网页,可以通过监控的设备名称(或IP地址)作为URL参数,以一个“直接”的URL访问每个设备。

安装

把下载的.zip文件放到extensions文件夹(检查权限!),并且再次运行安装来选择这个新的扩展安装。

配置

该模块只需要两个参数:nagios_url 和target_classes。

参数类型用法默认值
nagios_urlString

显示设备nagios状态网页的URL。

在URL中的占位符 $this->name$会被配置项的名称替换。

https://nagios_server/cgi-bin/status.cgi?host=$this->name$
target_classesArray

显示“监控”选项卡的类列表。

指定类的子类也继承选项卡。

array('ConnectableCI')

target_classes必须是FunctionalCI派生的类,因为要根据这个代码查找CI。

例子

以下配置:

        'itop-nagios-integration' =>  (
                'nagios_url' => 'https://mynagios.mycompany.com/cgi-bin/status.cgi?host=$this->name$',
        ),

在服务器server4.demo.com的详细页面上,以一个额外的选项卡“监控”的方式,显示地址为https://mynagios.mycompany.com/cgi-bin/status.cgi?host=server4.demo.com的页面。

用法

导航到一个生产(status == production)设备查看设备的详细页中额外的“监控”选项卡。

编辑设备属性时,"监控"选项卡显示,因为在这个选项卡中没有去修改的内容。

通过Nagios服务器创建工单

  1. 在 创建工单脚本中挑选你使用最熟悉的脚本语言,并且在Nagios服务器中安装他的依赖

  2. 拷贝脚本到Nagios服务器中<你的文件夹>。不要忘记调整权限,以使脚本可以运行 (chmod +x <create-ticket-script>)

  3. 在Nagios命令文件(大多数情况下,以commands.cfg命名)中,定义一个新的Nagios命令

# Create incident tickets in iTop command definition
define command{
        command_name    create-iTop-ticket
        command_line    <yourDirectory>/<create-ticket-script> \"$HOSTNAME$\" \"$SERVICEDESC$\" \"$SERVICESTATE$\" \"$SERVICESTATETYPE$\"

}

<your_directory> 是拷贝脚本的目录,并且<create-ticket-script> 是create-ticket.php, create-ticket.py, create-ticket.pl 或者 create-ticket.bash其中一种。

步骤4:在事件处理程序选项中,对于应触发票证创建的每个主机或服务模板,使用以下命令:

大多数情况下,你可以在nagios.cfg中,使用以下选项全局定义所有主机或者服务:

global_host_event_handler=create-iTop-ticket
global_service_event_handler= create-iTop-ticket

或者对于每个主机或服务使用以下的选项:

event_handler   create-iTop-ticket
event_handler_enabled  1

如果你选择了后面的选项,将不得不为每个主机和服务模板配置。

完成后,下次在Nagios有一个HARD警告的话,它将自动在iTop中创建一个工单。

原文:https://www.itophub.io/wiki/page?id=extensions%3Anagios_integration


Nagios Integration

name:
itop-nagios-integration
version:
1.0.0
release:
2016-09-27
description:
Integration of a Nagios page in iTop and tickets creation from Nagios
itop-version:
2.0
keyword:
nagiosmonitoring
dependencies:
itop-config-mgmt
author:
Combodo
download:
http://www.combodo.com/itop-extensions/itop-nagios-integration-1.0.0-173.zip

Very old extension, using out of date technics…

This page describes two topics:

  1. A small iTop extension to display (in a separate tab “Monitoring”) the monitoring status of a device in production (taken from an external monitoring system like Nagios, CheckMK, Zabbix, Shinken…).

  2. A simple command line script to create an incident ticket in iTop from a monitoring system

Monitoring Tab in iTop

Features

Display an additional tab “Monitoring”, containing an IFRAME to the status of the device in the monitoring system (Nagios or equivalent). This extra tab is automatically displayed on all devices in production.

Revision History

VersionRelease DateComments
1.0.02016-09-23First version

Limitations

Because of the browser's security rules, the content of the Monitoring iframe will not display at all in iTop if either:

  • iTop uses an https (secure) connection whereas the pages from the monitoring application are served in http (non-secure), or

  • the Nagios web server populates the HTTP X-Frame-Options header with either DENY or SAMEORIGIN (refer to X-Frame-Options definition for more information)

The integration does not take care of the authentication to the Monitoring system. Depending on the configuration of your monitoring system, you may need to authenticate in order to see the content of the “Monitoring” tab.

Requirements

You must have an up and running monitoring system providing a status web page, per device, accessible via a “direct” URL with the name (or the IP address) of the monitored device as a parameter in the URL.

Installation

Put the content of the downloaded .zip into the extensions folder (check the rights !) and run the setup again to pick the new extension for installation.

Configuration

This module has only two parameters nagios_url and target_classes.

ParameterTypeUsageDefault value
nagios_urlStringURL to display the nagios status web page for the device. The placeholder $this->name$ in the URL is replaced by name of the CI.https://nagios_server/cgi-bin/status.cgi?host=$this->name$
target_classesArrayA list of classes for which to display the “Monitoring” tab. Child classes of the specificed classes also inherit the tab.array('ConnectableCI')

The target_classes must be classes derived from FunctionalCI, since the code looks for thestatus of the CI.

Example

The following configuration:

        'itop-nagios-integration' =>  (
                'nagios_url' => 'https://mynagios.mycompany.com/cgi-bin/status.cgi?host=$this->name$',
        ),

Will display the page at the location https://mynagios.mycompany.com/cgi-bin/status.cgi?host=server4.demo.com as an extra tab “Moniting” in the details of the Server server4.demo.com.

Usage

Navigate to a device in production (status == production) to see the extra “Monitoring” tab in the details of the device.

The “Monitoring” tab is not displayed when editing the properties of the device, since there is nothing to modify inside this tab.

Creating a ticket from the Nagios server

  1. Pick the create-ticket-script script in your favorite scripting language and install its dependencies on the Nagios server

  2. Copy this script in <yourDirectory> on the Nagios server. Don't forget to adjust the rights and mark the script as executable (chmod +x <create-ticket-script>)

  3. Define a new Nagios command by adding following to your Nagios command file (most of the time it is called commands.cfg)

# Create incident tickets in iTop command definition 
define command{ 
        command_name    create-iTop-ticket 
        command_line    <yourDirectory>/<create-ticket-script> \"$HOSTNAME$\" \"$SERVICEDESC$\" \"$SERVICESTATE$\" \"$SERVICESTATETYPE$\"

where <your_directory> is the path where you copied the script and <create-ticket-script> is either create-ticket.php, create-ticket.py, create-ticket.pl orcreate-ticket.bash.

Step 4: Use this command in an event handler option for each host or service template that should trigger a ticket creation:

You can define it globally for all hosts and services using following options defined most of the time in nagios.cfg:

global_host_event_handler=create-iTop-ticket
global_service_event_handler= create-iTop-ticket

Or for each host and services using following options:

event_handler   create-iTop-ticket
event_handler_enabled  1

if you choose the latter option, you will have to configure the handler for each host and service templates you create.

Once done, next time you will have a HARD alarm in Nagios it will create a ticket automatically in iTop !

 

标签:
由 superadmin 在 2020/08/27, 16:14 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司