https://github.com/ggiamarchi/http-check
Run system commands through HTTP
https://github.com/ggiamarchi/http-check
commands http linux monitoring monitoring-tool system-commands
Last synced: 3 months ago
JSON representation
Run system commands through HTTP
- Host: GitHub
- URL: https://github.com/ggiamarchi/http-check
- Owner: ggiamarchi
- License: mit
- Created: 2017-04-13T15:03:29.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-30T12:56:42.000Z (almost 7 years ago)
- Last Synced: 2024-10-11T18:01:44.664Z (9 months ago)
- Topics: commands, http, linux, monitoring, monitoring-tool, system-commands
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTP Check
[](https://travis-ci.org/ggiamarchi/http-check)
HTTP Check is a simple tool that exposes any system command with a single HTTP endpoint. HTTP response code
differs depending command status code.## Configuration
Here is an sample configuration file :
```yaml
---checks:
- name: "ping-10.1.1.2"
command:
executable: "/sbin/ping %s %d %s"
args: ["-c", 2, "10.100.0.1"]
status:
failure: 223
success: 200
- name: "ping-google"
command:
executable: "/sbin/ping %s %d %s"
args: ["-c", 2, "8.8.8.8"]
status:
failure: 503
success: 204server:
port: 2323
```## Installation
1. Download http-check binary from github release
2. Create configuration file. Default location is `/etc/http-check/http-check.yml`. You can specificy custom location on the command line when running the server## Run the server
Basically run the binary
```
$ http-check server
```Or, with a custom configuration file location
```
$ http-check server --config /etc/http-check.yml
```## Run checks
Clients use a single endpoint to run any check.
__Request__
```
GET /v1/check/{name}
```__Response__
```
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Wed, 29 Aug 2018 13:18:13 GMT
Content-Length: 350{
"error":"",
"stderr":"",
"stdout":"PING 8.8.8.8 (8.8.8.8): 56 data bytes\n64 bytes from 8.8.8.8: icmp_seq=0 ttl=121 time=12.676 ms\n64 bytes from 8.8.8.8: icmp_seq=1 ttl=121 time=20.267 ms\n\n--- 8.8.8.8 ping statistics ---\n2 packets transmitted, 2 packets received, 0.0% packet loss\nround-trip min/avg/max/stddev = 12.676/16.471/20.267/3.796 ms\n"
}
```__NB.__ Status code depends the YAML check configuration.
# License
Everything in this repository is published under the MIT license.