devoops
Cover image

http_monitor for i3 (py3status)

published 26/01/2021 in Python | tags : Python, Linux, #100DaysToOffload, http

  Estimated read time: 2 min.

Whats http_monitor

A small script written to monitor some services running on my server. The goal was to have the status reflected in my desktop’s status bar which is running py3status. If you’re running i3, py3status and have some services (or websites) you’d like to monitor feel free to use this module.

Where to download

The script is available on github along with the installation directions.

Installation

git clone git@github.com:mcgillij/http_monitor.git ~/.i3/py3status/

Configuration

Next you will need to add the services you want to monitor, and optionally choose some appropriate emoji’s.

~/.config/i3/i3status.conf

...
general {
   colors = true
   interval = 15
}

order += "http_monitor apache"
order += "http_monitor medusa"
order += "http_monitor pihole"
order += "http_monitor nextcloud"
order += "http_monitor plex"
order += "http_monitor virtualbox"
order += "http_monitor airsonic"
order += "clock"
order += "mail"
...

http_monitor  'nextcloud' {
   service_location = "http://yourserver:8181"
   service_name = '⛅'
}

http_monitor  'virtualbox' {
   service_location = "http://yourserver:81/vb/"
   service_name = '💻'
}

http_monitor  'plex' {
   service_location = "http://yourserver:32400/web/index.html#"
   service_name = '🎥'
}

http_monitor  'airsonic' {
   service_location = "http://yourserver:4040"
   service_name = '🍃'
}

http_monitor  'pihole' {
   service_location = "http://yourserver:80"
   service_name = '🕳️ '
}

http_monitor  'apache' {
   service_location = "http://yourserver:81"
   service_name = '🪶'
}

http_monitor  'medusa' {
   service_location = "http://yourserver:8081"
   service_name = '🐍'
}

Configuration Options

You can pass in the following configuration options:

  • service_location
  • service_name
  • timeout (http timeout for the request, default=3)
  • cache_timeout (how often it gets refreshed, default=600)