# Nagios cookbook NRPE LWRP

**URL:** <https://discourse.chef.io/t/nagios-cookbook-nrpe-lwrp/3991>\
**Category:** Chef Infra (archive)\
**Created:** [May 21, 2013, 3:49pm UTC](https://discourse.chef.io/t/nagios-cookbook-nrpe-lwrp/3991 "2013-05-21T15:49:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [May 21, 2013, 3:49pm UTC](https://discourse.chef.io/t/nagios-cookbook-nrpe-lwrp/3991/1 "2013-05-21T15:49:35Z")

</div>

I’ve opened a ticket on this here:  
[http://tickets.opscode.com/browse/COOK-3021](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](http://bit.ly/Ps3uSS)

---

<div class="post-metadata">

**Author:** ![Morgan\_Blackthorne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/morgan_blackthorne/32/100_2.png) [@Morgan\_Blackthorne](https://discourse.chef.io/u/Morgan_Blackthorne)\
**Post date:** [May 24, 2013, 9:54pm UTC](https://discourse.chef.io/t/nagios-cookbook-nrpe-lwrp/3991/2 "2013-05-24T21:54:29Z")

</div>

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](http://bit.ly/Ps3uSS)

On Tue, May 21, 2013 at 8:49 AM, Morgan Blackthorne  
[stormerider@gmail.com](mailto:stormerider@gmail.com)wrote:

> I've opened a ticket on this here:  
> [http://tickets.opscode.com/browse/COOK-3021](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](http://bit.ly/Ps3uSS)
