Merge lp:~nick-moffitt/charm-helpers/nrpe-servicegroup-comments into lp:charm-helpers

Proposed by Nick Moffitt
Status: Merged
Merged at revision: 744
Proposed branch: lp:~nick-moffitt/charm-helpers/nrpe-servicegroup-comments
Merge into: lp:charm-helpers
Diff against target: 31 lines (+10/-0)
2 files modified
charmhelpers/contrib/charmsupport/nrpe.py (+7/-0)
tests/contrib/charmsupport/test_nrpe.py (+3/-0)
To merge this branch: bzr merge lp:~nick-moffitt/charm-helpers/nrpe-servicegroup-comments
Reviewer Review Type Date Requested Status
Barry Price Approve
Stuart Bishop (community) Approve
Review via email: mp+323326@code.launchpad.net

Description of the change

I'm working on better ways to collect nagios checks than the current rsync model, and right now that means as much info as possible goes into the nrpe configs. The result is that servicegroup data need to be written in specially-formatted comments in the nrpe.d config files, just before the alerts they describe.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

specially-formatted comments probably need a comment in nrpe.py explaining that they are specially-formatted, or someone will stomp you.

Otherwise, sure. I've done worse... but it would be nice if you could store this data somewhere else in a real format.

review: Approve
Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

Well, the whole goal is to make the nrpe configs the complete representation of what needs to be replicated. This allows us to monitor everything that can be monitored. Part of the goal of this is to increase coverage, while making something more rigorous and perfect for data definition is best left to the prometheus monitoring systems.

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

I'll add the warning though, as that's a good point.

740. By Nick Moffitt

Add a warning to the nrpe files

741. By Nick Moffitt

merge

742. By Nick Moffitt

Make the warning a bit stronger at barryprice's urging

Revision history for this message
Barry Price (barryprice) wrote :

Makes sense, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/charmsupport/nrpe.py'
2--- charmhelpers/contrib/charmsupport/nrpe.py 2017-03-30 05:30:11 +0000
3+++ charmhelpers/contrib/charmsupport/nrpe.py 2017-05-16 09:59:34 +0000
4@@ -193,6 +193,13 @@
5 nrpe_check_file = self._get_check_filename()
6 with open(nrpe_check_file, 'w') as nrpe_check_config:
7 nrpe_check_config.write("# check {}\n".format(self.shortname))
8+ if nagios_servicegroups:
9+ nrpe_check_config.write(
10+ "# The following header was added automatically by juju\n")
11+ nrpe_check_config.write(
12+ "# Modifying it will affect nagios monitoring and alerting\n")
13+ nrpe_check_config.write(
14+ "# servicegroups: {}\n".format(nagios_servicegroups))
15 nrpe_check_config.write("command[{}]={}\n".format(
16 self.command, self.check_cmd))
17
18
19=== modified file 'tests/contrib/charmsupport/test_nrpe.py'
20--- tests/contrib/charmsupport/test_nrpe.py 2017-03-30 05:30:11 +0000
21+++ tests/contrib/charmsupport/test_nrpe.py 2017-05-16 09:59:34 +0000
22@@ -159,6 +159,9 @@
23 """
24 expected = [
25 '# check myservice\n',
26+ '# The following header was added automatically by juju\n',
27+ '# Modifying it will affect nagios monitoring and alerting\n',
28+ '# servicegroups: a\n',
29 'command[check_myservice]=/usr/lib/nagios/plugins/check_http http://localhost\n',
30 service_file_contents,
31 ]

Subscribers

People subscribed via source and target branches