https://github.com/kkirsche/cronmon
Cron monitoring software
https://github.com/kkirsche/cronmon
cron monitoring
Last synced: 2 months ago
JSON representation
Cron monitoring software
- Host: GitHub
- URL: https://github.com/kkirsche/cronmon
- Owner: kkirsche
- License: apache-2.0
- Created: 2017-03-08T00:20:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-04T17:28:25.000Z (about 8 years ago)
- Last Synced: 2025-03-06T15:28:11.109Z (over 1 year ago)
- Topics: cron, monitoring
- Language: Go
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cron Monitor
## Setup
Golang Dependencies:
```shell
go get -u -v github.com/gorhill/cronexpr
go get -u -v github.com/prometheus/client_golang/prometheus
go get -u -v github.com/jmoiron/sqlx
go get -u -v github.com/lib/pq
go get -u -v github.com/sirupsen/logrus
go get -u -v github.com/labstack/echo
go get -u -v github.com/labstack/echo/middleware
go get -u -v github.com/prometheus/client_golang/prometheus/promhttp
go get -u -v github.com/spf13/cobra
```
Terminal A:
```shell
cockroach start --insecure --store=cronmon --host=localhost
```
Terminal B:
```shell
cockroach user set evilroach --insecure
cockroach sql --insecure -e 'CREATE DATABASE cronmon'
cockroach sql --insecure -e 'GRANT ALL ON DATABASE cronmon TO evilroach'
cronmon server
```
## Usage
### Create Task to Monitor
#### cURL
Request:
```shell
curl -XPOST -H 'Content-Type: application/json' -d '{ "name": "Example Task", "description": "This is an example task for the cronmon README file", "cron_expression": "* * * * *"}' http://localhost:8080/api/v1/tasks
```
Response (formatted for readability via jq):
```json
{
"id": 345302135986061313,
"name": "Example Task",
"description": "This is an example task for the cronmon README file",
"cron_expression": "* * * * *",
"created_at": {
"Time": "2018-05-04T15:35:36.949293868Z",
"Valid": false
},
"created_by": "system",
"updated_at": {
"Time": "2018-05-04T15:35:36.949309482Z",
"Valid": false
},
"updated_by": "system",
"last_started": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
},
"last_completed": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
}
}
```
### Get a task
#### cURL
Request:
```shell
curl -XGET -H 'Content-Type: application/json' http://localhost:8080/api/v1/tasks/345302135986061313
```
Response (formatted for readability via jq):
```json
{
"id": 345302135986061300,
"name": "Example Task",
"description": "This is an example task for the cronmon README file",
"cron_expression": "* * * * *",
"created_at": {
"Time": "2018-05-04T15:37:29.109985Z",
"Valid": true
},
"created_by": "system",
"updated_at": {
"Time": "2018-05-04T15:37:29.109985Z",
"Valid": true
},
"updated_by": "system",
"last_started": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
},
"last_completed": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
}
}
```
### Get all tasks
#### cURL
Request:
```
curl -XGET -H 'Content-Type: application/json' http://localhost:8080/api/v1/tasks
```
Response (formatted for readability via jq):
```
[
{
"id": 345308099987341300,
"name": "Example Task",
"description": "This is an example task for the cronmon README file",
"cron_expression": "* * * * *",
"created_at": {
"Time": "2018-05-04T16:07:49.177496Z",
"Valid": true
},
"created_by": "system",
"updated_at": {
"Time": "2018-05-04T16:07:49.177499Z",
"Valid": true
},
"updated_by": "system",
"last_started_at_time": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
},
"last_started_by_host": {
"String": "",
"Valid": false
},
"last_completed_at_time": {
"Time": "0001-01-01T00:00:00Z",
"Valid": false
},
"last_completed_by_host": {
"String": "",
"Valid": false
}
}
]
```