0

Monitoring Linux Servers behind squid proxy via Nagioscore

Hi All,
This is my first post here, please help me.
I want to monitor a few redhat servers which are behind squid proxy server. I have done the below configuration:

RedHat Node behind proxy server configuration:-
I have installed nrpe and also copied check_disk, check_cpu and check_mem plugins under /usr/lib64/nagios/plugins.
I also added the below lines in /etc/nagios/nrpe.cfg file.

allowed_hosts=127.0.0.1,Squid_Proxy_server_IP
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$ -W $ARG3$ -C $ARG4$

Squid Proxy Server Configuration:-
I have also installed nrpe in squid proxy server and copied check_disk, check_cpu, check_mem, check_nrpe and check_ping plugins under /usr/lib64/nagios/plugins. I also added the below lines in /etc/nagios/nrpe.cfg file.

allowed_hosts=127.0.0.1,Nagios_server_IP
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$ -W $ARG3$ -C $ARG4$
command[check_proxy]=/usr/lib64/nagios/plugins/check_nrpe -t 60 -H $ARG1$ -c $ARG2$ -a $ARG3$ $ARG4$
command[check_ping]=/usr/lib64/nagios/plugins/check_ping -H $ARG1$ -w 3000.0,80% -c 5000.0,100% -p 5

If I run the below command from squid proxy server to RedHat server, I can get a correct output.
/usr/local/nagios/libexec/check_nrpe -H RedHat_IP -c check_disk -a 20% 10% /app
Also If I run the below command from nagios server to squid proxy server, I can get a correct output.
/usr/local/nagios/libexec/check_nrpe -H Proxy_server_IP -c check_disk -a 20% 10% /app
But if I run the below command to check the RedHat server status directly from nagios server via Proxy server I get "Error: Unable to read the output".
./check_nrpe -H Proxy_node_IP -c check_proxy -a RedHat_IP check_disk "20% 10% /app"

Please help as it has become quite critical for our environment.

Nagios Add a comment
muhibali
asked Oct 01 2021

Answer

0

I was working on this problem, and I'm happy to report that it has now been fixed.
Anyone who wishes to monitor servers hidden behind a Squid reverse proxy can do so by following the steps listed below. monkey mart

Add a comment
wunschtaria
asked Jun 08 2023
edited Jun 08 2023
Post your Answer
0

Hi All,,,
Sorry for the late comment...
I was working on this issue and I am excited to comment that finally the issue has been resolved.
For those who wants to monitor servers behind a squid reverse proxy can follow the below and make things done.
Proxy server Configuration:
vim /etc/nagios/nrpe.cfg

For proxy Server Monitoring

command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu -w $ARG1$ -c $ARG2$
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w $ARG1$ -c $ARG2$ -W $ARG3$ -C $ARG4$
command[check_procs]=/usr/lib64/nagios/plugins/check_procs -C $ARG1$ -c $ARG2$

Monitoring via nrpe fro servers behind proxy

command[check_proxy_disk]=/usr/lib64/nagios/plugins/check_nrpe -t 60 -H $ARG1$ -c $ARG2$ -a $ARG3$ $ARG4$ $ARG5$
command[check_proxy_mem]=/usr/lib64/nagios/plugins/check_nrpe -t 60 -H $ARG1$ -c $ARG2$ -a $ARG3$ $ARG4$ $ARG5$ $ARG6$
command[check_proxy_cpu]=/usr/lib64/nagios/plugins/check_nrpe -t 60 -H $ARG1$ -c $ARG2$ -a $ARG3$ $ARG4$
command[check_proxy_procs]=/usr/lib64/nagios/plugins/check_nrpe -t 60 -H $ARG1$ -c $ARG2$ -a $ARG3$

Add a comment
muhibali
asked Jan 11 2022
Post your Answer