Exec plugin in nagios logserver

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
saleemthupsee
Posts: 107
Joined: Wed Feb 15, 2017 4:22 am
Location: Paris France
Contact:

Exec plugin in nagios logserver

Post by saleemthupsee »

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
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

Post by scottwilkerson »

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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
saleemthupsee
Posts: 107
Joined: Wed Feb 15, 2017 4:22 am
Location: Paris France
Contact:

Re: Exec plugin in nagios logserver

Post by saleemthupsee »

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
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

Post by scottwilkerson »

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:

Code: Select all

ls -l /usr/bin/send_nrdp.sh
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
saleemthupsee
Posts: 107
Joined: Wed Feb 15, 2017 4:22 am
Location: Paris France
Contact:

Re: Exec plugin in nagios logserver

Post by saleemthupsee »

please see below
-rwxr-xr-x 1 root root 8559 Aug 22 17:31 /usr/bin/send_nrdp.sh
Saleem THUPSEE
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Exec plugin in nagios logserver

Post by cdienger »

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

Post by saleemthupsee »

please see attached
You do not have the required permissions to view the files attached to this post.
Saleem THUPSEE
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Exec plugin in nagios logserver

Post by tacolover101 »

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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Exec plugin in nagios logserver

Post by mcapra »

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/logstash
Former Nagios employee
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

Post by saleemthupsee »

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"


}
Saleem THUPSEE
Locked