Code Monkey home page Code Monkey logo

uptimerobot_exporter's Introduction

uptimerobot_exporter

Maintainability codecov CodeFactor Known Vulnerabilities

uptimerobot_exporter is a Prometheus exporter for Uptimerobot.

Setup

Exporter

The easier way to setup this exporter is to use the Docker image on Docker Hub. Using a docker-compose.yaml:

version: "3"

services:
uptimerobot_exporter:
    image: paolobasso/uptimerobot_exporter
    container_name: uptimerobot_exporter
    environment:
    - UPTIMEROBOT_READ_API_KEY=your-api-key
    - INTERVAL_SECONDS=300
    - LOG_LEVEL=INFO
    - PORT=8000
    ports:
    - 8000:8000
    restart: unless-stopped

If Prometheus is in the same server an internal Docker network without exposing the metrics to the internet would be preferred.

Envirorment variables

Variable Required Default Description
UPTIMEROBOT_READ_API_KEY YES Your Uptimerobot read API key. Found on the Uptimerobot's My Settings page -> API Settings.
INTERVAL_SECONDS NO 300 How many seconds to wait between a scrape end and the next scrape.
You should use the Uptimerobot monitor's shortest interval.
LOG_LEVEL NO INFO The log level.
PORT NO 8000 The port where metrics will be exposed

Prometheus

Add a job to your Prometheus configs:

- job_name: 'uptimerobot'
   scrape_interval: 5m
   scrape_timeout: 300s # Same as INTERVAL_SECONDS env vars
   static_configs:
     - targets: 
        - 'localhost:8000' # Use the PORT env var (Default is 8000)

Metrics exposed

Metric Type Labels Description
uptimerobot_up Gauge The last scrape was successful
uptimerobot_scrape_duration_milliseconds Gauge The duration of the last scrape in seconds
uptimerobot_monitor_status Gauge id, url, name, type Status of the monitor: 0 = paused, 1 = not checked, 2 = up, 8 = seems down, 9 = down
uptimerobot_monitor_response_time_millisecond Gauge id, url, name, type, status Last response time of the monitor in milliseconds
uptimerobot_monitor_response_time_average_milliseconds Gauge id, url, name, type Average response time of the monitor in milliseconds
uptimerobot_monitor_log_type Gauge id, url, name, type Last log type of the monitor: 1 = down, 2 = up, 98 = started, 99 = paused
uptimerobot_monitor_log_datetime Gauge id, url, name, type, logtype Last log of the monitor datetime

Grafana Dashboard

You can find the Grafana dashboard to visualize the metrics exposed by this exporter here and it looks like this:

Dashboard

Why

I needed a Prometheus exporter for Uptimerobot and the existing ones that I found are either old, not updated, poorly documented or they expose not enough metrics. It was also an opportunity to learn more about Prometheus and Python.

Technologies

  1. Prometheus
  2. Uptimerobot
  3. Grafana
  4. Python
  5. Docker
  6. GitHub Actions

Things I learnt

  1. Using Uptimerobot to monitor websites uptime
  2. Creating a basic Prometheus Exporter with Python
  3. Creating a Grafana Dashboard from scratch
  4. Dockerizing a simple Python application
  5. Auto publishing Docker images to Docker Hub with GitHub actions
  6. Tesing a simple python application
  7. Self Hosting Prometheus
  8. Self Hosting Grafana
  9. Python Docstrings

License

GNU AFFERO GENERAL PUBLIC LICENSE Version 3

uptimerobot_exporter's People

Contributors

paolobasso99 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.