Làm 1 bài tổng hợp về các services này và share với mọi
Prometheus
Đã có 1 bài nói sơ về service này. Tuy nhiên cũng xin nói lại kĩ hơn 1 chút ( sau 1 thời gian sử dụng )
- Đây là 1 service giúp giám sát ( monitoring ) và cảnh báo ( alert ) về các hệ thống.
- Prometheus tiếp nhận data từ các nguồn services và storing dưới dạng database rồi sau đó provide các APIs để query – PromQL
- …
Tham khảo bài Prometheus để install. Version cập nhật cho đến hiện tại là 2.40.5 / 2022-12-01
Về cơ bản để install các services này thì
- Move binrary về /usr/local/bin
/bin : For binaries usable before the /usr partition is mounted. This is used for trivial binaries used in the very early boot stage or ones that you need to have available in booting single-user mode. Think of binaries like cat, ls, etc.
/sbin : Same, but for binaries with superuser (root) privileges required.
/usr/bin : Same as first, but for general system-wide binaries.
/usr/sbin : Same as above, but for binaries with superuser (root) privileges required.
You should use /usr/local/bin or /usr/local/sbin for system-wide available scripts. The local path means it's not managed by the system packages (this is an error for Debian/Ubuntu packages).
- Tạo SystemD service
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.listen-address=0.0.0.0:9090 \
--web.enable-lifecycle \
--web.enable-admin-api
SyslogIdentifier=prometheus
Restart=always
[Install]
WantedBy=multi-user.target
- Và sau đó tạo user & group
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
Leave a Reply