Skip to content

Instantly share code, notes, and snippets.

@xorpaul
Last active May 18, 2017 11:41
Show Gist options
  • Save xorpaul/f6a6874b762f9e2ae2402e0a86abd351 to your computer and use it in GitHub Desktop.
Save xorpaul/f6a6874b762f9e2ae2402e0a86abd351 to your computer and use it in GitHub Desktop.
object CheckCommand "check_tcp_wild" {
        import "ipv4-or-ipv6"

        command = [ PluginDir + "/check_tcp " + "$tcp_args$" ]

        vars.tcp_args = "$tcp_args$"
}
apply Service "Puppet Server 8140" {
  import "generic-service"
  check_command = "check_tcp_wild"
  vars.tcp_args = "-H puppetserver.domain.tld -p 8140"
}

Edit: One solution I came up with is:

object CheckCommand "check_tcp_wild" {
        import "plugin-check-command"
        import "ipv4-or-ipv6"
        command = PluginDir + "/check_tcp" + " " + "$tcp_args$" 
        vars.tcp_args = "$tcp_args$"
}
apply Service "Puppet Server 8140" {
  import "generic-service"
  check_command = "check_tcp_wild"
  vars.tcp_args = ["-H", "puppetserver.domain.tld", "-p", "8140"]
}
@xorpaul
Copy link
Author

xorpaul commented May 18, 2017

@tobiasvdk The "$tcp_args$".split(" ") method fails with:

critical/config: Error: Validation failed for object 'check_tcp_wild' of type 'CheckCommand'; Attribute 'command' -> '1': Invalid type.

@gunnarbeutner Your version also works, thanks!

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