Re: [Puppet Users] Nagios Types

Gabriel Filion
Tue, 06 Jul 2010 01:57:57 -0000

On 2010-07-05 19:34, Douglas Garstang wrote:
> First off, does anyone use the puppet built in nagios types?
>
> I just started to play with them, and I noticed that nagios_host
> writes the nagios_host.cfg file as owned by root, and readable by
> root, and no on else. Is there a reason for that? Since nagios runs as
> the nagios user, it can''t read the file. Sure, I can change the
> ownership later with a file {}, but I shouldn''t need to.
>
> -rw------- 1 root   root     294 Jul  5 16:30 nagios_host.cfg
>
> James, hope my tone is acceptable.
>
> Doug
>

This is probably the case since the puppet daemon must run as root to be
able to install packages and create/remove/modify files. Also, the
default umask for root is normally set to create files that are not
accessible to everyone.

As you mentioned, "file {...}" is probably the way to go:

    file { nagios_resource_cfg:
        path => "$nagios_basedir/resource.cfg",
        source => [ ... ],
        notify => Service[''nagios''],
        owner => root, group => nagios, mode =>
''0640'';
    }

Another possibility would be to use (I havent tested it yet)

    File { owner => root, group => nagios, mode =>
''0640''; }

inside the class in which you declare the nagio file resources so that
those permissions are the default for the nagios config files.

--
Gabriel Filion