How to use Datadog to monitor Nginx

Source: Internet
Author: User
Tags nginx host datadog
If you've read the previous how to monitor NGINX, you should know how much information you can get from several metrics in your network environment. And you see how easy it is to collect metrics from NGINX-specific foundations. But to achieve a comprehensive, continuous monitoring NGINX, you need a powerful monitoring system to store and visualize metrics that will alert you when an exception occurs. In this article, we will show you how to install NGINX monitoring using Datadog so that you can view these metrics in a customized dashboard:








NGINX Dashboard



Datadog allows you to build graphics and warnings with a single host, service, process, and metrics, or with almost any combination of them. For example, you can monitor all of your hosts, or all Nginx hosts in a specific availability zone, or you can monitor a key metric for all hosts with a specific label. This article will show you how to:


    • Monitor NGINX metrics on the Datadog dashboard, just like other systems

    • Set an automatic alert to notify you when a key indicator changes sharply


Configure NGINX



To collect Nginx metrics, you first need to make sure that Nginx has the status module enabled and a URL to report status metrics. Step-by-step configuration for open source Nginx and Nginx Plus see previous related articles.



Integrate Datadog and NGINX



Installing the Datadog Agent



The Datadog agent is an open source software that collects and reports metrics from your hosts so you can use Datadog to view and monitor them. Installing this agent usually requires only one command



As soon as your agent is up and running, you will see your host's Metrics report under your Datadog account.






Datadog Infrastructure List



Configure Agent



Next, you need to create a simple NGINX configuration file for the agent. The configuration directory of the agent in your system should be found here.



In the directory inside the Conf.d/nginx.yaml.example, you will find a simple configuration file that you can edit and provide the status URL and optional tags for each nginx instance:


    1. init_config:instances:-nginx_status_url:http://localhost/nginx_status/tags:-Instance:foo


When you provide the status URL and any tag, save the configuration file as Conf.d/nginx.yaml.



Restart Agent



You must restart the agent to load the new configuration file. The restart command is here, depending on the platform and different.



Check the configuration file



To check if Datadog and NGINX are properly integrated, run the Datadog Info command. The commands used by each platform look here.



If the configuration is correct, you will see an output like this:


    1. Checks======[...] Nginx------instance #0 [Ok]-collected8 metrics &0 Events


Installation integration



Finally, open "Nginx consolidation" in your Datadog account. This is very simple, just click the "Install Integration" button in the NGINX integration settings.






Install Integration



Index!



Once the agent has started reporting Nginx metrics, you will see an nginx dashboard appearing in the list of available dashboards in your Datadog.



The basic Nginx dashboard displays useful diagrams, which include a few key metrics in our Nginx monitoring presentation. (Some indicators, especially request processing time requirements for log analysis, Datadog not supported.) )



You can easily create a comprehensive dashboard to monitor your entire site's facilities by adding charts of important indicators beyond NGINX. For example, you might want to monitor your NGINX host-level metrics, such as system load. To build a custom dashboard, simply click on the option near the upper-right corner of the dashboard and select "Clone Dash" to clone a default NGINX instrument panel.






Clone Dash



You can also use Datadog's host map to monitor your nginx instances at a higher level, for example, to identify potential hotspots by color to indicate the CPU usage of all your nginx hosts.






NGINX Indicator Warning



Once Datadog captures and visualizes your indicator, you may want to build some monitoring to monitor your metrics automatically and when there is a problem reminding you. Here's a typical example: an indicator monitor that reminds you of a sudden drop in NGINX throughput.



Monitor NGINX throughput



Datadog indicator alerts can be "throughput-based" (when the indicator exceeds the SetPoint) or "based on the amplitude of change" (alerts if the indicator changes over a certain range). In this example, we will take the latter approach and alert us when the incoming request drops sharply every second. Falling often means having problems.


    1. Create a new indicator monitor. Select "New Monitor" from the "Monitors" drop-down list in Datadog. Select "Metric" as the monitor type.


      NGINX Metric Monitor

    2. Define your indicator monitor. We want to know the total number of requests that NGINX drops per second, so we define the sum of the Nginx.net.requestpers that we are interested in in the infrastructure.


      NGINX metric

    3. Sets the indicator alert condition. We want the alarm to change, rather than a fixed value, so we select "alert". We set the monitor to alert whenever the request volume drops by more than 30%. Here, we use a one-minute data window to represent the value of the "now" indicator, comparing the average change across that interval with the value of the previous 10-minute indicator.


      NGINX Metric Change Alert

    4. Custom notifications. If NGINX requests fall, we want to notify our team. In this example, we will send a notification to the OPS team's chat room and send a text message to the duty engineer. In "Say What's happening", we'll name the monitor and add a short message accompanying that notification, suggesting that you start the investigation first. We will use the Slack at the OPS team and @pagerduty send a warning to SMS.


      NGINX Metric Notification

    5. Save Integrated Monitoring. Click the "Save" button at the bottom of the page. You are now monitoring a key NGINX job indicator and will send a text message to the duty engineer when it falls fast.


Conclusion



In this article, we talked about visualizing your key metrics by integrating NGINX and Datadog, and notifying your team when there is a problem with your network infrastructure.



If you have been using your own Datadog account, you should now be able to greatly improve the visualization of your web environment, as well as the ability to create automatic monitoring of your environment, the patterns you use, and the metrics that are most valuable to your organization.



The above describes how to use Datadog monitoring Nginx, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.



The above is how to use Datadog monitoring nginx content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.