◆Home Improvement Ideas Journal

Prometheus HTTP Targets on 9090

By

Prometheus is an open-source monitoring and alerting toolkit that provides a robust time-series database, robust query language, efficient data collection, and more. One of the key aspects of Prometheus is its ability to scrape metrics from HTTP endpoints, making it highly versatile and useful for monitoring various types of systems and applications. The default HTTP scraping endpoint in Prometheus is on port 9090, which it uses to fetch data from configured targets.

In this comprehensive guide, we will explore the usage of http://prometheus.io:9090 or http://IP_ADDRESS:9090 to scrape metrics from Prometheus' targets, understand the target configuration process, and delve into the different scraping methods available.

Configuring Prometheus Targets

Before diving into the scraping process, it's crucial to understand how to configure targets in Prometheus. Targets are the systems or applications from which Prometheus scrapes metrics.

Prometheus Templates
Prometheus Templates
a man standing on top of a stage surrounded by lights
a man standing on top of a stage surrounded by lights
a man standing in the middle of a dark room next to a giant clock tower
a man standing in the middle of a dark room next to a giant clock tower

Targets can be configured using various methods, including static configuration files, using the service discovery, or even dynamically updating based on factors like labels or instances.

Static Configuration

One of the most basic ways to configure targets is by specifying them statically. This can be done by adding the targets in the Prometheus configuration file (usually located at /etc/prometheus/prometheus.yml). Here's an example:

a man covered in mud and water with his hands out to the side, on a cloudy day
a man covered in mud and water with his hands out to the side, on a cloudy day
My Style
My Style
an image of a target with the words term blag and clear written on it
an image of a target with the words term blag and clear written on it
scrape_configs:
  - job_name: 'test'
    static_configs:
    - targets: ['example.com:80', '192.168.1.1:80']

Service Discovery

Service discovery is another powerful feature of Prometheus. It allows Prometheus to discover and monitor new targets automatically based on certain criteria. Examples of service discovery include Kubernetes service discovery and DNS-based service discovery.

Scraping Metrics from Targets

Once targets are properly configured, Prometheus begins scraping metrics from them at regular intervals. The default scraping interval is 15 seconds.

Prometheus supports multiple methods for scraping metrics, including the HTTP json format, plaintext format, and others. Let's explore these methods.

Computer Warriors, Cyberpunk Greece, God Of Technology Art, Futuristic Greek Gods, God Of Technology, Cyberpunk Zeus, Equations, Dark Fantasy Art, Dark Fantasy
Computer Warriors, Cyberpunk Greece, God Of Technology Art, Futuristic Greek Gods, God Of Technology, Cyberpunk Zeus, Equations, Dark Fantasy Art, Dark Fantasy
an image of a man with headphones on his face and the words promtheus above him
an image of a man with headphones on his face and the words promtheus above him
PROMETHEUS, COLIN SHULVER
PROMETHEUS, COLIN SHULVER
four different views of the same object with green dots on each side and arrows pointing in opposite directions
four different views of the same object with green dots on each side and arrows pointing in opposite directions
a man standing in front of a giant screen
a man standing in front of a giant screen
a man standing in front of a futuristic display
a man standing in front of a futuristic display

HTTP JSON

The HTTP JSON scraping method is one of the most common. It involves Prometheus sending an HTTP GET request to the target's endpoint, usually on port 9090, and expecting JSON-formatted data in response. This data is then parsed by Prometheus and stored in its time-series database.

Plaintext Instant Vectors

Plaintext instant vectors method is another way of scraping metrics. Instead of sending an HTTP GET request, Prometheus sends a line to the target's input, which then replies with an instant vector in the plaintext format.

Tip: Always ensure that the targets' endpoints are correctly set up and that they respond to Prometheus' requests with the expected data format.

the words in green are written on a black background
the words in green are written on a black background
Prometheus (@PrometheusMovie) on X
Prometheus (@PrometheusMovie) on X
an abstract scene with blue and green lights
an abstract scene with blue and green lights
the poster for promtheus
the poster for promtheus
Prometheus (2012) — Vincent Studios
Prometheus (2012) — Vincent Studios
Brain Waves, Silver Dragon, Study Planner, Cyberpunk
Brain Waves, Silver Dragon, Study Planner, Cyberpunk
an image of some kind of artwork in the dark
an image of some kind of artwork in the dark
an alien like creature is standing in the dark
an alien like creature is standing in the dark
a large rock formation in the desert under a cloudy sky
a large rock formation in the desert under a cloudy sky
a futuristic car in the dark with glowing lights on it's head and body
a futuristic car in the dark with glowing lights on it's head and body
Math Wallpaper, Intelligence Officer, Cybersecurity Training, Cute Lazy Day Outfits, Training Programs, How To Know
Math Wallpaper, Intelligence Officer, Cybersecurity Training, Cute Lazy Day Outfits, Training Programs, How To Know
an image of a computer screen with data on it
an image of a computer screen with data on it
Prometheus
Prometheus
an image of men in suits and hats with green lights on their faces at night
an image of men in suits and hats with green lights on their faces at night

With this understanding of how to configure targets and scrape metrics from them, you can now effectively use Prometheus to monitor your systems and applications. Whether you're scraping metrics from localhost:9090 or from distributed targets, the process remains the same.

Remember to continually validate your target configurations and monitor the logs for any errors or issues. Always keep your Prometheus server and its targets up-to-date with the latest security patches and performance improvements.

Happy monitoring!