Exec plugin in nagios logserver
-
saleemthupsee
- Posts: 107
- Joined: Wed Feb 15, 2017 4:22 am
- Location: Paris France
- Contact:
Exec plugin in nagios logserver
Hello,
i am using the exec plugin to execute a script send_nrdp.sh to send customized output messages to nagiosxi. I use the command in the output filter and it does not work. i use the same command on the command line, it works. I've treid detach it breaks nagioslogserver on memory.
(simple exec commands ls-al to a text file from the output filter works by the way)
Is there a way to resolve this issue ?
Saleem
i am using the exec plugin to execute a script send_nrdp.sh to send customized output messages to nagiosxi. I use the command in the output filter and it does not work. i use the same command on the command line, it works. I've treid detach it breaks nagioslogserver on memory.
(simple exec commands ls-al to a text file from the output filter works by the way)
Is there a way to resolve this issue ?
Saleem
Saleem THUPSEE
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Exec plugin in nagios logserver
Can you share the full command you are trying to execute (obfuscating any sensitive data) so we can test this here.
Being simple commands work, I have a feeling it may be a permissions issue.
Being simple commands work, I have a feeling it may be a permissions issue.
-
saleemthupsee
- Posts: 107
- Joined: Wed Feb 15, 2017 4:22 am
- Location: Paris France
- Contact:
Re: Exec plugin in nagios logserver
in filter outputs
the following code:
exec {
command => "/usr/bin/send_nrdp.sh -u https://192.168.97.2/nrdp -t ########### -H localhost -s RTL9 -S 2 -o testfromlogserver {} \;"
}
i have replaced the token by ##########
Saleem
the following code:
exec {
command => "/usr/bin/send_nrdp.sh -u https://192.168.97.2/nrdp -t ########### -H localhost -s RTL9 -S 2 -o testfromlogserver {} \;"
}
i have replaced the token by ##########
Saleem
Saleem THUPSEE
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Exec plugin in nagios logserver
To be clear, can you run this from the command line on your Log Server and have it arrive?
Also, can you share the following command permission results:
Also, can you share the following command permission results:
Code: Select all
ls -l /usr/bin/send_nrdp.sh-
saleemthupsee
- Posts: 107
- Joined: Wed Feb 15, 2017 4:22 am
- Location: Paris France
- Contact:
Re: Exec plugin in nagios logserver
please see below
-rwxr-xr-x 1 root root 8559 Aug 22 17:31 /usr/bin/send_nrdp.sh
-rwxr-xr-x 1 root root 8559 Aug 22 17:31 /usr/bin/send_nrdp.sh
Saleem THUPSEE
Re: Exec plugin in nagios logserver
There could be a command within the script that fails due to permissions or you may need to specify the full path. The script isn't run as root when it is run by NLS so you'll have to take that into account. Can you share the script?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
saleemthupsee
- Posts: 107
- Joined: Wed Feb 15, 2017 4:22 am
- Location: Paris France
- Contact:
Re: Exec plugin in nagios logserver
please see attached
You do not have the required permissions to view the files attached to this post.
Saleem THUPSEE
- tacolover101
- Posts: 432
- Joined: Mon Apr 10, 2017 11:55 am
Re: Exec plugin in nagios logserver
nice plugin @scottwilkerson
are you sure your logic is actually triggering? from what you've mentioned it seems like it should be working if it's not permissions.
are you sure your logic is actually triggering? from what you've mentioned it seems like it should be working if it's not permissions.
Re: Exec plugin in nagios logserver
It might also be useful to share your Logstash logs to see if the exec plugin is failing for some reason. They can typically be found in:
Code: Select all
/var/log/logstashFormer Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
saleemthupsee
- Posts: 107
- Joined: Wed Feb 15, 2017 4:22 am
- Location: Paris France
- Contact:
Re: Exec plugin in nagios logserver
i have verified once more the execution of the exec command by substituting the command echo to a text file. the parameters passed on the script through fields i.e %{fieldname} are not replaced by their field contents. i only have the output %{fieldname} in plain text in the text file instead of the contents of the fieldname being replaced in text file.
Anything wrong in my syntax. I checked through logstash 1.5 doc. to use %{fieldname} to gather the variables. the example is
command => "iptables -A INPUT -s %{clientip} -j DROP"
mine is :
exec {
command => "/usr/local/nagioslogserver/scripts/send_nrdp.sh -su http://192.168.97.2/nrdp -t ######## -H localhost -s %{channel_name} -S %{sh_status} -o testfromlogserver"
}
Anything wrong in my syntax. I checked through logstash 1.5 doc. to use %{fieldname} to gather the variables. the example is
command => "iptables -A INPUT -s %{clientip} -j DROP"
mine is :
exec {
command => "/usr/local/nagioslogserver/scripts/send_nrdp.sh -su http://192.168.97.2/nrdp -t ######## -H localhost -s %{channel_name} -S %{sh_status} -o testfromlogserver"
}
Saleem THUPSEE