Druwerd
2010-Jul-02  16:11 UTC
[Puppet Users] Setting permissions on nagios service check file
Is there a better way to set the permissions on the cfg files
generated by the nagios_service type?
I want each nagios service check to have it''s own file, but
don''t want
to write it out each time. Is there a way to set default permissions
for the nagios_service cfg files?
    # Monitor ntp services
    @@nagios_service{ "nrpe_ntp":
        target                          => "/etc/nagios/conf.d/
services/${fqdn}_nrpe_ntp.cfg"
        check_command         => "check_nrpe!check_ntp_time"
    }
    # Change the permissions of the nagios ntp check file
        @@file{ "/etc/nagios/conf.d/services/${fqdn}_nrpe_ntp.cfg":
            owner   => root,
            group   => root,
            mode   => 444,
            require => Nagios_service["nrpe_ntp"],
            tag       => "nagios",
        }
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Joe McDonagh
2010-Jul-02  16:39 UTC
Re: [Puppet Users] Setting permissions on nagios service check file
On 07/02/2010 12:11 PM, Druwerd wrote:> Is there a better way to set the permissions on the cfg files > generated by the nagios_service type? > I want each nagios service check to have it''s own file, but don''t want > to write it out each time. Is there a way to set default permissions > for the nagios_service cfg files? > > # Monitor ntp services > @@nagios_service{ "nrpe_ntp": > target => "/etc/nagios/conf.d/ > services/${fqdn}_nrpe_ntp.cfg" > check_command => "check_nrpe!check_ntp_time" > } > > # Change the permissions of the nagios ntp check file > @@file{ "/etc/nagios/conf.d/services/${fqdn}_nrpe_ntp.cfg": > owner => root, > group => root, > mode => 444, > require => Nagios_service["nrpe_ntp"], > tag => "nagios", > } > >You use a combination of overrides and an exec that fixes the permissions. Nagios_service { notify => Exec["fix_nagios_perms"]; } exec { "fix_nagios_perms": command => "/bin/chmod -R 755 /etc/nagios3", notify => Service["nagios"], refreshonly => "true"; service { "nagios": ensure => "running"; } -- Joe McDonagh AIM: YoosingYoonickz IRC: joe-mac on freenode "When the going gets weird, the weird turn pro." -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Peter Meier
2010-Jul-02  17:31 UTC
Re: [Puppet Users] Setting permissions on nagios service check file
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/02/2010 06:39 PM, Joe McDonagh wrote:> On 07/02/2010 12:11 PM, Druwerd wrote: >> Is there a better way to set the permissions on the cfg files >> generated by the nagios_service type? >> I want each nagios service check to have it''s own file, but don''t want >> to write it out each time. Is there a way to set default permissions >> for the nagios_service cfg files?or you use a definition to wrap these 2 statements up into one and call the definition. cheers pete -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwuInUACgkQbwltcAfKi3+BBwCfQsnp9NqMy7KdZ1zpPubGOdKA 8JgAnR//t2duOvEpqYHLIfcRaqCEMCIL =W4xq -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.