aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-12-27 20:41:09 +0700
committerShulhan <ms@kilabit.info>2025-12-27 20:47:15 +0700
commit5770c17fee881aa73da41648aa325a24d95fa3ea (patch)
treea37962d41f9b74ddb385d9e393f45cbef7337eba
parent5fa13d543a6a9527cc94625b2c158ffdb2e8e133 (diff)
downloadlilin-5770c17fee881aa73da41648aa325a24d95fa3ea.tar.xz
all: update the README and annotate some files using REUSE.toml
In the README, we add section on how building the program, the main configuration, and how to monitor the services using configuration. Inside the _www directory, we create doc/ directory that contains symlink to README.md as index.md. This allow us to serve the lilin as page under https://kilabit.info/project/lilin .
-rw-r--r--.gitignore4
-rw-r--r--Makefile6
-rw-r--r--README.md140
-rw-r--r--REUSE.toml12
l---------_www/doc/index.md1
-rw-r--r--testdata/var/log/lilin/service.d/.gitignore0
6 files changed, 160 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index d4a1563..d1dc80f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/Makefile b/Makefile
index 56bbe5b..f70d28a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index 27b26fa..083932d 100644
--- a/README.md
+++ b/README.md
@@ -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