| CARVIEW |
sensu-run: A tool to send command execution results to Sensu
sensu-run is a command line tool to send command execution results to Sensu
monitoring server.
[Skip to Readme]
Downloads
- sensu-run-0.7.0.5.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.0.0, 0.1.0, 0.1.1, 0.1.1.3, 0.2.0, 0.3.0, 0.4.0, 0.4.0.1, 0.4.0.2, 0.4.0.3, 0.4.0.4, 0.4.0.5, 0.5.0, 0.5.0.1, 0.5.0.2, 0.5.0.3, 0.6.0, 0.6.0.1, 0.6.0.2, 0.6.0.3, 0.6.1, 0.6.1.1, 0.7.0, 0.7.0.2, 0.7.0.3, 0.7.0.4, 0.7.0.5 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | aeson (>=0.11 && <1.5), async (<2.3), base (>=4.11 && <4.14), bytestring (>=0.10 && <0.11), directory (<1.4), filelock (<0.2), filepath (>=1.4.1 && <1.5), http-client (>=0.5.6 && <0.7), http-client-tls (<0.4), http-types (>=0.9.1 && <0.13), lens (>=4.15 && <4.20), network (>=2.2.3 && <3.2), optparse-applicative (>=0.12 && <0.16), process (>=1.6.3.0 && <1.7), temporary (>=1.1 && <1.4), text (>=1.2.2 && <1.3), time (>=1.5.0.1 && <1.10), unix (<2.8), unix-compat (<0.6), vector (>=0.11 && <0.13), wreq (>=0.5.0 && <0.6) [details] |
| Tested with | ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.2 |
| License | BSD-3-Clause |
| Copyright | Copyright (C) 2016-2019 Mitsutoshi Aoe |
| Author | Mitsutoshi Aoe |
| Maintainer | me@maoe.name |
| Uploaded | by MitsutoshiAoe at 2020-02-10T03:41:58Z |
| Category | System |
| Home page | https://github.com/maoe/sensu-run#readme |
| Bug tracker | https://github.com/maoe/sensu-run/issues |
| Source repo | head: git clone https://github.com/maoe/sensu-run.git -b develop |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Executables | sensu-run |
| Downloads | 14315 total (96 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs not available [build log] Last success reported on 2020-02-10 [all 3 reports] |
Readme for sensu-run-0.7.0.5
[back to package description]sensu-run
sensu-run runs a command and send its result to Sensu server using the client socket input or via the Sensu API. It is useful to monitor cron jobs for example.
Installation
NOTE: Currently sensu-run doesn't work on Windows. See #16.
Binary releases are available at GitHub Releases. Currently supported platforms for the binary releases are:
- Ubuntu (64bit)
- macOS
- Windows (x64, x86)
You can also build it yourself using stack:
stack install sensu-run
will install the sensu-run command in ~/.local/bin.
Usage
% sensu-run --help
Usage: sensu-run ([-n|--name NAME] [--source SOURCE] [--ttl SECONDS]
[--timeout SECONDS] [--handler HANDLER] ([--port PORT] |
[--server URL]) [--redirect] [--no-lock] [--dry|--dry-run]
[-s|--shell] [COMMAND] | [-v|--version])
Available options:
-h,--help Show this help text
-n,--name NAME The name of the check
--source SOURCE The check source, used to create a JIT Sensu client
for an external resource
--ttl SECONDS The time to live in seconds until check results are
considered stale
--timeout SECONDS The check executaion duration timeout in seconds
--handler HANDLER Sensu event handler(s) to use for events created by
the check
--port PORT Send results to the local sensu-client listening on
the specified port (default: 3030)
--server URL Send results to the specified Sensu server
--redirect Redirect command output to sensu-run's output
--no-lock Do not create a lock file to allow multiple instances
to run
--dry,--dry-run Dump the JSON object which is supposed to be sent
-s,--shell Execute the command using the shell
--dry-run option is useful to check the JSON output:
% sensu-run --name check-home-src-size --handler foo --dry-run -- du -s $HOME/src | jq .
{
"name": "check-home-src-size",
"command": "du -s /home/maoe/src",
"issued": 1501041549,
"executed": 1501041549,
"duration": 1.674895,
"status": 0,
"output": "55513524\t/home/maoe/src\n",
"handlers": [
"foo"
],
"user": "maoe"
}
Use the --shell option if you want to use shell functions:
% sensu-run --name check-home-src-size --handler foo --dry-run --shell -- "cd $HOME/src; du -s ." | jq .
{
"name": "check-home-src-size",
"command": "cd /home/maoe/src; du -s .",
"issued": 1501041568,
"executed": 1501041568,
"duration": 1.224157,
"status": 0,
"output": "55513524\t.\n",
"handlers": [
"foo"
],
"user": "maoe"
}
Without the --dry-run option, sensu-run sends the output to localhost:PORT, which is expected to be listened by sensu-client.
sensu-run sets the status field depending on the command exit code and timeout:
| command exit code | status field |
|---|---|
| 0 | 0 (OK) |
| non-zero | 2 (CRITICAL) |
| command timed out | 3 (UNKNOWN) |
Sensu API
sensu-run supports posting check results via Sensu API as well. Use --server option to specify Sensu server addresses. If multiple servers are specified, sensu-run tries them one by one until it succeeds.
sensu-run --name check-true --handler foo --server sensu1.example.com --server sensu2.example.com --dry-run -- du -s $HOME/src
Handling signals on UNIX systems
sensu-run traps the following signals and resends them to the monitored process:
- SIGHUP
- SIGINT
- SIGQUIT
- SIGTERM