Modify

Ticket #1160 (closed enhancement: fixed)

Opened 7 years ago

Last modified 7 years ago

Enhancement to NagiosGen plugin

Reported by: https://www.google.com/accounts/o8/id?id=AItOawnQrJGA5cTPlSuMy-jZCtsSBGfqOtNfvzQ Owned by: desai
Priority: minor Milestone: Bcfg2 1.4.0 Release
Component: bcfg2-server Version: 1.0
Keywords: NagiosGen Cc:

Description

it would be useful to add bundle support to the NagiosPlugin?, in the sense of using both groups and bundle to build the nagios host groups. We use bundle to handle service like ssh,http ... and we have matching monitoring probes in nagios. I'll comme up with a patch once I get it to work nicely.

Attachments

NagiosGen.patch (1.4 KB) - added by https://www.google.com/accounts/o8/id?id=AItOawnQrJGA5cTPlSuMy-jZCtsSBGfqOtNfvzQ 7 years ago.
patch file since the web stuff seems scrambled.

Change History

comment:1 Changed 7 years ago by https://www.google.com/accounts/o8/id?id=AItOawnQrJGA5cTPlSuMy-jZCtsSBGfqOtNfvzQ

Patch to add bundle support: --- Downloads/bcfg2-1.3.5/src/lib/Bcfg2/Server/Plugins/NagiosGen.py 2014-10-27 14:55:39.000000000 +0100 +++ NagiosGen?.py 2014-10-29 18:22:18.000000000 +0100 @@ -49,9 +49,9 @@

raise Bcfg2.Server.Plugin.PluginExecutionError?

host_groups = [grp for grp in metadata.groups

if os.path.isfile('%s/%s-group.cfg' % (self.data, grp))]

  • host_groups.append([bundle for bundle in metadata.bundles
  • if os.path.isfile('%s/%s-bundle.cfg' % (self.data, bundle))])

- + bundle_groups = [grp for grp in metadata.bundles + if os.path.isfile('%s/%s-bundle.cfg' % (self.data, grp))] + host_groups = bundle_groups + host_groups

host_config = ['define host {',

self.line_fmt % ('host_name', metadata.hostname), self.line_fmt % ('alias', metadata.hostname),

@@ -87,7 +87,8 @@

def createserverconfig(self, entry, _):

"""Build monolithic server configuration file.""" host_configs = glob.glob(os.path.join(self.data, '*-host.cfg'))

  • group_configs = glob.glob(os.path.join(self.data, '*-group.cfg'))

+ group_configs = glob.glob(os.path.join(self.data, '*-group.cfg')) + glob.glob(os.path.join(self.data, '*-bundle.cfg')) +

host_data = [] group_data = [] for host in host_configs:

This allow you to create host groups based on both bcf2's group and bundle

Changed 7 years ago by https://www.google.com/accounts/o8/id?id=AItOawnQrJGA5cTPlSuMy-jZCtsSBGfqOtNfvzQ

patch file since the web stuff seems scrambled.

comment:2 Changed 7 years ago by solj

  • Status changed from new to closed
  • Resolution set to fixed

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.