Merge ~aluria/charm-nagios:bug/1748430 into ~nagios-charmers/charm-nagios:master

Proposed by Alvaro Uria
Status: Merged
Approved by: Alvaro Uria
Approved revision: c84ee52568cb268b994fd0ec1691b9ea7c0ec972
Merged at revision: cdc4f2273440238b8c57aba1bf6eebde4489c8d1
Proposed branch: ~aluria/charm-nagios:bug/1748430
Merge into: ~nagios-charmers/charm-nagios:master
Diff against target: 55 lines (+8/-3)
2 files modified
hooks/templates/localhost_nagios2.cfg.tmpl (+6/-2)
hooks/upgrade-charm (+2/-1)
Reviewer Review Type Date Requested Status
Andrea Ieri Approve
Review via email: mp+363865@code.launchpad.net

Commit message

Nagios checks the rootfs on containers

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

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

Revision history for this message
Alvaro Uria (aluria) wrote :

Tested on "lxd" Juju provider and works as expected.

Revision history for this message
Andrea Ieri (aieri) wrote :

+1, but minor nitpick: I'd move whitespace fixes to a separate commit named something like "[trivial] whitespace fixes, noop"

review: Approve
Revision history for this message
Alvaro Uria (aluria) wrote :

FWIW, whitespace fixes happen automatically in my IDE C:-)

Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision cdc4f2273440238b8c57aba1bf6eebde4489c8d1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/hooks/templates/localhost_nagios2.cfg.tmpl b/hooks/templates/localhost_nagios2.cfg.tmpl
2index 85c756f..3cd69e1 100644
3--- a/hooks/templates/localhost_nagios2.cfg.tmpl
4+++ b/hooks/templates/localhost_nagios2.cfg.tmpl
5@@ -7,7 +7,7 @@
6 # This can serve as an example for configuring other servers;
7 # Custom services specific to this host are added here, but services
8 # defined in nagios2-common_services.cfg may also apply.
9-#
10+#
11
12 define host{
13 use generic-host ; Name of host template to use
14@@ -28,7 +28,11 @@ define service{
15 use generic-service ; Name of service template to use
16 host_name {{ nagios_hostname }}
17 service_description Disk Space
18+{%- if is_container %}
19+ check_command check_disk!20%!10%!/
20+{%- else %}
21 check_command check_all_disks!20%!10%
22+{%- endif %}
23 }
24
25
26@@ -58,7 +62,7 @@ define service{
27
28
29
30-# Define a service to check the load on the local machine.
31+# Define a service to check the load on the local machine.
32
33 define service{
34 use generic-service ; Name of service template to use
35diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
36index f9cd034..d52cee5 100755
37--- a/hooks/upgrade-charm
38+++ b/hooks/upgrade-charm
39@@ -260,6 +260,7 @@ def update_config():
40 'monitor_self': hookenv.config('monitor_self'),
41 'nagios_hostname': "{}-{}".format(host_context, local_host_name),
42 'load_monitor': hookenv.config('load_monitor'),
43+ 'is_container': host.is_container(),
44 }
45
46 with open('hooks/templates/nagios-cfg.tmpl', 'r') as f:
47@@ -357,7 +358,7 @@ update_cgi_config()
48 update_password('nagiosro', ro_password)
49 if password:
50 update_password('nagiosadmin', password)
51-
52+
53
54 subprocess.call(['hooks/mymonitors-relation-joined'])
55 subprocess.call(['hooks/monitors-relation-changed'])

Subscribers

People subscribed via source and target branches