Skip to content

Commit 82c02ae

Browse files
committed
Updates to work with Zabbix 2.4 and Openstack Juno
1 parent 1c30ef1 commit 82c02ae

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

server/externalscripts/openstack-discovery

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ import re
1212
try:
1313
from keystoneclient.v2_0 import client as keystone_client
1414
from keystoneclient.auth.identity import v2
15-
from keystoneclient import session
16-
from novaclient import client as nova_client
15+
from novaclient import client
1716
except ImportError:
1817
print 'ZBX_NOTSUPPORTED\x00 Failed to import openstack python modules'
1918
exit(1)
2019

2120
def get_host_port(url):
22-
m = re.match('https?://(\d+\.\d+\.\d+\.\d+):(\d+)',url)
21+
m = re.match('htt.?://(.*):(\d+)',url)
2322
if m:
2423
return (m.group(1),m.group(2))
2524

@@ -39,10 +38,7 @@ def discover_endpoints(auth_url, tenant_name, username, password):
3938
print_json(services)
4039

4140
def discover_hypervisors(auth_url, tenant_name, username, password):
42-
auth = v2.Password(username=username, password=password, tenant_name=tenant_name, auth_url=auth_url)
43-
sess = session.Session(auth=auth)
44-
45-
conn = nova_client.Client(2, session=sess)
41+
conn = nova = client.Client(2, username, password, tenant_name, auth_url)
4642

4743
hypervisors = []
4844
for h in conn.hypervisors.list(detailed=True):

templates/Template_OpenStack.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<type>10</type>
3535
<snmp_community/>
3636
<snmp_oid/>
37-
<key>openstack-discovery[hypervisors,{$OS_AUTHURL},{$OS_TENANT},{$OS_USER},{$OS_PASSWORD}]</key>
37+
<key>openstack-discovery["hypervisors","{$OS_AUTHURL}","{$OS_TENANT}","{$OS_USER}","{$OS_PASSWORD}"]</key>
3838
<delay>3600</delay>
3939
<status>0</status>
4040
<allowed_hosts/>
@@ -90,7 +90,7 @@
9090
<type>10</type>
9191
<snmp_community/>
9292
<snmp_oid/>
93-
<key>openstack-discovery[endpoints,{$OS_AUTHURL},{$OS_TENANT},{$OS_USER},{$OS_PASSWORD}]</key>
93+
<key>openstack-discovery["endpoints","{$OS_AUTHURL}","{$OS_TENANT}","{$OS_USER}","{$OS_PASSWORD}"]</key>
9494
<delay>3600</delay>
9595
<status>0</status>
9696
<allowed_hosts/>

0 commit comments

Comments
 (0)