프로메테우스 다운로드
https://prometheus.io/download/
프로메테우스 설치
아래 매뉴얼을 따라하시면 별도로 다운로드를 하지 않으셔도 됩니다.
[root@tmplogsvr ~]# groupadd --system prometheus
[root@tmplogsvr ~]# useradd -s /sbin/nologin --system -g prometheus prometheus
[root@tmplogsvr ~]# mkdir /var/lib/prometheus
[root@tmplogsvr ~]# for i in rules rules.d files_sd; do mkdir -p /etc/prometheus/${i}; done
[root@tmplogsvr ~]# curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -
[root@tmplogsvr ~]# tar xvf prometheus-2.42.0.linux-amd64.tar.gz
prometheus-2.42.0.linux-amd64/
prometheus-2.42.0.linux-amd64/NOTICE
prometheus-2.42.0.linux-amd64/consoles/
prometheus-2.42.0.linux-amd64/consoles/index.html.example
prometheus-2.42.0.linux-amd64/consoles/node.html
prometheus-2.42.0.linux-amd64/consoles/prometheus-overview.html
prometheus-2.42.0.linux-amd64/consoles/node-disk.html
prometheus-2.42.0.linux-amd64/consoles/prometheus.html
prometheus-2.42.0.linux-amd64/consoles/node-overview.html
prometheus-2.42.0.linux-amd64/consoles/node-cpu.html
prometheus-2.42.0.linux-amd64/console_libraries/
prometheus-2.42.0.linux-amd64/console_libraries/menu.lib
prometheus-2.42.0.linux-amd64/console_libraries/prom.lib
prometheus-2.42.0.linux-amd64/prometheus.yml
prometheus-2.42.0.linux-amd64/LICENSE
prometheus-2.42.0.linux-amd64/promtool
prometheus-2.42.0.linux-amd64/prometheus
[root@tmplogsvr ~]# cd prometheus-2.42.0.linux-amd64/
[root@tmplogsvr prometheus-2.42.0.linux-amd64]# cp ./prometheus promtool /usr/local/bin
[root@tmplogsvr prometheus-2.42.0.linux-amd64]# cp -r prometheus.yml consoles/ console_libraries/ /etc/prometheus/
[root@tmplogsvr prometheus-2.42.0.linux-amd64]# cd
[root@tmplogsvr ~]# echo '
[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.external-url=
SyslogIdentifier=prometheus
Restart=always
[Install]
WantedBy=multi-user.target' > /etc/systemd/system/prometheus.service
[root@tmplogsvr ~]# chown -R prometheus:prometheus /etc/prometheus
[root@tmplogsvr ~]# chmod -R 775 /etc/prometheus/
[root@tmplogsvr ~]# chown -R prometheus:prometheus /var/lib/prometheus/
[root@tmplogsvr ~]# systemctl daemon-reload
[root@tmplogsvr ~]# systemctl enable prometheus
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service → /etc/systemd/system/prometheus.service.
[root@tmplogsvr ~]#
프로메테우스 실행
[root@tmplogsvr ~]# systemctl start prometheus.service
[root@tmplogsvr ~]# systemctl status prometheus.service
● prometheus.service - Prometheus
Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-03-22 10:04:33 KST; 4s ago
Docs: https://prometheus.io/docs/introduction/overview/
Main PID: 233870 (prometheus)
Tasks: 13 (limit: 99645)
Memory: 20.5M
CGroup: /system.slice/prometheus.service
└─233870 /usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.console.templates=/etc/prometheus/consoles --web.console.lib>
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.564Z caller=head.go:685 level=info component=tsdb msg="WAL segment loaded" segment=1 maxSegment=3
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.565Z caller=head.go:685 level=info component=tsdb msg="WAL segment loaded" segment=2 maxSegment=3
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.565Z caller=head.go:685 level=info component=tsdb msg="WAL segment loaded" segment=3 maxSegment=3
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.565Z caller=head.go:722 level=info component=tsdb msg="WAL replay completed" checkpoint_replay_duration=19.402µs wal_replay_dur>
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.566Z caller=main.go:1014 level=info fs_type=EXT4_SUPER_MAGIC
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.566Z caller=main.go:1017 level=info msg="TSDB started"
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.566Z caller=main.go:1197 level=info msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.568Z caller=main.go:1234 level=info msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml total>
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.568Z caller=main.go:978 level=info msg="Server is ready to receive web requests."
3월 22 10:04:33 tmplogsvr prometheus[233870]: ts=2023-03-22T01:04:33.568Z caller=manager.go:974 level=info component="rule manager" msg="Starting rule manager..."
lines 1-20/20 (END)
웹페이지 접근
http://{서버IP}:9090
'기술 노트 > prometheus' 카테고리의 다른 글
prometheus와 snmp_exporter 설치 결과 (0) | 2023.04.04 |
---|---|
prometheus 설정 (0) | 2023.04.04 |