최신 버전 다운로드 받기
저는 ubuntu에서 설치하기 위해 아래 파일을 다운로드 했습니다.
snmp_exporter-0.25.0.linux-amd64.tar.gz
https://github.com/prometheus/snmp_exporter/releases
root@syslogserver:/opt# wget https://github.com/prometheus/snmp_exporter/releases/download/v0.25.0/snmp_exporter-0.25.0.linux-amd64.tar.gz
--2023-12-21 12:08:50-- https://github.com/prometheus/snmp_exporter/releases/download/v0.25.0/snmp_exporter-0.25.0.linux-amd64.tar.gz
Resolving github.com (github.com)... 20.200.245.247
Connecting to github.com (github.com)|20.200.245.247|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/31185891/aaa12aa4-ebfa-4e22-b061-b274132432f3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231221T030851Z&X-Amz-Expires=300&X-Amz-Signature=518fc3871a119d47abd6a0d64285244b57db69c2e019be3694a25e3ae0378f8f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31185891&response-content-disposition=attachment%3B%20filename%3Dsnmp_exporter-0.25.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2023-12-21 12:08:51-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/31185891/aaa12aa4-ebfa-4e22-b061-b274132432f3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231221T030851Z&X-Amz-Expires=300&X-Amz-Signature=518fc3871a119d47abd6a0d64285244b57db69c2e019be3694a25e3ae0378f8f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31185891&response-content-disposition=attachment%3B%20filename%3Dsnmp_exporter-0.25.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8441503 (8.0M) [application/octet-stream]
Saving to: ‘snmp_exporter-0.25.0.linux-amd64.tar.gz’
snmp_exporter-0.25.0.linux-amd64.tar.gz 100%[===========================================================================================================>] 8.05M --.-KB/s in 0.1s
2023-12-21 12:08:52 (63.5 MB/s) - ‘snmp_exporter-0.25.0.linux-amd64.tar.gz’ saved [8441503/8441503]
root@syslogserver:/opt# ls -al
total 8252
drwxr-xr-x 2 root root 4096 12월 21 12:08 .
drwxr-xr-x 20 root root 4096 11월 28 13:53 ..
-rw-r--r-- 1 root root 8441503 12월 10 19:07 snmp_exporter-0.25.0.linux-amd64.tar.gz
root@syslogserver:/opt# tar zxvf ./snmp_exporter-0.25.0.linux-amd64.tar.gz
snmp_exporter-0.25.0.linux-amd64/
snmp_exporter-0.25.0.linux-amd64/snmp.yml
snmp_exporter-0.25.0.linux-amd64/LICENSE
snmp_exporter-0.25.0.linux-amd64/NOTICE
snmp_exporter-0.25.0.linux-amd64/snmp_exporter
root@syslogserver:/opt#
root@syslogserver:/opt# mv ./snmp_exporter-0.25.0.linux-amd64 ./snmp_exporter
root@syslogserver:/opt#
설정은 아래 참조
snmp-exporter-0.25 버전에서는 아래와 같은 방식으로 수정하네요.
/opt/snmp_exporter/snmp.yml 파일 맨 상단에 있습니다.
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
auths:
# public_v1:
# community: public
# security_level: noAuthNoPriv
# auth_protocol: MD5
# priv_protocol: DES
# version: 1
public_v2:
community: public
# security_level: noAuthNoPriv
# auth_protocol: MD5
# priv_protocol: DES
version: 2
modules:
apcups:
walk:
위 설정이 안되면 아래 링크를 참조하세요~
https://dirt-spoon.tistory.com/77
snmp_exporter 프로세스 만들기
- user: snmp_exporter
- Process: snmp_exporter
root@syslogserver:/opt/snmp_exporter# ln -s /opt/snmp_exporter/snmp_exporter /usr/local/bin/snmp_exporter
root@syslogserver:/opt/snmp_exporter# useradd --system snmp_exporter
root@syslogserver:/opt/snmp_exporter# cd /etc/systemd/system/
root@syslogserver:/opt/snmp_exporter# echo '
[Unit]
Description=Prometheus SNMP Exporter Service
After=network.target
[Service]
Type=simple
User=snmp_exporter
ExecStart=/usr/local/bin/snmp_exporter --config.file="/opt/snmp_exporter/snmp.yml"
[Install]
WantedBy=multi-user.target' > /etc/systemd/system/snmp-exporter.service
root@syslogserver:/opt/snmp_exporter# ls -al /etc/systemd/system | grep snmp
-rw-r--r-- 1 root root 237 12월 21 12:19 snmp-exporter.service
root@syslogserver:/opt/snmp_exporter# systemctl daemon-reload
root@syslogserver:/opt/snmp_exporter# systemctl enable snmp-exporter.service
Created symlink /etc/systemd/system/multi-user.target.wants/snmp-exporter.service → /etc/systemd/system/snmp-exporter.service.
root@syslogserver:/opt/snmp_exporter#
프로세스 확인하기
root@syslogserver:/opt/snmp_exporter# systemctl restart snmp-exporter.service
root@syslogserver:/opt/snmp_exporter# ps -ef | grep snmp-exporter
root 188764 167915 0 12:23 pts/5 00:00:00 grep --color=auto snmp-exporter
root@syslogserver:/opt/snmp_exporter#
'기술 노트 > ubuntu' 카테고리의 다른 글
snap으로 grafana 설치 후 grafana.ini 설정 (0) | 2023.12.21 |
---|---|
grafana 설치하기 (1) | 2023.12.21 |
snmp-mibs-downloader snmp snmpd 다운로드 (0) | 2023.12.21 |
prometheus.yml 설정 (0) | 2023.12.21 |
Prometheus 설치 (1) | 2023.12.21 |