1
0
mirror of https://github.com/pcvolkmer/checkbar.git synced 2025-04-19 11:06:50 +00:00
Paul-Christian Volkmer c83c00ace6
All checks were successful
CI / test (push) Successful in 1m0s
Code cleanup
2024-12-16 23:33:27 +01:00
2024-12-16 23:33:27 +01:00
2023-01-14 21:24:41 +01:00
2024-12-16 23:33:17 +01:00
2024-12-16 23:33:17 +01:00
2022-03-04 14:18:15 +01:00
2023-10-19 10:25:34 +02:00

This tool shows up/warn/down state of configured hosts or applications using i3bar input protocol.

checkbar.png

Usage

You should create a configuration file .checkbar.toml in your home directory, e.g.

# Update interval in seconds. Default value if not set is 60 sec.
interval = 60

# Time format (optional), defaults to "%R" (= "%H:%M)"
time_format = "%H:%M:%S" # = "%T"

[[checks]]
name = "Host 1"
url = "https://host1.example.com"

[[checks]]
name = "Host 2"
url = "https://host2.example.com"

[[checks]]
name = "App 1"
url = "https://app.example.com/actuator/health"
check_type = "Actuator"

[[checks]]
name = "App 2"
url = "tcp://app.example.com:12345"
check_type = "Tcp"

The value for interval can be set by using plain seconds or using units. Accepted units:

  • h, hour, hours

  • m, min, mins, minute, minutes

  • s, sec, secs, second, seconds

Unparseable values will default to 60 seconds.

# Update interval using seconds as number.
interval = 60

# or ...

# Update interval using value with units.
interval = "2m 30s"

The value for time_format is used to set the time format to be shown. It defaults to %R. For available options, see: https://docs.rs/chrono/latest/chrono/format/strftime/index.html

Each host or application to be checked consists of name and url.

You can optionally specify check_type:

  • Html: Default value, checks if a request is successful and returns HTTP OK - 200.

  • Actuator: Like Html, but checks if Actuator shows that the application is up and running.

    • Up: Actuator response indicates, application is up and running.

    • Warn: Got response, but it is not Actuator health UP response or redirect.

    • Down: No response.

  • Tcp: Checks if TCP connection to given host and port can be established

To use more than one configuration, pass the config file location to be used as first argument to the application.

$ checkbar /etc/checkbar_example.toml

Colors

To change the colors, use the following configuration. As an example, the colors of the default configuration are shown.

...
[colors]
up = "#00FF00"
warn = "#FFFF00"
down = "#FF0000"
...

The color configuration is optional. If used, all colors must be specified.

Colors are not available if running in terminal mode.

Execute commands

You can also specify a command to be executed when a mouse click occurs on a checked host. Use click_cmd to specify the command to be executed, e.g.

This is not available if running in terminal mode.

...
[[checks]]
name = "Host 1"
url = "http://host1.example.com"
click_cmd = "xterm -e ssh admin@host1.example.com"
...
Description
Show state of hosts or applications using i3bar input protocol
Readme MIT 189 KiB
Languages
Rust 100%