diff options
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | README.md | 140 | ||||
| -rw-r--r-- | REUSE.toml | 12 | ||||
| l--------- | _www/doc/index.md | 1 | ||||
| -rw-r--r-- | testdata/var/log/lilin/service.d/.gitignore | 0 |
6 files changed, 160 insertions, 3 deletions
@@ -1,6 +1,8 @@ -## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> ## SPDX-License-Identifier: GPL-3.0-only +## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> +/_www/doc/index.html /cover.html /cover.out +/lilin /testdata/var/log/lilin/service.d/*.log @@ -1,5 +1,5 @@ -## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> ## SPDX-License-Identifier: GPL-3.0-only +## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> .PHONY: all all: lint test @@ -24,3 +24,7 @@ dev.test: truncate --size=0 testdata/var/log/lilin/service.d/tcp.log truncate --size=0 testdata/var/log/lilin/service.d/udp.log go run ./cmd/lilin -dev -basedir=testdata/ + +.PHONY: serve.docs +serve.docs: + ciigo serve _www/doc @@ -1,5 +1,127 @@ +<!-- +SPDX-License-Identifier: GPL-3.0-only +SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> +--> + # lilin +Lilin is service monitoring for HTTP and TCP services. + +Features, + +- Monitoring HTTP, TCP, UDP services +- Sending notification when service up or down through, + - Mattermost incoming webhook + +## Building + +To build lilin program, you need +[Go compiler](https://go.dev/dl). +Once you have installed and setup the Go compiler, run the following command +to build the program, + + $ go build ./cmd/lilin + +The above command will create executable file named `lilin` in the current +directory. + +## Command options + +The lilin program has the following options, + +**-basedir**:: set the base directory for reading main configuration, +service configurations, and storing the service logs. +If not defined, its default to "/". + +## Main configuration + +Lilin read the main configuration from `${BASEDIR}etc/lilin/lilin.cfg`. +The configuration is written in +[INI file format](https://pkg.go.dev/git.sr.ht/~shulhan/pakakeh.go/lib/ini). + +The `$BASEDIR` variable can be changes during running lilin program with +`-basedir` option. +For example, + + $ lilin -basedir ./monitoring + +The `lilin.cfg` has the following format, + +``` +[server] +address = +``` + +**address**:: define the HTTP server address to view the status of monitored +services from web browser, default to 127.0.0.1:14507. + +## Monitoring services + +Lilin monitor the services by reading each service configuration inside the +`${BASEDIR}etc/lilin/service.d/` directory. +Each service configuration is written in INI file format and must have +`.cfg` file extension. + +The service configuration has the following format, + +``` +[service] +name = +address = +method = +timeout = +interval = +``` + +**name**:: The human readable service name. + +**address**:: The address of service to be monitored, using scheme based. +For example + +- `http://example.com/health` for monitoring HTTP service, +- `https://example.com:8443/health` for monitoring HTTPS service, +- `tcp://127.0.0.1:22` for monitoring TCP service, +- `udp://127.0.0.1:53` for monitoring UDP service. + +**method**:: The HTTP method to be used to inquiry the HTTP or HTTPS +service, default to GET. +Supported method are DELETE, GET, HEAD, PATCH, POST, or PUT. + +**timeout**:: Timeout for connecting and reading the response, default to 5 +seconds. +Timeout format is using suffix `s` for second, `m` for minute, and `h` for +hour. + +**interval**:: Interval between each scan, default and minimum value is 10 +seconds. +Interval format is using suffix `s` for second, `m` for minute, and `h` for +hour. + +For example to monitor HTTP service at http://127.0.0.1:8080 every 5 minutes +using HTTP method `HEAD` with timeout 60 seconds, create file named +`myhttp.cfg` inside the `$BASEDIR/etc/lilin/service.d/` directory with the +following content, + +``` +[service] +name = myhttp +address = http://127.0.0.1:8080 +method = HEAD +interval = 5m +timeout = 60s +``` + +Sample of service configuration that monitor TCP service at +127.0.0.1:5432 every 90 seconds with timeout 30 seconds, + +``` +[service] +name = my-tcp-service +address = tcp://127.0.0.1:5432 +interval = 90s +timeout = 30s +``` + ## Notification Lilin support sending notification to, @@ -10,7 +132,7 @@ See the next section on how to use the notification. ### Mattermost incoming webhook -In the server configuration, add the section "notif" with the following +In the main configuration, add the section "notif" with the following format, ``` @@ -47,3 +169,19 @@ will be rendered as ``` 2025-09-26 06:38:11 +0000 UTC: Service http-server is down: 503 Service Unavailable ``` + +## Links + +[Project page](https://sr.ht/~shulhan/lilin). + +[Repository](https://git.sr.ht/~shulhan/lilin) -- +The repository of this software project. + +[Mailing list](https://lists.sr.ht/~shulhan/lilin) -- +Place for discussion and sending patches. + +[Issues](https://todo.sr.ht/~shulhan/lilin) -- +Place to open new issue or request for new feature. + +[Changelog](https://kilabit.info/project/lilin/CHANGELOG.html) - Log for +each release. diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 0000000..41e3968 --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,12 @@ +## SPDX-License-Identifier: GPL-3.0-only +## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info> + +version = 1 + +[[annotations]] +path = [ + "_www/doc/index.html", + "testdata/var/log/lilin/service.d/*.log", +] +SPDX-FileCopyrightText = "2025 M. Shulhan <ms@kilabit.info>" +SPDX-License-Identifier = "GPL-3.0-only" diff --git a/_www/doc/index.md b/_www/doc/index.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/_www/doc/index.md @@ -0,0 +1 @@ +../../README.md
\ No newline at end of file diff --git a/testdata/var/log/lilin/service.d/.gitignore b/testdata/var/log/lilin/service.d/.gitignore new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testdata/var/log/lilin/service.d/.gitignore |
