Configure NTP check on controllers

The check verifies that the ntpd process listens on port 123 on the
vrouter network namespace.

Related-bug: #1513454

Change-Id: I45b2257dd584972a26643bf6f8cb34c4983be6e0
This commit is contained in:
Swann Croiset 2015-11-07 14:08:52 +01:00
parent 9ab8c4ef82
commit 7f3c3ecc74
5 changed files with 135 additions and 1 deletions

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2014-12-11T12:21:22Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template OS Controller</template>
<name>Template OS Controller</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Core Services</name>
</application>
</applications>
<items>
<item>
<name>NTP Server is listening on port</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>netns.udp.listen[vrouter,123]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Core Services</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules />
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template OS Controller:netns.udp.listen[vrouter,123].last(0)}=0</expression>
<name>NTP Server service is down on {HOST.NAME}</name>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
<graphs/>
</zabbix_export>

View File

@ -0,0 +1,31 @@
#!/bin/bash
PROTO=$1
NS=$2
PORT=$3
IP=$4
if test -z "$NS"; then
echo 0
exit 1
fi
if test -z "$PROTO" -o -z "$PORT"; then
echo 0
exit 1
fi
if [ -n "$IP" ]; then
ADDRESS="$PROTO""@""$IP:$PORT"
else
ADDRESS="$PROTO"":$PORT"
fi
num=$(/bin/ip netns exec "$NS" /usr/bin/lsof -i"$ADDRESS" 2>/dev/null|wc -l)
if [ "$num" -gt 0 ]; then
echo 1
else
echo 0
fi
exit 0

View File

@ -3,3 +3,4 @@ zabbix ALL = NOPASSWD: /usr/bin/socat /var/lib/haproxy/stats stdio
zabbix ALL = NOPASSWD: /usr/sbin/iptstate
zabbix ALL = NOPASSWD: /usr/sbin/crm_resource --locate --quiet --resource *
zabbix ALL = NOPASSWD: /usr/bin/ceph health
zabbix ALL = NOPASSWD: /etc/zabbix/scripts/netns.listen.sh

View File

@ -77,6 +77,9 @@ class plugin_zabbix::monitoring(
'crm.node.check':
key => 'crm.node.check[*]',
command => '/etc/zabbix/scripts/crm_node_check.sh $1';
'netns.udp.listen':
key => 'netns.udp.listen[*]',
command => '/usr/bin/sudo /etc/zabbix/scripts/netns.listen.sh UDP $1 $2 $3';
}
#Linux
@ -86,13 +89,19 @@ class plugin_zabbix::monitoring(
api => $api_hash,
}
if ! member($roles, 'controller') or ! member($roles, 'primary-controller') {
if ! member($roles, 'controller') and ! member($roles, 'primary-controller') {
# default way to check NTP binding
plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template NTP binding":
host => $plugin_zabbix::params::host_name,
template => 'Template NTP binding',
api => $api_hash,
}
}else{
plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template OS Controller":
host => $plugin_zabbix::params::host_name,
template => 'Template OS Controller',
api => $api_hash,
}
}
#Zabbix Agent

View File

@ -56,6 +56,12 @@ class plugin_zabbix::server::config {
api => $api_hash,
}
plugin_zabbix_configuration_import { 'Template_OS_Controller Import':
ensure => present,
xml_file => '/etc/zabbix/import/Template_OS_Controller.xml',
api => $api_hash,
}
# Nova templates
plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API_EC2.xml Import':
ensure => present,