Merge ~guoqiao/charm-nrpe:LP1915106-skip-unfound-ifaces into charm-nrpe:master

Proposed by Joe Guo
Status: Merged
Approved by: Joe Guo
Approved revision: 9010e2f4ad33a3e54c8fd57d02b37e28c18ef191
Merge reported by: Joe Guo
Merged at revision: 9010e2f4ad33a3e54c8fd57d02b37e28c18ef191
Proposed branch: ~guoqiao/charm-nrpe:LP1915106-skip-unfound-ifaces
Merge into: charm-nrpe:master
Diff against target: 35 lines (+8/-1)
2 files modified
config.yaml (+5/-0)
hooks/nrpe_helpers.py (+3/-1)
Reviewer Review Type Date Requested Status
Linda Guo (community) Approve
Xav Paice (community) Approve
Review via email: mp+398422@code.launchpad.net

Commit message

add --skip-unfound-ifaces to check_netlinks.py

Add an new boolean option `netlinks_skip_unfound_ifaces` in config.yaml.
When True, add --skip-unfound-ifaces to check_netlinks.py.

LP: #1915106

To post a comment you must log in.
Revision history for this message
Joe Guo (guoqiao) wrote :

tested locally, when netlink_skip_unfound_ifaces = True, the render result will be:

ubuntu@juju-5e35e2-0:/etc/nagios/nrpe.d$ cat check_netlinks_eth0.cfg
# Netlinks status (eth0) (sub)
command[check_netlinks_eth0]=/usr/local/lib/nagios/plugins/check_netlinks.py --skip-unfound-ifaces -i eth0 -m 9000 -s 25000

which is as expected.

Revision history for this message
Xav Paice (xavpaice) wrote :

lgtm

review: Approve
Revision history for this message
Linda Guo (lihuiguo) wrote :

looks good, +1

review: Approve
Revision history for this message
Joe Guo (guoqiao) wrote :

Merged into master as 9010e2f4ad33a3e54c8fd57d02b37e28c18ef191.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/config.yaml b/config.yaml
2index 2c9eefd..80cf9cf 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -146,6 +146,11 @@ options:
6 - bond0.25 mtu:1500 speed:50000
7 - ens3 mtu:1500 speed:-1 desc:openstack_iface
8 - ...
9+ netlinks_skip_unfound_ifaces:
10+ default: False
11+ type: boolean
12+ description: |
13+ add --skip-unfound-ifaces to check_netlinks.py.
14 monitors:
15 default: ''
16 type: string
17diff --git a/hooks/nrpe_helpers.py b/hooks/nrpe_helpers.py
18index cc63386..a8c4fde 100644
19--- a/hooks/nrpe_helpers.py
20+++ b/hooks/nrpe_helpers.py
21@@ -521,11 +521,13 @@ class SubordinateCheckDefinitions(dict):
22
23 if hookenv.config("netlinks"):
24 ifaces = yaml.safe_load(hookenv.config("netlinks"))
25+ cmd_exec = local_plugin_dir + "check_netlinks.py"
26+ if hookenv.config("netlinks_skip_unfound_ifaces"):
27+ cmd_exec += " --skip-unfound-ifaces"
28 d_ifaces = self.parse_netlinks(ifaces)
29 for iface in d_ifaces:
30 description = "Netlinks status ({})".format(iface)
31 cmd_name = "check_netlinks_{}".format(iface)
32- cmd_exec = local_plugin_dir + "check_netlinks.py"
33 cmd_params = d_ifaces[iface]
34 netlink_check = {
35 "description": description,

Subscribers

People subscribed via source and target branches

to all changes: