Prometheus System Monitoring Solution II installation and configuration

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Download Prometheus

Download the latest installation package, this article is described in the Linux x64 below, other platforms have not tried, please select the appropriate download.

    • Prometheus Main program, mainly responsible for storage, crawling, aggregation, query aspects.
    • Alertmanager program, mainly responsible for the implementation of the alarm function.
    • Pushgateway program, the main implementation is to receive the client push came over the indicator data, at a specified time interval, by the main program to crawl.
    • *_exporter These are integrations that have been implemented by different systems.

Download unzip, the general default configuration can be run.

tar xvfz prometheus-*.tar.gzcd prometheus-*

Go to write things, directly packaged into a binary package, its Ben no other dependency.

The following is a very important step to get to know about his configuration file.

Configuring Prometheus Monitoring Self

Prometheus exposes its performance metrics data through the default *http://localhost:9090/metrics* HTTP interface, and of course it can configure the fetch target targets for itself. Prometheus capturing its own performance data is a good example of opening the prometheus.yml file below the extracted directory.

# global configuration  global:   15s # default 15 seconds to fetch data at Target  # this label is generated by default on every time series on this machine, and can be Used for federated queries, Remote Storage, Alertmanger.  external_labels:  monitor:   # this represents the configuration of the crawl object  # setting fetch itself data   # job name This configuration is an example of a time sequence within this configuration, each of which automatically adds a label for this {job_name: "Prometheus"}.  - job_name:   ' Prometheus '  # overrides the global fetch interval time, which is rewritten from 15 seconds to 5 seconds.  scrape_interval:  5s static_configs:  -< /span> targets:  [  ' localhost:9090 '    

Start Prometheus

Start Prometheus using the configuration file that you just started.

./prometheus -config.file=prometheus.yml

This time Prometheus should start correctly, if the error, please check the configuration file. (Note: The YML format is required for indentation.) Use your browser to open the machine's *http://deployment machine: 9090*, or http://localhost:9090/can see the graph page of Prometheus. Generally wait a few seconds to crawl, there will be data written into the Prometheus inside.

If you have verified what performance data Prometheus yourself, you can open the Http://localhost:9090/metrics page to see it.

Prometheus By default is the number of CPU cores on how many OS threads, mainly by the GOMAXPROCS environment variable control, development go should be clear. The general default is good, too high words may bring unexpected consequences.
Prometheus by default probably consumes about 3G of memory, if you want to make it smaller, you have to modify the configuration file, or add the startup parameters.

Using Prometheus's own expression browser

If you want to see what data Prometheus has captured, you can use one of its built-in browsing pages. Open *http://localhost:9090/graph*, which is the graph page by default.
Try the expression input box in expressions:

Prometheus_target_interval_length_seconds

Query Promethues The length of time the target crawl interval. A number of time series are returned after execution, and the last captured value is listed in the Console. Different labels represent different intervals and time-consuming%.

If you want to query the crawl time of 99%, you can:

Prometheus_target_interval_length_seconds{quantile= "0.99"}

If you want to query how many times the time series is returned, you can do this:

Count (Prometheus_target_interval_length_seconds)

It's written here for the time being.

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.