-
-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Labels
BugSomething isn't workingSomething isn't workinghacktoberfestAn issue highlighted for the digital ocean Hacktoberfest EventAn issue highlighted for the digital ocean Hacktoberfest Event
Description
Cookbook version
Latest
Platform Details
CentOS 7
Scenario:
The nagios command_file is partially managed via the packaged systemd service
> grep cmd /usr/lib/systemd/system/nagios.service
ExecStopPost=/usr/bin/rm -f /var/spool/nagios/cmd/nagios.cmd
When a different command_file location is specified in the cookbook this management will break.
Resulting in a broken command_file after a nagios restart.
Steps to Reproduce:
echo '{ "nagios": { "conf": { "command_file": "/var/log/nagios/rw/nagios.cmd" } } }' | sudo chef-client -j /dev/stdin
systemctl restart nagios
/usr/lib64/nagios/plugins/eventhandlers/nagios_command STOP_EXECUTING_SVC_CHECKS
Expected Result:
A command arriving at the running nagios server
Actual Result:
Write blocks, because the command_file is broken
Possible solution
directory '/etc/systemd/system/nagios.service.d/'
file '/etc/systemd/system/nagios.service.d/command_file.conf' do
content "[Service]\nExecStopPost=/usr/bin/rm -f #{node['nagios']['conf']['command_file']}"
mode 0644
notifies :run, 'execute[reload_systemd_nagios]', :immediately
end
execute 'reload_systemd_nagios' do
command <<-EOF
systemctl daemon-reload
EOF
action :nothing
end
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workinghacktoberfestAn issue highlighted for the digital ocean Hacktoberfest EventAn issue highlighted for the digital ocean Hacktoberfest Event