Skip to content

tobychui/imusutm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

圖片

imusutm

Baisc service up-time monitor and TOTP generator written in Golang

Usage

Double click the binary executable to run the up-time monitor.

Build from Source

git clone https://github.com/tobychui/imusutm
cd imusutm
go mod tidy
go build
./utm
(or .\utm.exe)

Setup Monitoring Server

Create a file named "config.json" and place it in the same folder to the binary executable.

{
 "Targets": [
    {
        "ID": "imus_homepage", //ID of the target
        "Name": "imuslab Homepage", //Name to show on the UI
        "URL": "https://imuslab.com", //URL to request
        "Protocol": "https" //Protocol to check online
    },
    //More endpoint here
 ],
 "Interval": 300, //Update interval in seconds
 "LogToFile": false, //Log results to file
 "RecordsInJson": 288 //How many records to keep, in this example, 300s (5 min) x 288 records per target = 1 day
}

To start the monitoring server, use the following command (Note the ":")

./utm -p :8089

You can also change the port if this port has already been occupied by another service.

Tips: You can add it to systemd as a service if you want it to startup with your other services on Linux

Setting up TOTP Code Generator

TOTP code generator was added after Github force me to enable 2FA to my account. You can setup a totp code generator with a config file name totp.json with the following contents.

{
 "Entries": [
  {
   "Name": "Example",
   "Secret": "JBSWY3DPEHPK3PXP",
   "Link": "example.com"
  },
	//Add more line if needed
 ]
}

Restart the application to see the new code generator running. 圖片

More Protocols Support

As I only need to ping my own web servers, I currently only implemented the following protocol. If you need more protocols, feel free to create a PR on this project.

  • http

  • https

Notes: You do not need to know php if you want to add more protocols. All changes are only nessary to be done in the Golang side

License

MIT License

Disclaimer

This is an internal tool design for my in-house use only. Use it with your own risk.