Welcome!

Server Monitoring Authors: Yeshim Deniz, Liz McMillan, Pat Romanski, Carmen Gonzalez, Ken Schwaber

Blog Feed Post

Nginx Reverse Proxy (NRP) monitoring

nignx monitoringNginx server currently occupies one of the most popular positions in the world. It is a free, open-source, high-performance HTTP server and reverse proxy, which is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Unlike traditional servers, Nginx doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture.

In order to monitor Nginx servers and make sure everything is running “nice and smoothly”, any sysadmin naturally has the option to turn on Nginx’s stub_stats module. However, notice that the statistics available for this popular module unfortunately often don’t convey enough information, especially if you are using Nginx as an HTTP reverse proxy or balancer.  This paper presents the possibility of using the Monitis custom monitor approach to perform online monitoring of a reverse proxy built on the Nginx server platform.

Usage approach

The possibilities for getting statistics from Nginx are very limited, but fortunately, it has a powerful feature to configure a log file. This makes it possible to create necessary statistics by configuring the log file and then watching and grabbing the monitoring data from it.

The presented monitor is divided into two parts: a watching part and a processing part.

The watching part follows the NRP monitor log and accumulates the necessary statistics. The processing part periodically reads the accumulated statistics, executes necessary calculations and sends them to the Monitismainserver.  Then you can simply see the NRP status online on your Monitis account dashboard.

Usually it is important to know while monitoring NRP what the input load is on the NRP server, how this load is divided between target servers and what the percentage of successful responses is, from the target servers.

The current monitor calculates and shows the following metrics:

  1. The input load to NRP (in_load)
    The number of requests which were received, divided by the observation time
  2. The load redirected to destination host 1 (out1_load)
    The number of requests redirected to destination host 1, divided by the observation time
  3. The load redirected to destination host 2 (out2_load)
    The number of requests redirected to destination host 2, divided by the observation time
  4. The percentage of requests which  were redirected to destination host 1 (out1_reqs)
  5. The percentage of requests which  were redirected to destination host 2 (out2_reqs)
  6. The percentage of successfully processed requests by destination host 1 (out1_2xx)
    The number of responses with a successful status code (2xx) relative to the total number of requests to destination host 1
  7. The percentage of successfully processed requests by destination host 2 (out2_2xx)
    The number of responses with a successful status code (2xx) relative to the total number of requests to destination host 2
  8. The common estimation of NRP state (status)

○     OK – normal working state

○     IDLE – idle state (don’t receive any requests)

○     DEAD – NRP is down (Nginx process isn’t found)

 

Notice that metrics 4 and 5 show the real distribution of requests between destination hosts. Their sum always should equal 100%.

NRP monitor log file configuration

The Nginx log format is very flexible, so you can build it by using a lot of Nginx runtime variables. To prepare your ownlogfile there are two directives:

log_format <name> <format pattern>
access_log <path> <[format name [buffer=size]] |> [off]

The log_format directive describes the format of a log entry. Most of the variables can be used to format a log file pattern. The access_log directive sets the path, format and buffer size for the access log file.

For example, the “Own log” file can be declared as follows:

# Own log format
log_format own ‘ $time_local | $server_name | $request_length ‘;
# Own access log
access_log /var/log/nginx/monitor.log own;

It was decided that this monitor log file should have the following format:

<status code>#<responding host address>  e.g.  404#12.13.11.12:80

To do this, we have to add 2 additional lines in the “/etc/ngnix/sites-available/default” config file near the definition of Nginx standard log files in the ngnix server block to define a new log file “monitor.log” like the following:

# definition of new log file format

log_format monitor '$upstream_status#$upstream_addr';

# specification of location for new log file

access_log /var/log/nginx/monitor.log monitor;

NRP monitor customization

The monitor consists of two main scripts – the watching and accumulating script (called monitor.sh) and the processing script (called nginx_monitor.sh) that periodically requests data, processes it and sends it to Monitis. Besides these, there is the Monitis OpenAPI wrapper script (called monitis_api.sh) and few serviced scripts. Thus, as you can see, it was fully implemented by using Linux Bash scripts.

To use it you should tune it by replacing some parameters (constants) by your own – APIKey, ServiceKey, HRP host IP, Target servers IPs, and so on. For detailed instructions you can look through the sourcecode.

NRP monitor test

The simplest configuration was chosen for testing of the reverse proxy.

Two destination hosts were simulating responses by generating random status codes with normal probability distribution and with mean value – 2xx successful code. The input load was generated by an HTTP generator which provided a load on NRP of about 1 request per second.

NRP was tuned to round-robin distribution so that the input load should have been distributed equally between the designated hosts. As result we got the following monitoring table in our Monitis account:

Notice that during the test the NRP was restarted. The monitor detected this and marked it as NRP DEAD status.

Double-clicking on any line will show more detailed additional information:

Double-clicking on the DEAD status line shows the following:

Naturally, it is possible to look at the graphical presentation of the monitored data:

This graph shows the distribution of requests between the two destination hosts. As you can see, the distribution of requests is done almost equally and the curves fluctuate around 50%, which is normal for our tests.

 

Share Now:del.icio.usDiggFacebookLinkedInBlinkListDZoneGoogle BookmarksRedditStumbleUponTwitterRSS

Read the original blog entry...

More Stories By Hovhannes Avoyan

Hovhannes Avoyan is the CEO of PicsArt, Inc.,

@ThingsExpo Stories
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
The best way to leverage your CloudEXPO | DXWorldEXPO presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering CloudEXPO | DXWorldEXPO will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at CloudEXPO. Product announcements during our show provide your company with the most reach through our targeted audienc...
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
JETRO showcased Japan Digital Transformation Pavilion at SYS-CON's 21st International Cloud Expo® at the Santa Clara Convention Center in Santa Clara, CA. The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get...
DXWorldEXPO LLC announced today that the upcoming DXWorldEXPO | CloudEXPO New York event will feature 10 companies from Poland to participate at the "Poland Digital Transformation Pavilion" on November 12-13, 2018.
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
"We view the cloud not as a specific technology but as a way of doing business and that way of doing business is transforming the way software, infrastructure and services are being delivered to business," explained Matthew Rosen, CEO and Director at Fusion, in this SYS-CON.tv interview at 18th Cloud Expo (http://www.CloudComputingExpo.com), held June 7-9 at the Javits Center in New York City, NY.
As data explodes in quantity, importance and from new sources, the need for managing and protecting data residing across physical, virtual, and cloud environments grow with it. Managing data includes protecting it, indexing and classifying it for true, long-term management, compliance and E-Discovery. Commvault can ensure this with a single pane of glass solution – whether in a private cloud, a Service Provider delivered public cloud or a hybrid cloud environment – across the heterogeneous enter...
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
More and more brands have jumped on the IoT bandwagon. We have an excess of wearables – activity trackers, smartwatches, smart glasses and sneakers, and more that track seemingly endless datapoints. However, most consumers have no idea what “IoT” means. Creating more wearables that track data shouldn't be the aim of brands; delivering meaningful, tangible relevance to their users should be. We're in a period in which the IoT pendulum is still swinging. Initially, it swung toward "smart for smart...
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
In an era of historic innovation fueled by unprecedented access to data and technology, the low cost and risk of entering new markets has leveled the playing field for business. Today, any ambitious innovator can easily introduce a new application or product that can reinvent business models and transform the client experience. In their Day 2 Keynote at 19th Cloud Expo, Mercer Rowe, IBM Vice President of Strategic Alliances, and Raejeanne Skillern, Intel Vice President of Data Center Group and ...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
We are seeing a major migration of enterprises applications to the cloud. As cloud and business use of real time applications accelerate, legacy networks are no longer able to architecturally support cloud adoption and deliver the performance and security required by highly distributed enterprises. These outdated solutions have become more costly and complicated to implement, install, manage, and maintain.SD-WAN offers unlimited capabilities for accessing the benefits of the cloud and Internet. ...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...