Nagios cookbook NRPE LWRP

I’ve opened a ticket on this here:
http://tickets.opscode.com/browse/COOK-3021

Basically, I found that when I did a manual chef-client run across my
network, I found that it was always saying X resources updated even when
there should have been no changes. gchristensen from #chef pointed me at
the whyrun method of testing to see what was actually being flagged as
updated, and I found that in particular it was flagging on the NRPE LWRP
files that are generated. There is no check being done by the LWRP, it
simply creates the file on each client run.

I’d like to help fix this problem, since I have some available time to poke
at this, and I could use a pointer towards how other cookbooks approach
this kind of scenario. I don’t want to simply test if the file exists,
because the parameters could have been updated. I’m assuming that I should
instead generate the file inside the cache directory and then compare
checksums if the file exists and copy it to the destination if they do not
match (or if the file doesn’t previously exist)? Or is there a more elegant
way to handle this?

Looking through the logs and comments it looks like this used to be done
via a template, which I would assume would have actually solved this
problem natively. I’m not sure why that was moved away from, but I imagine
there was a good reason (possibly Erubis performance on generating
potentially lots of one-line files?).


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

This is actually simpler than I thought. The problem was that the LWRP was
manually setting "new_resource.updated_by_last_action(true)", so it was
always being flagged as updated. When in reality, simply removing that
allows the file provider to properly flag whether or not the resource has
been updated.

--
~~ StormeRider ~~

"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS

On Tue, May 21, 2013 at 8:49 AM, Morgan Blackthorne
stormerider@gmail.comwrote:

I've opened a ticket on this here:
http://tickets.opscode.com/browse/COOK-3021

Basically, I found that when I did a manual chef-client run across my
network, I found that it was always saying X resources updated even when
there should have been no changes. gchristensen from Chef Infra (archive) pointed me at
the whyrun method of testing to see what was actually being flagged as
updated, and I found that in particular it was flagging on the NRPE LWRP
files that are generated. There is no check being done by the LWRP, it
simply creates the file on each client run.

I'd like to help fix this problem, since I have some available time to
poke at this, and I could use a pointer towards how other cookbooks
approach this kind of scenario. I don't want to simply test if the file
exists, because the parameters could have been updated. I'm assuming that I
should instead generate the file inside the cache directory and then
compare checksums if the file exists and copy it to the destination if they
do not match (or if the file doesn't previously exist)? Or is there a more
elegant way to handle this?

Looking through the logs and comments it looks like this used to be done
via a template, which I would assume would have actually solved this
problem natively. I'm not sure why that was moved away from, but I imagine
there was a good reason (possibly Erubis performance on generating
potentially lots of one-line files?).

--
~~ StormeRider ~~

"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS