/Monitoring

Playground for making my own monitoring solution. Not meant for productive use.

Primary LanguageJavaMIT LicenseMIT

Homepage Blog Fleet GitHub DockerHub Discord


Sources, GitHub, GitLab and Mirroring and all that good stuff

Repositories on GitHub are now for issues only. I've set up my own installation of GitLab and moved all my repositories over to Git.Griefed.de. Make sure to check there first for the latest code before opening an issue on GitHub.

For questions, you can always join my Discord server and talk to me there.


Monitoring

GitHub release (latest by date including pre-releases) GitHub

Docker Pulls Docker Image Size (latest by date) GitHub all releases GitHub Repo stars

A small Java monitoring program. Displays problematic hosts depending on their status.

Light mode Dark mode
light home dark home

[[TOC]]


Monitoring

All you need is a hosts.json file in the base directory in which you are executing Monitoring, and you're good to go. Here's an example for a hosts.json-file:

{
  "hosts": [
    {
      "name": "Griefed's Homepage",
      "address": "https://griefed.de",
      "ports": "9001,9002,9003,9004,9005"
    },
    {
      "name": "Griefed's Git Haven",
      "address": "https://git.griefed.de",
      "expectedIp": "159.69.152.189"
    },
    {
      "name": "Griefed's Wiki",
      "address": "https://wiki.griefed.de"
    },
    {
      "name": "GitHub",
      "address": "https://github.com"
    },
    {
      "name": "Indie Retro News",
      "address": "https://www.indieretronews.com"
    },
    {
      "name": "Example",
      "address": "https://example.com",
      "notificationsDisabled": true
    }
  ]
}

Each configured host can have a set of ports with which the host availability is checked in case a regular ping fails. If no host-individual port setting is available, the globally configured ports from the property de.griefed.monitoring.host.ports are used. If you set the property de.griefed.monitoring.ports.additive to true, the two settings are combined, resulting in a singular list consisting of host-individual ports and globally configured ports.

Bear in mind that the more ports you configure, the longer it can take to determine whether a host is available.

Default configuration

Default values are:

server.port=8080
...
de.griefed.monitoring.schedule.hosts=0 */5 * * * *
de.griefed.monitoring.polling=5000
de.griefed.monitoring.thread.count=100
de.griefed.monitoring.host.ports=20,21,22,80,443,8080,8443
de.griefed.monitoring.ports.additive=false
de.griefed.monitoring.particles.count=40
de.griefed.monitoring.schedule.updatecheck=0 0 0 * * *
de.griefed.monitoring.notifications=true
mail.smtp.starttls.enable=true
mail.smtp.auth=true
mail.smtp.host=smtp.example.com
mail.smtp.port=587
mail.recipients=example@example.com
mail.from=monitoring@example.com
mail.user=example@example.com
mail.password=123456
Property Description
de.griefed.monitoring.schedule.hosts Cron schedule at which host information is refreshed. To disable a cronjob, set it to -
de.griefed.monitoring.polling Milliseconds. Interval at which the frontend should refresh visible data.
de.griefed.monitoring.thread.count Number of threads to use for host information acquisition.
de.griefed.monitoring.host.ports Global configuration for ports with which to check for host availability.
de.griefed.monitoring.ports.additive Whether globally configured ports are to be added to host-individual ports, if configured.
de.griefed.monitoring.particles.count Amount of particles to display in the web-frontend.
de.griefed.monitoring.schedule.updatecheck Cron schedule at which to check for available updates. To disable a cronjob, set it to -
de.griefed.monitoring.notifications Whether notifications are enabled. Set to falseto disable all notifications.
mail.smtp.starttls.enable Whether STARTTLS is enabled.
mail.smtp.auth Whether authentication is required.
mail.smtp.host Your SMPT host.
mail.smtp.port The SMTP port of your host.
mail.recipients The recipient of the notification email.
mail.from The name from which the email is sent.
mail.user Username for your SMTP host.
mail.password Password for your SMTP host.

The docker image comes with a prepared hosts.json-file:

{
  "hosts": [
    {
      "name": "Griefed's Homepage",
      "address": "https://griefed.de"
    },
    {
      "name": "GitHub",
      "address": "https://github.com"
    }
  ]
}

Deploying Monitoring

Docker

version: '3'
services:
  monitoring:
    image: griefed/monitoring:latest
    container_name: monitoring
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - PUID=1000 # Your users ID
      - PGID=1000 # Your groups ID
    volumes:
      - ./monitoring/config:/config # Path on your host where configuration files of Monitoring will be stored.
    ports:
      - 8080:8080 # Port at which the application will be available at.

After the container is created and started, it will generate all default files in ./monitoring/config (unless you changed it). In order to customize the behaviour of Monitoring, first stop the container with docker stop monitoring, then edit the application.properties-file, or any other file you wish to change, in ./monitoring/config (unless you changed it), and run docker start monitoring again. Done!

Using the jar

Download the latest jar-file from the releases-page and execute it with java -jar Monitoring-$VERSION.jar. This will generate all default files and most importantly, the application.properties file. If you wish to customize this file, you need to quit Monitoring, make your changes to the application.properties and then start Monitoring again. Done!