Merge ~pjdc/ubuntu-mirror-charm/+git/ubuntu-mirror-charm:remove-critical-servicegroup-handling into ubuntu-mirror-charm:master

Proposed by Paul Collins
Status: Merged
Approved by: Thomas Cuthbert
Approved revision: 2759503d401c056985fed7dcf76e103ddbdc7edd
Merged at revision: 449e0fa23706c13141f1f361938ec4bb6630a8a6
Proposed branch: ~pjdc/ubuntu-mirror-charm/+git/ubuntu-mirror-charm:remove-critical-servicegroup-handling
Merge into: ubuntu-mirror-charm:master
Diff against target: 89 lines (+8/-20)
3 files modified
config.yaml (+0/-4)
hooks/Config.py (+0/-3)
hooks/hooks.py (+8/-13)
Reviewer Review Type Date Requested Status
Thomas Cuthbert (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+381085@code.launchpad.net

Commit message

remove nagios_critical_servicegroup etc. - we now manage this completely via nagios and nagiprom

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Thomas Cuthbert (tcuthbert) wrote :

LGTM +!

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 449e0fa23706c13141f1f361938ec4bb6630a8a6

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 bd8370e..3413e3c 100644
3--- a/config.yaml
4+++ b/config.yaml
5@@ -447,10 +447,6 @@ options:
6 default: ""
7 type: string
8 description: "If set, this is the Nagios servicegroup for alerts. If unset, an appropriate one will be chosen"
9- nagios_critical_servicegroup:
10- default: ""
11- type: string
12- description: "If set, this is an additional Nagios servicegroup for critical alerts."
13 package_status:
14 default: "install"
15 type: "string"
16diff --git a/hooks/Config.py b/hooks/Config.py
17index 80afdc9..60c9928 100755
18--- a/hooks/Config.py
19+++ b/hooks/Config.py
20@@ -160,9 +160,6 @@ class Config:
21 raise KeyError
22 return mirror_userinfo
23
24- def nagios_critical_servicegroup(self):
25- return str(config("nagios_critical_servicegroup"))
26-
27 def nagios_host_context(self):
28 return self.relation_data()["nagios_host_context"]
29
30diff --git a/hooks/hooks.py b/hooks/hooks.py
31index b95c327..93b4229 100755
32--- a/hooks/hooks.py
33+++ b/hooks/hooks.py
34@@ -570,14 +570,12 @@ def configure_nrpe():
35 nagios_etcdir = "/etc/nagios/nrpe.d"
36 nagios_exportdir = "/var/lib/nagios/export"
37
38- role_checks = {"check_virthost": {"desc": "Check apache virthost",
39- "type": "normal"},
40- "check_mirror": {"desc": "GPG signature",
41- "type": "critical"},
42- "check_updates": {"desc": "Mirror update status",
43- "type": "normal"},
44- "check_rsync": {"desc": "Rsync processes",
45- "type": "normal"}}
46+ role_checks = {
47+ "check_virthost": {"desc": "Check apache virthost"},
48+ "check_mirror": {"desc": "GPG signature"},
49+ "check_updates": {"desc": "Mirror update status"},
50+ "check_rsync": {"desc": "Rsync processes"}
51+ }
52
53 # No nagios dirs probably means no nagios, so don't bother with the rest
54 if not (os.path.isdir(nagios_etcdir) and os.path.isdir(nagios_exportdir)):
55@@ -625,9 +623,6 @@ def configure_nrpe():
56 tmpl_data["description"] = "%s for %s on %s" % (check_details["desc"], mirror["name"], hostname)
57 tmpl_data["check_command"] = "check_nrpe!%s_%s" % (check, mirror["name"])
58 tmpl_data["servicegroup"] = conf.nagios_servicegroup()
59- if check_details["type"] == "critical":
60- if conf.nagios_critical_servicegroup():
61- tmpl_data["servicegroup"] += ", " + conf.nagios_critical_servicegroup()
62 checkfile = "service__%s_%s_%s.cfg" % (conf.nagios_hostname(), check, mirror["name"])
63 configpath = os.path.join(nagios_exportdir, checkfile)
64 tmplfile = "nagios-config.tmpl"
65@@ -672,7 +667,7 @@ def configure_nrpe():
66 tmpl_data["nagios_hostname"] = conf.nagios_hostname()
67 tmpl_data["description"] = "Disk space on /srv"
68 tmpl_data["check_command"] = "check_nrpe!check_disk_srv"
69- tmpl_data["servicegroup"] = conf.nagios_critical_servicegroup()
70+ tmpl_data["servicegroup"] = conf.nagios_servicegroup()
71 tmplfile = "nagios-config.tmpl"
72 file_from_template(tmplfile, configpath, tmpl_data)
73
74@@ -722,7 +717,6 @@ def configure_extra_mirrors():
75 settings["parent_unit_name"] = local_unit()
76 if conf.nagios_relation_ok():
77 settings["nagios_servicegroup"] = conf.nagios_servicegroup()
78- settings["nagios_critical_servicegroup"] = conf.nagios_critical_servicegroup()
79 # Base64 everything
80 encoded = {}
81 for d in settings:
82@@ -780,6 +774,7 @@ def configure_user():
83 if not os.path.isdir(mirror_userinfo.pw_dir):
84 mkdir(mirror_userinfo.pw_dir, owner=conf.mirror_user())
85
86+
87 def configure_directories():
88 if not os.path.isdir("/srv/ftp.root"):
89 mkdir("/srv/ftp.root")

Subscribers

People subscribed via source and target branches