Nagios checks failing with error restricted path in error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Nagios checks failing with error restricted path in error

Post by mohan23 »

Hi,

We have mod gearman integrated with nagios and we are trying to monitoring vms that are in azure and we are seeing below error.

"ERROR: restricted path in effect, but command contains forbidden charater"

We have below entries in our worker.conf file

restrict_path=/usr/local/nagios/libexec

also plugin path is same on nagios and mod gearman worker node

Can some one suggest what can be done to fix this?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios checks failing with error restricted path in erro

Post by scottwilkerson »

From the mod_gearman documentation
restrict_path

‘restrict_path` allows you to restrict this worker to only execute plugins from these particular folders. Can be used multiple times to specify more than one folder. Note that when this restriction is active, no shell will be spawned and no shell characters ($&();<>`"’|) are allowed in the command line itself.

Code: Select all

restrict_path=/usr/local/plugins/
https://labs.consol.de/nagios/mod-gearman/index.html

Based on the above, combined with the error you are getting, I would suspect your command contains one of the following which is throwing the error

Code: Select all

$&();<>`"’|
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Nagios checks failing with error restricted path in erro

Post by mohan23 »

I have disable restrict path in worker.conf and I still see the same error

I ran gearmand -V and I see version as 0.33
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios checks failing with error restricted path in erro

Post by scottwilkerson »

Did you restart all the worker services (including the one on the local nagios server) after changing the restrict path on all of the configs?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Nagios checks failing with error restricted path in erro

Post by mohan23 »

Yes I did, that restrict path error has gone. But I'm seeing another receive header error. Below is the complete error.

CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expexted). I see below errors in gearmand.log( see logs in attached screenshot)
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios checks failing with error restricted path in erro

Post by scottwilkerson »

The errors in the screenshot don't appear to be related to a NRPE error.

Are you sure all of your serves have all of the workers IP addresses in their nrpe.cfg as allowed hosts?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Nagios checks failing with error restricted path in erro

Post by mohan23 »

Those errors are from gearmand.log not from nrpe
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios checks failing with error restricted path in erro

Post by scottwilkerson »

mohan23 wrote:Those errors are from gearmand.log not from nrpe
You got this in the gearmand.log?

Code: Select all

CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expexted)
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Nagios checks failing with error restricted path in erro

Post by mohan23 »

I see these in web console
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios checks failing with error restricted path in erro

Post by scottwilkerson »

Which leads back to my question
scottwilkerson wrote:Are you sure all of your servers have all of the workers IP addresses in their nrpe.cfg as allowed hosts?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked