I try to make script/command in nagios3 at write in new file some data but nagios will not do that. I try that simple bash command:
printf "something" > /path-to-file/new-file
But nagios don't open/write file. I try direct i definition of nagios commando and to make bash script and start from nagios but same - nothing happens.
Look like:
define command{
command_name service-notify-sms
command_line /usr/bin/printf '%s\n\n%s\n%s\n%s' "To: $CONTACTPAGER$ " "Service : $SERVICEDESC$ " "State: $SERVICESTATE$ " "Date/Time: $LONGDATETIME$ " > /var/spool/sms/outgoing/$CONTACTPAGER$
}
define contact{
service_notification_commands service-notify-sms
host_notification_commands host-notify-sms
I think about at nagios need some privilege to write file or I think wrong? Maybe nagios can't write file or have some another command, not standard bash ">"?
It's look in /var/log/syslog:
Jun 13 08:58:00 nagios nagios3: HOST NOTIFICATION: user-sms;Nagios;CUSTOM (UP);host-notify-sms;OK - localhost responds to ICMP. Packet 1, rtt 0.010ms;nagiosadmin;test
I founded about only one question: Is this possible at Nagios write in file or not? It someone do some like that?