Skip to content
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 #12947] Service assignment based on ssh command output #502

Closed
icinga-migration opened this issue Oct 19, 2016 · 5 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/12947

Created by swizzly on 2016-10-19 14:41:51 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-10-20 07:14:38 +00:00 (in Redmine)


Hi,

I am wondering whether is it possible in Director, to assign a service to a host based on the result of a remotely (SSH) executed command on the host?
In detail: There are several hosts with some special attributes, that are nowhere centrally registered (no LDAP/PuppetDB whatsoever). In order to find out whether the attribute is defined, a command need to be executed on the host. If the query is successful, then it means the attribute is set on the given host, and accordingly a service should be activated on the given host.
The attributes are relatively static, it means it changes maybe 1-2x in a year. I could manually assign the service to the hosts, but it is not so elegant, and it can be forgotten.

cheers
Zoltan

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-10-19 23:13:25 +00:00

What about using a custom script and using either the REST API or the CLI ? Example:

icingacli director host set example.com \
  --vars.my_flag "$(ssh example.com /some/command)"

Cheers
Thomas

@icinga-migration
Copy link
Author

Updated by swizzly on 2016-10-20 06:13:57 +00:00

Hi Thomas,

Thanks for the hints. Is there no way to do it from the Director GUI, that would be sure the elegant solution.
Do I understand correctly, that I need to make a cronjob that executes the stuff above?
I also need to have a list of the hosts (members of a hostgroup), where the command need to be executed. Since the members of the list can change, I need to have a dynamic way to generate this hostlist, unfortunately, I haven't found a way in icingacli director to query the members of a hostgroup.

Cheers
Zoltan

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-10-20 06:41:47 +00:00

Well... an import property modifier called "exec" could be another option, could that help you?

@icinga-migration
Copy link
Author

Updated by swizzly on 2016-10-20 07:14:38 +00:00

yes, that could solve the problem. Thanks!

@Thomas-Gelf
Copy link
Contributor

Closing this one, as we solved it with a custom PropertyModifier running a custom script every time a script-generated lookup file is outdated. The modifier is configurable, but still quite opinionated. It could IMO be made more generic with little effort, that's why I leave this screenshot here before closing the issue:

property-modifier_orapoollist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants