Skip to content

Plugin to manage config via Icinga 2 api for Thruk (gui for nagios/icinga/naemon/shinken)

Notifications You must be signed in to change notification settings

stockholmuniversity/thruk-plugin-configeditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

## Configuration Editor Thruk Plugin for Icinga2

This plugin allows you to configure Icinga2 via the in built HTTP API.

This plugin is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

Dependencies for ubuntu 16.04 is: 
libcgi-pm-perl liblwp-protocol-https-perl
  
Install instructions:
cd plugins-available
git clone https://github.com/stockholmuniversity/thruk-plugin-configeditor.git configuration_editor

In order for the plugin to work it needs a config file in /etc/thruk/thruk_local.d/, e.g. /etc/thruk/thruk_local.d/icinga2_api.conf with the following example content:

icinga2_api_user = myuser
icinga2_api_password = secret
icinga2_api_realm = Icinga 2
icinga2_api_host = icinga.example.com
icinga2_api_port = 5665
icinga2_api_path = v1

If you want to get access to plugin actions from the action menu you can add this to thruk_local.conf:

<action_menu_apply>
    hostmenu    = .*;$             # matches all hosts only
    servicemenu = .*;.+$           # matches all services on all hosts
</action_menu_apply>

You also need two files in /etc/thruk/action_menus: servicemenu.json and hostmenu.json.

This is /etc/thruk/action_menus/servicemenu.json:

{
	"icon": "/thruk/themes/{{theme}}/images/dropdown.png",
	"title": "Service Menu",
	"menu": [{
		"icon": "/thruk/themes/{{theme}}/images/delete.png",
		"label": "Delete Service",
		"action": "/thruk/cgi-bin/api_conf.cgi?page_type=services&mode=delete&host=$HOSTNAME$&service=$SERVICEDESC$"
	}, {
		"icon": "/thruk/themes/{{theme}}/images/edit.png",
		"label": "Modify Service",
		"action": "/thruk/cgi-bin/api_conf.cgi?page_type=services&mode=modify&host=$HOSTNAME$&service=$SERVICEDESC$"
	}]
}

This is /etc/thruk/action_menus/hostmenu.json:

{
	"icon": "/thruk/themes/{{theme}}/images/dropdown.png",
	"title": "Host Menu",
	"menu": [{
		"icon": "/thruk/themes/{{theme}}/images/delete.png",
		"label": "Delete Host",
		"action": "/thruk/cgi-bin/api_conf.cgi?page_type=hosts&mode=delete&host=$HOSTNAME$"
	}, {
		"icon": "/thruk/themes/{{theme}}/images/add.png",
		"label": "Add Service to Host",
		"action": "/thruk/cgi-bin/api_conf.cgi?page_type=services&mode=create&host=$HOSTNAME$"
	}, {
		"icon": "/thruk/themes/{{theme}}/images/edit.png",
		"label": "Modify Host",
		"action": "/thruk/cgi-bin/api_conf.cgi?page_type=hosts&mode=modify&host=$HOSTNAME$"
	}]
}