Issue #5492 has been reported by Dis Connect.

----------------------------------------
Bug #5492: Nagios config builder severely brain damaged
https://projects.puppetlabs.com/issues/5492

Author: Dis Connect
Status: Unreviewed
Priority: Normal
Assignee: 
Category: nagios
Target version: 
Affected Puppet version: 2.6.3
Keywords: 
Branch: 


When creating a nagios config from scratch (remove the existing files), puppet 
refuses to do anything sanely.
For each resource to be appended to the config, puppet does: 
* open a temp file
* open the existing config
* read one 4k block at a time from the existing config and write it to the temp 
file
* (repeat as needed)
* write the new block to the temp file
* close the temp file, existing config
* reopen the existing config WR_ONLY O_TRUNC
* reopen the temp file
* read one 4k block at a time from the temp file and write it to the existing 
config
* (repeat as needed)
* close all

Since this happens for -each- change, it results in a 30-60 minute runtime on 
our nodes (3600 services on 250 hosts, and for testing I stuck with /etc/nagios 
on a tmpfs ramdisk to eliminate io bottlenecks.)

I would expect puppet to see the missing config and write the new one ONCE. (Or 
twice, if temp files absolutely must be used.) I'd also expect sendfile to be 
used to move data from one file to another, if cp is too fancy..

Strace:
    open("/tmp/puppet20101209-6379-6al64v-0", O_RDONLY) = 8
    open("/etc/nagios/services.d/nagios.cfg", O_WRONLY|O_CREAT|O_TRUNC, 
0100600) = 9
    fcntl(9, F_GETFL)                       = 0x8001 (flags 
O_WRONLY|O_LARGEFILE)
    fstat(9, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7ff76dca2000
    lseek(9, 0, SEEK_CUR)                   = 0
    fstat(8, {st_mode=S_IFREG|0600, st_size=351033, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7ff76dca1000
    read(8, "# HEADER: This file was autogene"..., 4096) = 4096
    write(9, "# HEADER: This file was autogene"..., 4096) = 4096



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to