Skip to content

Commit 3ec9db9

Browse files
author
Tomasz Cholewa
committed
Add first template and lld script for endpoints monitoring
1 parent 101d087 commit 3ec9db9

File tree

3 files changed

+198
-2
lines changed

3 files changed

+198
-2
lines changed

README.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
# zabbix-openstack
2-
Zabbix monitoring for OpenStack
1+
# Monitoring OpenStack with Zabbix
2+
3+
This repository contains zabbix resources for monitoring OpenStack environment.
4+
5+
# Features
6+
The following features are currently available:
7+
* Automatic endpoints discovery via keystone API
8+
* Endpoints monitoring with predefined triggers
9+
* Configuration using macros
10+
11+
# Installation
12+
* Install **python-keystoneclient** on you Zabbix server
13+
* Copy scripts from **server/externalscripts/** to your Zabbix server to **ExternalScripts** location
14+
* Import **templates/Template_OpenStack_Services.xml** template into your Zabbix server
15+
* Add OpenStack controller host (the one with Keystone component) to Zabbix and link **Template OpenStack Services** template to it
16+
17+
# Configuration
18+
Configure the following macros on the **controller host level** in Zabbix so that server could connect to keystone:
19+
* **{$OS_AUTHURL}** - OpenStack keystone auth url (*http://127.0.0.1:5000/v2.0* by default)
20+
* **{$OS_TENANT}** - OpenStack tenant name (*admin* by default)
21+
* **{$OS_USER}** - OpenStack user name (*admin* by default)
22+
* **{$OS_PASSWORD}** - OpenStack user password (*admin* by default)
23+
24+
# License
25+
This project is licensed under Apache License 2.0
26+
27+
# Contribute
28+
Feel free to test, break, experiment and contribute :-)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python
2+
3+
from keystoneclient.v2_0 import client as keystone_client
4+
from sys import exit
5+
from sys import argv
6+
from sys import stderr
7+
import json
8+
from datetime import datetime
9+
import re
10+
11+
12+
def get_host_port(url):
13+
m = re.match('https?://(\d+\.\d+\.\d+\.\d+):(\d+)',url)
14+
if m:
15+
return (m.group(1),m.group(2))
16+
17+
if __name__ == '__main__':
18+
19+
if (len(argv) != 5):
20+
print "Usage: %s AUTH_URL TENANT USERNAME PASSWORD" % argv[0]
21+
exit(2)
22+
else:
23+
(AUTH_URL,TENANT,USERNAME,PASSWORD) = argv[1:]
24+
25+
conn = keystone_client.Client(username=USERNAME, password=PASSWORD, tenant_name=TENANT, auth_url=AUTH_URL)
26+
27+
services = []
28+
for e in conn.endpoints.list():
29+
host = get_host_port(e.publicurl)
30+
if e.enabled:
31+
service = conn.services.get(e.service_id)
32+
services.append({'{#SERVICENAME}':service.name, '{#SERVICEURL}':e.publicurl, '{#SERVICEHOST}':host[0], '{#SERVICEPORT}':host[1] })
33+
34+
print json.dumps({'data':services},sort_keys=True,indent=7,separators=(',',':'))
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<zabbix_export>
3+
<version>2.0</version>
4+
<date>2015-06-03T11:22:07Z</date>
5+
<groups>
6+
<group>
7+
<name>Templates</name>
8+
</group>
9+
</groups>
10+
<templates>
11+
<template>
12+
<template>Template OpenStack Services</template>
13+
<name>Template OpenStack Services</name>
14+
<groups>
15+
<group>
16+
<name>Templates</name>
17+
</group>
18+
</groups>
19+
<applications>
20+
<application>
21+
<name>Openstack Endpoints</name>
22+
</application>
23+
</applications>
24+
<items/>
25+
<discovery_rules>
26+
<discovery_rule>
27+
<name>OpenStack Endpoints discovery</name>
28+
<type>10</type>
29+
<snmp_community/>
30+
<snmp_oid/>
31+
<key>openstack-endpoints-discovery[{$OS_AUTHURL},{$OS_TENANT},{$OS_USER},{$OS_PASSWORD}]</key>
32+
<delay>3600</delay>
33+
<status>0</status>
34+
<allowed_hosts/>
35+
<snmpv3_contextname/>
36+
<snmpv3_securityname/>
37+
<snmpv3_securitylevel>0</snmpv3_securitylevel>
38+
<snmpv3_authprotocol>0</snmpv3_authprotocol>
39+
<snmpv3_authpassphrase/>
40+
<snmpv3_privprotocol>0</snmpv3_privprotocol>
41+
<snmpv3_privpassphrase/>
42+
<delay_flex/>
43+
<params/>
44+
<ipmi_sensor/>
45+
<authtype>0</authtype>
46+
<username/>
47+
<password/>
48+
<publickey/>
49+
<privatekey/>
50+
<port/>
51+
<filter>:</filter>
52+
<lifetime>7</lifetime>
53+
<description/>
54+
<item_prototypes>
55+
<item_prototype>
56+
<name>Endpoint status of {#SERVICENAME} on host {#SERVICEHOST}</name>
57+
<type>0</type>
58+
<snmp_community/>
59+
<multiplier>0</multiplier>
60+
<snmp_oid/>
61+
<key>net.tcp.service.perf[http,{#SERVICEHOST},{#SERVICEPORT}]</key>
62+
<delay>60</delay>
63+
<history>90</history>
64+
<trends>365</trends>
65+
<status>0</status>
66+
<value_type>0</value_type>
67+
<allowed_hosts/>
68+
<units/>
69+
<delta>0</delta>
70+
<snmpv3_contextname/>
71+
<snmpv3_securityname/>
72+
<snmpv3_securitylevel>0</snmpv3_securitylevel>
73+
<snmpv3_authprotocol>0</snmpv3_authprotocol>
74+
<snmpv3_authpassphrase/>
75+
<snmpv3_privprotocol>0</snmpv3_privprotocol>
76+
<snmpv3_privpassphrase/>
77+
<formula>1</formula>
78+
<delay_flex/>
79+
<params/>
80+
<ipmi_sensor/>
81+
<data_type>0</data_type>
82+
<authtype>0</authtype>
83+
<username/>
84+
<password/>
85+
<publickey/>
86+
<privatekey/>
87+
<port/>
88+
<description/>
89+
<inventory_link>0</inventory_link>
90+
<applications>
91+
<application>
92+
<name>Openstack Endpoints</name>
93+
</application>
94+
</applications>
95+
<valuemap/>
96+
<logtimefmt/>
97+
</item_prototype>
98+
</item_prototypes>
99+
<trigger_prototypes>
100+
<trigger_prototype>
101+
<expression>{Template OpenStack Services:net.tcp.service.perf[http,{#SERVICEHOST},{#SERVICEPORT}].last(0)}=0</expression>
102+
<name>Endpoint of service {#SERVICENAME} on host {#SERVICEHOST} is unavailable</name>
103+
<url/>
104+
<status>0</status>
105+
<priority>3</priority>
106+
<description/>
107+
<type>0</type>
108+
</trigger_prototype>
109+
</trigger_prototypes>
110+
<graph_prototypes/>
111+
<host_prototypes/>
112+
</discovery_rule>
113+
</discovery_rules>
114+
<macros>
115+
<macro>
116+
<macro>{$OS_AUTHURL}</macro>
117+
<value>http://127.0.0.1:5000/v2.0</value>
118+
</macro>
119+
<macro>
120+
<macro>{$OS_PASSWORD}</macro>
121+
<value>admin</value>
122+
</macro>
123+
<macro>
124+
<macro>{$OS_TENANT}</macro>
125+
<value>admin</value>
126+
</macro>
127+
<macro>
128+
<macro>{$OS_USER}</macro>
129+
<value>admin</value>
130+
</macro>
131+
</macros>
132+
<templates/>
133+
<screens/>
134+
</template>
135+
</templates>
136+
</zabbix_export>

0 commit comments

Comments
 (0)