Feature #1180
nagios types should be able to generate /template definitions/ in nagios
| Status: | Accepted | Start date: | ||
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | nagios | |||
| Target version: | - | |||
| Affected Puppet version: | 0.24.7 | Branch: | ||
| Keywords: | ||||
| Votes: | 7 |
Description
I’ve been building a Nagios configuration with the new built-in types and just noticed that there seems to be no way to create template definitions in Nagios. I’ve only tried to do (nagios) templates with the nagios_host and nagios_service types but it’s likely to affect some of the others, if not all of the nagios types.
heres an example:
# template definition
define host {
name generic-host
contact_groups admins
}
# host definition that uses the template above
define host {
host_name foo
use generic-host
}
The problem with the nagios_host type is that the namevar is host_name and there’s no parameter called “name”
Same problem with nagios_server{}, except in that case the namevar is service_description.
In both cases, you need to leave the parameter that maps to the namevar out (which is impossible) and you need a parameter in the nagios config called ‘name’.
I don’t know how difficult this would be to implement but the ideal interface would be a template=>true parameter on the nagios types that changes service_description or host_name or whatever the namevar maps to to ‘name’.
History
Updated by Luke Kanies about 4 years ago
[edited by Luke]
An easy workaround is to put all of your template entries in a centralized file, and just dynamically generate the non-template entries.
Updated by ben potts about 4 years ago
Replying to [comment:1 luke]:
I’m willing to accept this ticket, but I’m never going to do the work on my own unless someone pays me to.
Makes sense. I wasn’t really expecting this to get done, just thought I’d create the ticket other people can see it and work on it or whatever if they want.
There’s a number of workarounds, I’m pretty happy with wrapping the nagios types in defines
Updated by Redmine Admin almost 4 years ago
- Status changed from 1 to Accepted
Updated by Sven Mueller about 3 years ago
- Affected Puppet version set to 0.24.7
Just for the record: Luke, can you tell me how much you would expect someone to pay for you to implement this? If you want, send it privately to puppet-enquiry@incase.de
Updated by James Turnbull almost 3 years ago
- Assignee deleted (
Puppet Community)
Updated by Christopher Weldon over 2 years ago
I see this hasn’t really been touched in almost a year. Are there any plans to implement this?
Updated by Benjamin Kite over 2 years ago
This might be simpler than it looks — since the “register” parameter basically indicates whether a resource is supposed to be a nagios template or not.
Unless I’m leaving something out, the name of the object can toggle between “name” and “host_name” (in the case of host templates) based on the value of “register”.
Updated by Tim Stoop about 2 years ago
Benjamin Kite wrote:
This might be simpler than it looks — since the “register” parameter basically indicates whether a resource is supposed to be a nagios template or not.
Unless I’m leaving something out, the name of the object can toggle between “name” and “host_name” (in the case of host templates) based on the value of “register”.
I’d agree with this assessment. It’s an easy and unambiguous solution, I believe. (I’m not a ruby nor puppet developer though, but I thought I’d chime in since I’m running into this problem right now.)
Updated by James Turnbull 9 months ago
- Target version deleted (
4)