FWIW 2.3.11 (which will be released in about 2-3 weeks) will probably make this a bit easier:
https://dev.icinga.org/issues/10006 This feature adds a new function (resolve_arguments) which lets users resolve commands+arguments in exactly the same way Icinga does internally. For example: object CheckCommand "users_by_ssh“ { import „users" // Steal command line and arguments from the ‚users‘ CheckCommand vars.by_ssh_command = command vars.by_ssh_arguments = arguments import „by_ssh“ host_name = … } (Here are the changes for the by_ssh command to make this work: https://dev.icinga.org/projects/i2/repository/revisions/63a1ff77c32ab94351d9253c54e80070e3146af5/diff/itl/command-plugins.conf) Kind regards, Gunnar Beutner On 01/10/15 13:46, "icinga-users on behalf of Bancal Samuel" <icinga-users-boun...@lists.icinga.org on behalf of samuel.ban...@epfl.ch> wrote: >Hi, > >Has anyone any experience with implementing checks through ssh and defining >them in a sweet & generic syntax with : > >command = [ PluginDir + "/check_users" ] >arguments = { > "-w" = "$users_warn$" >"-c" = "$users_crit$" >} > >This doesn't look a so big advantage in this example since there are only a >few arguments (and they all are mandatory), but for other checks (like >my_mysql described in >http://docs.icinga.org/icinga2/latest/search?q=arguments#!/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics?highlight-search=arguments#command-passing-parameters) > it might be a really big step further! > >Thanks, >Samuel > >On 28. 09. 15 11:20, Bancal Samuel wrote: >> Hi, >> >> All our Linux servers are monitored through ssh with such kind of config : >> >> template Host "generic-ssh-host" { >> import "generic-host" >> vars.os = "Linux" >> vars.agent_type = "by_ssh" >> >> vars.by_ssh_logname = "nagios" >> vars.by_ssh_identity = "/var/lib/nagios/.ssh/id_rsa" >> } >> object Host "unitbkp1" { >> import "generic-ssh-host" >> >> [...] >> } >> apply Service "users" { >> import "generic-service" >> check_command = "by_ssh_users" >> assign where host.vars.agent_type == "by_ssh" >> } >> object CheckCommand "by_ssh_users" { >> import "by_ssh" >> >> vars.by_ssh_command = "/usr/lib/nagios/plugins/check_users -w >> $by_ssh_users_warn$ -c $by_ssh_users_crit$" >> vars.by_ssh_users_warn = "20" >> vars.by_ssh_users_crit = "50" >> } >> >> Since syntax described at >> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#commands >> : >> command = [...] >> arguments = {...} >> seems much more efficient & generic, we'd like to know if there is an >> equivalent for ssh hosts and be able to do something similar to : >> >> object CheckCommand "by_ssh_users" { >> import "by_ssh"# or something else? >> >> command = [ PluginDir + "/check_users" ] >> arguments = { >> "-w" = "$users_warn$" >> "-c" = "$users_crit$" >> } >> >> vars.users_warn = "20" >> vars.users_crit = "50" >> } >> >> Thanks, >> Samuel >> > >-- >Samuel Bancal >ENAC-IT >EPFL > >_______________________________________________ >icinga-users mailing list >icinga-users@lists.icinga.org >https://lists.icinga.org/mailman/listinfo/icinga-users -- Gunnar Beutner Senior Developer NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg Tel: +49 911 92885-0 | Fax: +49 911 92885-77 GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 http://www.netways.de | gunnar.beut...@netways.de ** OSMC 2015 - November - netways.de/osmc ** ** OSDC 2016 - April – netways.de/osdc ** _______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users