FAQ
Dear all,

I wrote a custom fact, which returns a comma separated list of addr:port,
like this:

sb_intl_conn =>
sbcms-t:22,sbsql05-wvuk-inst5:1434,sborc07-uk-t:1533,..,..,..
The number of elements in the string varies from node to node. I need to do
a Nagios tcp-port-check on each of them. I think sb_intl_conn.split(",")will turn this string into an array and then how can I iterate over it to
do something like this?


@@nagios_service { "check_stat_${::fqdn}_${addr}_${port}":
use => 'generic-service',
check_command => "remote-nrpe-tcp-check!${addr}!${port}",
service_description => "V2::CON: ${addr} [Palms]",
display_name => "Connection check: ${addr}:${port}",
servicegroups => 'batch-worker',
hostgroup_name => 'batch-job',
}
Any help would be greatly appreciated. Cheers!!

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Peter Brown at Mar 15, 2013 at 5:42 am
    It's pretty tricky to "program" puppet like your usual programming language.

    Given the nature of how puppet does things you will have to write a define
    that accepts the array you have split and then split the $title variable on
    ","

    That looks like a very complex way of generating nagios services.

    I am going to hope that the services you are monitoring aren't managed by
    puppet at all and that's the only way to do it.




    On 15 March 2013 09:35, Sans wrote:

    Dear all,

    I wrote a custom fact, which returns a comma separated list of addr:port,
    like this:

    sb_intl_conn =>
    sbcms-t:22,sbsql05-wvuk-inst5:1434,sborc07-uk-t:1533,..,..,..
    The number of elements in the string varies from node to node. I need to
    do a Nagios tcp-port-check on each of them. I think
    sb_intl_conn.split(",") will turn this string into an array and then how
    can I iterate over it to do something like this?


    @@nagios_service { "check_stat_${::fqdn}_${addr}_${port}":
    use => 'generic-service',
    check_command => "remote-nrpe-tcp-check!${addr}!${port}",
    service_description => "V2::CON: ${addr} [Palms]",
    display_name => "Connection check: ${addr}:${port}",
    servicegroups => 'batch-worker',
    hostgroup_name => 'batch-job',
    }
    Any help would be greatly appreciated. Cheers!!

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sans at Mar 15, 2013 at 8:41 am
    Thanks Pete! Do you think you can possibly put together a lines of example code?
    Just wondering, if it's possible/easier with Ruby DSL? I haven't tried that yet. Cheers!!

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 14, '13 at 11:35p
activeMar 15, '13 at 8:41a
posts3
users2
websitepuppetlabs.com

2 users in discussion

Sans: 2 posts Peter Brown: 1 post

People

Translate

site design / logo © 2022 Grokbase