From f6bd0ee9158de10e75011783c087171898705ad0 Mon Sep 17 00:00:00 2001 From: yayogev Date: Wed, 6 Sep 2017 20:17:57 +0300 Subject: US2925 add monitoring of host pNIC in OVS - check_interface.py: renamed to check_pnic_ovs.py - check_interface.py: check changed to use 'ip link show' command - monitor.py: handle check name where object type contains underscore, specifically 'host_pnic' - monitor.py: refactored to work as class - monitoring_pnic.py: changed to handle either OVS or VPP - monitoring_check_handler.py: change to allow defining hard-coded check_type string for file_type naming - monitoring config templates: removed default handler Change-Id: Iad38fa108e9ceae18a7c94b3570a8d9b836a8632 Signed-off-by: yayogev --- app/monitoring/setup/monitoring_check_handler.py | 3 ++- app/monitoring/setup/monitoring_pnic.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'app/monitoring/setup') diff --git a/app/monitoring/setup/monitoring_check_handler.py b/app/monitoring/setup/monitoring_check_handler.py index 1c9a013..c453439 100644 --- a/app/monitoring/setup/monitoring_check_handler.py +++ b/app/monitoring/setup/monitoring_check_handler.py @@ -25,7 +25,8 @@ class MonitoringCheckHandler(MonitoringHandler, SpecialCharConverter): host = self.inv.get_by_id(self.env, o['host']) if host and 'ip_address' in host: self.replacements['client_ip'] = host['ip_address'] - type_str = o['type'] if 'type' in o else 'link_' + o['link_type'] + type_str = values['check_type'] if 'check_type' in values else \ + (o['type'] if 'type' in o else 'link_' + o['link_type']) file_type = 'client_check_' + type_str + '.json' host = o['host'] sub_dir = '/host/' + host diff --git a/app/monitoring/setup/monitoring_pnic.py b/app/monitoring/setup/monitoring_pnic.py index fdc1c94..c1be96f 100644 --- a/app/monitoring/setup/monitoring_pnic.py +++ b/app/monitoring/setup/monitoring_pnic.py @@ -17,4 +17,11 @@ class MonitoringPnic(MonitoringSimpleObject): # add monitoring setup for remote host def create_setup(self, o): - self.setup('host_pnic', o) + type = 'host_pnic' + env_config = self.configuration.get_env_config() + vpp_or_ovs = 'vpp' if 'VPP' in env_config['mechanism_drivers'] \ + else 'ovs' + type_str = '{}_{}'.format(type, vpp_or_ovs) + self.setup(type, o, values={'check_type': type_str, + 'local_name': o['local_name']}) + -- cgit 1.2.3-korg