# Nagios module and not being able to write to nagios.cmd

**URL:** <https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278>\
**Category:** Ansible Project\
**Created:** [September 16, 2015, 8:59pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278 "2015-09-16T20:59:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_S](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sam\_S](https://forum.ansible.com/u/Sam_S)\
**Post date:** [September 16, 2015, 8:59pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278/1 "2015-09-16T20:59:04Z")

</div>

I keep getting the following error when I attempt to disable alerts for a particular host. Not sure what the heck is going on!

failed: [127.0.0.1 → [nagios.xyz.net](http://nagios.xyz.net)] =\> {“cmdfile”: “/var/spool/nagios/cmd/nagios.cmd”, “failed”: true}  
msg: unable to write to nagios command file

Permissions to file (My user is in the “nagios” group):  
prwxrwx—. 1 nagios nagios 0 Sep 4 15:47 nagios.cmd

pre\_tasks:

- name: disable nagios alerts for this host webserver service  
nagios: action=disable\_alerts host=qcweb001 service=all cmdfile=/var/spool/nagios/cmd/nagios.cmd  
delegate\_to: [nagios.xyz.net](http://nagios.xyz.net)

---

<div class="post-metadata">

**Author:** ![Sam\_S](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sam\_S](https://forum.ansible.com/u/Sam_S)\
**Post date:** [September 16, 2015, 9:02pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278/2 "2015-09-16T21:02:40Z")

</div>

In addition can someone clarify something.

Shouldn’t the “cmdfile” file be the .cmd file? I peeked at the Nagios module and there’s a list of files but they all point to the nagios.cfg file.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [September 18, 2015, 4:47pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278/3 "2015-09-18T16:47:59Z")

</div>

So the user you login to the nagios server needs to be in the nagios  
group to write to the file.

---

<div class="post-metadata">

**Author:** ![Sam\_S](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sam\_S](https://forum.ansible.com/u/Sam_S)\
**Post date:** [September 18, 2015, 4:49pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278/4 "2015-09-18T16:49:26Z")

</div>

Thought I included that in my original post but I didn’t. Yes the user I am logging in as is in the “nagios” group.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [September 18, 2015, 4:53pm UTC](https://forum.ansible.com/t/nagios-module-and-not-being-able-to-write-to-nagios-cmd/19278/5 "2015-09-18T16:53:42Z")

</div>

are you sure? try delegating a "shell: id" task
