New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dev.icinga.com #11976] Assign for #285
Comments
Updated by tgelf on 2016-06-17 19:44:08 +00:00 Time ago I was planning an Assign for implementation for Director and then stopped doing so as for users working with the GUI only there is no benefit in using "apply for" over "adding single services to the host". However, it would help people doing automation, importing hosts with a bunch of custom vars. As apply for rules easily tend to get pretty complicated I had however no good idea on how to offer them in the GUI. I worked with customers doing exactly what you want, they where happy with imported structured vars (no related fields required as long as you do not want to modify them in the GUI) combined with hand-crafted apply rules shipped with the "fileshipper" module through Director. However, once more and more teams desired to work with that environments, this week something new has been designed and already mostly implemented (not committed yet). The new requirements where:
The involved components could look as follows for your example:
I intentionally modified your example, defined a default path and worked differently in Instance 1 and Instance 2. Just to show you it's possibilities. When you define fields for tomcat_path on the command or service template you would be allowed to override it for every instance directly in the services tab of each host. Makes sense as soon as you want the threshold (process count ecc) to be configurable. Please let me know whether such thing could help you or how it could be improved to better fit your needs. Thanks, NB: You'll find better by_ssh example on the web, it is possible to create args looking like "real" argument structures in your vars. |
Updated by friesoft on 2016-06-17 20:21:01 +00:00 To be honest I don't fully get it yet. Where does the "templates" = "tomcat" come from? Or did you just pick a wrong name for the template definition? Another usecase for us is something like this: apply Service "http-" for (vhost => vhost_config in host.vars.vhosts) { Thank you really much for your dedication and help! :) |
Updated by msmol on 2016-08-03 20:53:45 +00:00 +1 My team (jprivard + cardeois) and I are actively working on this. We have the API part mostly done (missing tests). We still have yet to start working on the GUI bits however. Work so far can be seen here (with an example in the commit message): internap@753f984 For the API we do not currently validate the given "apply_for" rule. That is to say if you enter an invalid rule, that API will not complain, but the deployment will fail. This feature, in order to be usable depends on the "$variable$" notation given above by tgelf. We currently have our own hacked solution (using the ` character instead of $) but will there be an official implementation for this feature? |
Updated by tgelf on 2016-08-03 22:23:18 +00:00 msmol wrote:
Cool!
Looks good to me at first sight. Love that you moved blacklistedProperties out of the function. Could you please name them propertiesNotForRendering or similar and push this as a separate commit? I'd immediately merge it, would allow me to get rid of quite some redundant render-functions.
I do not like this part. What about storing only the variable name in the apply_for column, checked_tcp_ports in your case? The variable names used in the loop could be hardcoded and always the same. That way it could easily be validated.
We could use I'd have no problem with dynamically generating something more complex like this for every genereated "apply for" construct. Cheers, |
Updated by friesoft on 2016-10-31 16:38:14 +00:00 Anything missing here? I haven't been able to test the latest master yet but as far as I've seen the related pull requests are merged? :) |
Updated by tgelf on 2016-10-31 20:37:52 +00:00
That's true, this is in the current master and works fine - thanks for pointing me to this open issue. |
Updated by tgelf on 2016-10-31 20:38:05 +00:00
|
This issue has been migrated from Redmine: https://dev.icinga.com/issues/11976
Created by friesoft on 2016-06-17 17:13:36 +00:00
Assignee: tgelf
Status: Resolved (closed on 2016-10-31 20:38:05 +00:00)
Target Version: 1.2.0
Last Update: 2016-10-31 20:38:05 +00:00 (in Redmine)
We are migrating from Nagios to Icinga(web)2 with Director and are trying to do as much as possible through Director to keep the configuration in one place and make it easy for everyone to edit it.
Assign for is a feature we would need to make use of the data we are importing into our hosts.
Example Host (imported/synced using Director):
object Host "MyHost" {
import "OurHost"
address = "1.1.1.1"
vars.tomcats = [
"/opt/tomcat",
"/opt/tomcat2"
]
}
Example Service (currently handcrafted in the config):
apply Service "Tomcat " for (tomcat in host.vars.tomcats) {
import "[Template] ssh-service (active)"
vars.by_ssh_command = "/opt/nagios/libexec/check_proc -C java -a '" + tomcat + "' -c 1:1"
assign where host.vars.tomcats
}
Are assign for rules already planned for the near future?
Changesets
2016-10-21 13:33:49 +00:00 by cardeois f645bf4
2016-10-21 13:33:49 +00:00 by cardeois 6e20f36
2016-10-21 19:11:57 +00:00 by cardeois 66e0bce
2016-10-21 19:11:57 +00:00 by cardeois 32e4787
2016-10-22 00:15:09 +00:00 by (unknown) bcef87f
2016-10-22 00:15:09 +00:00 by cardeois ddcfb09
2016-10-22 00:15:09 +00:00 by cardeois 37c9105
2016-10-22 06:00:54 +00:00 by cardeois e7bd434
2016-10-22 06:07:57 +00:00 by cardeois 3e30d34
The text was updated successfully, but these errors were encountered: