Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifying the nrpe service to reload itself does not work correctly #7

Open
5c077yP opened this issue Apr 11, 2014 · 8 comments
Open

Comments

@5c077yP
Copy link
Contributor

5c077yP commented Apr 11, 2014

Hey,

i'm using ubuntu 12.04LTS and the

file "#{node['nrpe']['conf_dir']}/nrpe.d/#{new_resource.command_name}.cfg" do
  ...
  notifies :reload, 'service[nrpe]'
end

within the check lwrp
doesn't work for me. It always just says:

Recipe: nrpe::default
  * service[nagios-nrpe-server] action reload (up to date)

And using the check_nrpe plugin can't find configured commands until i restart nrpe by hand.

I'm installing nrpe using the source method and the provided init script doesn't support reload as a command, maybe this is the real problem here, not sure.

@5c077yP 5c077yP changed the title Make notification type configurable notifying the nrpe service to reload itself does not work correctly Apr 11, 2014
@5c077yP
Copy link
Contributor Author

5c077yP commented Apr 11, 2014

Sorry ... it was just not working in my vagrant environment, but is on real servers :?

@5c077yP 5c077yP closed this as completed Apr 11, 2014
@nsklaus
Copy link

nsklaus commented Jul 20, 2015

Hi
i have the same problem, nrpe is never restated, my 'notifies' are completely ignored.
no matter what i try, i'm forced to restart it manually everytime.
i'm using debian VMs hosted on AWS, and created a check for ntp monitoring.
how can i make nrpe service to restart after adding new checks ?
thanks

here's my recipe:

nrpe_check "check_ntp_monitoring" do
  command "#{node['nrpe']['plugin_dir']}/check_ntp_time"
  parameters '-H 0.amazon.pool.ntp.org -c 5 -w 1'
  action :add
  notifies :restart, "service[#{node['nrpe']['service_name']}]", :delayed
end

@nsklaus
Copy link

nsklaus commented Jul 20, 2015

i've tryed to go on the VM, manually delete /etc/nagios/nrpe.d/check_ntp_monitoring.cfg,
then, launch a chef-client.
the check is re-created (that's good) but nrpe service is not restarted (that's the bad point).
here's the output i get:

* file[/etc/nagios/nrpe.d/check_ntp_monitoring.cfg] action create
    - create new file /etc/nagios/nrpe.d/check_ntp_monitoring.cfg
    - update content in file /etc/nagios/nrpe.d/check_ntp_monitoring.cfg from none to aede53
    --- /etc/nagios/nrpe.d/check_ntp_monitoring.cfg 2015-07-17 12:59:11.718105550 +0000
    +++ /tmp/.check_ntp_monitoring.cfg20150717-21132-z63jfy 2015-07-17 12:59:11.718105550 +0000
    @@ -1 +1,2 @@
    +command[check_ntp_monitoring]=/usr/lib/nagios/plugins/check_ntp_time -H 0.amazon.pool.ntp.org -c 5 -w 1
    - change mode from '' to '0640'
    - change owner from '' to 'nagios'
    - change group from '' to 'nagios'

Recipe: nrpe::default
  * service[nrpe] action reload (up to date)

Running handlers:
Running handlers complete
Chef Client finished, 98/470 resources updated in 36.975446566 seconds

also i can confirm nrpe is not restarted by check the age of the nrpe process
with: stat /proc/nrpe_pid
it is older than the chef-client run.
as far as i can tell, nrpe process start fine, but it is never restarted.
please tell me what kind of info you need, i can provide logs, i can help and test too.
this problem is reproductible i have it on all my 50+ VMs (all debian 6.x)

thanks

@5c077yP
Copy link
Contributor Author

5c077yP commented Jul 22, 2015

Hey,

i just tested it on a ubuntu 12.04 vm and have the same issue. I'm installing nrpe from source in version 2.15. For me it seems that the reload command for the init script didn't work because there was no pid file. A quick check shows the pid directory /var/run/nagios does not exist and the nagios-nrpe-server is not creating it when started (although pid file is configured in config). If I create that directory within my recipe all works now. But /var/run is cleared a boot time, which is why i would not create the dir through chef, but change the pid file location:

# set this in your attributes file or wherever
default['nrpe']['pid_file'] = '/run/nagios.pid'

@5c077yP 5c077yP reopened this Jul 22, 2015
@5c077yP
Copy link
Contributor Author

5c077yP commented Jul 22, 2015

maybe we should update the cookbook attributes accordingly?

@5c077yP
Copy link
Contributor Author

5c077yP commented Jul 23, 2015

for debian squeeze use /var/run/nagios.pid

@nsklaus
Copy link

nsklaus commented Jul 23, 2015

thanks for the reply!
i will test that tomorrow, and report back how it went for me.
in the meantime i just added a bash block in my recipe, scanning for
directory /etc/nagios/nrpe.d/* and if any file age was less than 10mn
restart nrpe service (through bash). if no file age was less that 10mn do
nothing.
that worked for me but that would be better if it was fixed directly in the
cookbook.

thanks again

On Wed, Jul 22, 2015 at 10:33 PM, Alexander Springer <
[email protected]> wrote:

Hey,

i just tested it on a ubuntu 12.04 vm and have the same issue. I'm
installing nrpe from source in version 2.15. For me it seems that the
reload command for the init script didn't work because there was no pid
file. A quick check shows the pid directory /var/run/nagios does not exist
and the nagios-nrpe-server is not creating it when started (although pid
file is configured in config). If I create that directory within my recipe
all works now. But /var/run is cleared a boot time, which is why i would
not create the dir through chef, but change the pid file location:

set this in your attributes file or wherever

default['nrpe']['pid_file'] = '/run/nagios.pid'


Reply to this email directly or view it on GitHub
#7 (comment).

@github-actions
Copy link

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants