https://github.com/mattipv4/monitors
Uptime monitoring (or really any monitoring that can throw an error) through Node.js & GitHub Actions.
https://github.com/mattipv4/monitors
Last synced: 9 months ago
JSON representation
Uptime monitoring (or really any monitoring that can throw an error) through Node.js & GitHub Actions.
- Host: GitHub
- URL: https://github.com/mattipv4/monitors
- Owner: MattIPv4
- License: apache-2.0
- Created: 2021-01-08T20:56:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T19:53:59.000Z (11 months ago)
- Last Synced: 2025-03-28T17:11:08.390Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 329 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# monitors
## About
Uptime monitoring (or really any monitoring that can throw an error) through Node.js & GitHub Actions.
Add files to the [`monitors`](monitors) directory and they'll be run every 5 minutes by GitHub Actions (triggered by Cloudflare Workers cron, as this is more reliable that Actions schedule).
Any monitor that throws an error will fail and will be reported as a failed job in Actions.
The GitHub Actions workflow has two defined steps, though the second is dynamic and dictated by the output of the first.
The first workflow, called `locate`, establishes two real outputs -- the Node.js version to use (set in [`.nvmrc`](.nvmrc)) and the set of monitors to run as jobs (the files in [`monitors`](monitors)).
It also does a full install of Node.js and our dependencies itself, with the Cache action running, so that the latest version of our dependencies are cached before the monitors all run.
The script that locates the monitors and outputs them in a JSON format for the Actions workflow is [`src/locate.js`](src/locate.js).
The second job, `monitor`, is then run once for every monitor in the matrix output of the `locate` job.
This job uses the set Node.js version from the `locate` job as well, installing the cached NPM dependencies and running the monitor from the matrix.
The script that runs the specified monitor in the Actions job is [`src/monitor.js`](src/monitor.js).
This script will locate and execute the given monitor, outputting if it passed or failed, along with the appropriate exit code.
*If you need to run all monitors locally, install `jq` and then use `npm run all`.
A single monitor can be run in the same way the Actions workflow executes it, with `npm run monitor -- {{monitor_name}}`.*
## License
This project is licensed under [Apache 2.0](LICENSE).