Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Monitoring squid proxy server with Nagios log server

by | Dec 29, 2020

For monitoring squid proxy server with Nagios log server, we first download filter, create a filter and then configure Squid Server to send the Logs

Here at Bobcares, we have seen several such Nagios-related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at how to monitor the squid proxy server with Nagios log server.

 

Monitoring squid proxy server with Nagios log server

Now let’s see how our Support Engineers integrate the Squid Proxy server logs into Nagios Log Server. We look into the details of how to configure a server running Squid to send logs to the Nagios Log Server, and how to configure the Filters in the Nagios Log Server to parse the logs from Squid.

The Nagios Log Server manages logs that will allow Admins using Squid Proxy server to quickly and easily see what is accessed and request from users. Here we are considering an example which is using CentOS 7 server with a Squid Proxy server installed via yum. For this example:

• The default logs are in /var/log/squid/
• There are two log files
◦ access.log = logs web requests and results
◦ cache.log = logs the error and debug message from squid

 

Download Filter

As a first step, we download a filter. A Filter is how the received log data is broken up into fields that are stored in the Elasticsearch database. It makes use of regular expressions to break apart the data and hence can be quite complicated.

For that, we navigate to the following URL:

https://github.com/T-M-D/NLS-Collection/blob/master/Filters/Squid.txt

Next, we copy everything from this line to the end of the file into the clipboard:

if [program] == ‘squid_access’ {

We will paste this into the new filter that we will create in the next step.

 

Create Filter

Now, we open the web interface for our Nagios Log Server instance as an administrator. Next, we navigate to Configure >> Global (All Instances) >> Global Config.

monitoring squid proxy server with nagios log server

On the right side of the page, we click the ‘+ Add Filter’ button and select ‘Custom’.

A new filter appears. Here we need to provide a title in the Block Name field. Then in the text area field, we paste the filter that we previously copied into our clipboard.

Finally, we click the Save button to create a new filter.

At this point, we click the Verify button to ensure the filter we just created is valid or not. Once the verification is successful, we apply the configuration. In the left pane under Configure click Apply Configuration. We click the Apply button and then click ‘Yes, Apply Now’ when prompted.

 

Configure Squid Server to send the Logs

Now after creating the filter, we need to configure the Squid server to send the access.log and cache.log files to the Nagios Log Server instance.

Note: In the following steps we have replaced xxx.xxx.xxx.xxx with the address of the Nagios Log Server instance that will be receiving the logs.

First, we establish a terminal session to our Nagios XI or Nagios Core server and execute the following commands:

# cd /tmp
# curl -s -O http://xxx.xxx.xxx.xxx/nagioslogserver/scripts/setup-linux.sh
# bash setup-linux.sh -s xxx.xxx.xxx.xxx -p 5544 -f /var/log/squid/access.log -t squid_access
# bash setup-linux.sh -s xxx.xxx.xxx.xxx -p 5544 -f /var/log/squid/cache.log -t squid_cache

After executing these commands the Squid server will send the Squid logs to the Nagios Log Server. So now we can search for squid on the Dashboards page and see the results coming in, confirming that everything is correctly configured.

 

Dashboards

Once we receive some log data we will be able to visualize that data using panels. So we start off by adding a new row. At the bottom right of the screen click the ‘+ ADD A ROW’ link.

  • Here, we give the row a Title and then click the Create Row button.
  • Next, we use the up arrow icon to move it to the top of the list.
  • Finally, we click Save.

On the new row, we click the ‘Add panel to empty row’ button.

monitoring squid proxy server with nagios log server

  • Under ‘Select Panel Type’, we choose terms
  • Next, we give it the title of HTTP Method
  • Field = http_method
  • Style = pie
  • Finally, we click Save

After that, we click the ‘Add Panel’ button

  • Under ‘Select Panel Type’, we choose histogram
  • Next, we give it the title of Request Time. Then for the below options, we provide:
  • Chart value = total
  • Value Field = request_msec
  • Chart Options
  • Un-check Bars
  • Check Lines
  • Finally, we click Save

Click the ‘Add Panel’ button

  • Under ‘Select Panel Type’, we choose terms
  • Next, we give it the title of Protocols
  • Field = protocol
  • Style = table
  • Click Save

[Need any further assistance with Nagios related queries? – We are here to help you]

 

Conclusion

Today, we saw how our Support Engineers configure the Nagios log server to use a proxy server.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF