snmp_exporter 다운로드

https://github.com/prometheus/snmp_exporter/releases/tag/v0.21.0

 

snmp_exporter 설치

[root@tmplogsvr ~]# cd /opt
[root@tmplogsvr opt]# wget https://github.com/prometheus/snmp_exporter/releases/download/v0.21.0/snmp_exporter-0.21.0.linux-amd64.tar.gz
--2023-03-22 14:14:01--  https://github.com/prometheus/snmp_exporter/releases/download/v0.21.0/snmp_exporter-0.21.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/35d0421a-cf03-4349-ae63-426c22348a41?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230322%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230322T051348Z&X-Amz-Expires=300&X-Amz-Signature=4a0ef1b1d88523c258386ec4bc5645e9e8114053243b06e8cfd218ce1895d008&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31185891&response-content-disposition=attachment%3B%20filename%3Dsnmp_exporter-0.21.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2023-03-22 14:14:01--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/31185891/35d0421a-cf03-4349-ae63-426c22348a41?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230322%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230322T051348Z&X-Amz-Expires=300&X-Amz-Signature=4a0ef1b1d88523c258386ec4bc5645e9e8114053243b06e8cfd218ce1895d008&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=31185891&response-content-disposition=attachment%3B%20filename%3Dsnmp_exporter-0.21.0.linux-amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8468035 (8.1M) [application/octet-stream]
Saving to: ‘snmp_exporter-0.21.0.linux-amd64.tar.gz’

snmp_exporter-0.21.0.linux-amd64.tar.gz           100%[===========================================================================================================>]   8.08M  43.5MB/s    in 0.2s

2023-03-22 14:14:02 (43.5 MB/s) - ‘snmp_exporter-0.21.0.linux-amd64.tar.gz’ saved [8468035/8468035]

[root@tmplogsvr opt]# tar zxvf ./snmp_exporter-0.21.0.linux-amd64.tar.gz
[root@tmplogsvr opt]# rm -rf ./snmp_exporter-0.21.0.linux-amd64.tar.gz
[root@tmplogsvr opt]# mv ./snmp_exporter-0.21.0.linux-amd64 ./snmp_exporter
[root@tmplogsvr opt]# ln -s /opt/snmp_exporter/snmp_exporter /usr/local/bin/snmp_exporter
[root@tmplogsvr opt]# useradd --system snmp_exporter
[root@tmplogsvr opt]# 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@tmplogsvr opt]# systemctl daemon-reload
[root@tmplogsvr opt]# systemctl enable snmp-exporter.service

 

snmp_export 실행

[root@tmplogsvr opt]# systemctl start snmp-exporter.service
[root@tmplogsvr opt]# systemctl status snmp-exporter.service
● snmp-exporter.service - Prometheus SNMP Exporter Service
   Loaded: loaded (/etc/systemd/system/snmp-exporter.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-03-22 14:33:22 KST; 5s ago
 Main PID: 241313 (snmp_exporter)
    Tasks: 10 (limit: 99645)
   Memory: 30.7M
   CGroup: /system.slice/snmp-exporter.service
           └─241313 /usr/local/bin/snmp_exporter --config.file=/opt/snmp_exporter/snmp.yml

 3월 22 14:33:22 tmplogsvr systemd[1]: Started Prometheus SNMP Exporter Service.
 3월 22 14:33:22 tmplogsvr snmp_exporter[241313]: ts=2023-03-22T05:33:22.219Z caller=main.go:148 level=info msg="Starting snmp_exporter" version="(version=0.21.0, branch=HEAD, revision=0d8c3527cac0>
 3월 22 14:33:22 tmplogsvr snmp_exporter[241313]: ts=2023-03-22T05:33:22.219Z caller=main.go:149 level=info build_context="(go=go1.19.3, user=root@51dfd4b1f59b, date=20221122-15:14:18)"
 3월 22 14:33:22 tmplogsvr snmp_exporter[241313]: ts=2023-03-22T05:33:22.299Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9116
 3월 22 14:33:22 tmplogsvr snmp_exporter[241313]: ts=2023-03-22T05:33:22.299Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9116
 3월 22 14:33:24 tmplogsvr snmp_exporter[241313]: ts=2023-03-22T05:33:24.370Z caller=collector.go:282 level=info module=if_mib target=192.168.10.2 msg="Error scraping target" err="error getting tar>
lines 1-15/15 (END)

'기술 노트 > snmp_exporter' 카테고리의 다른 글

snmp_exporter 설정  (0) 2023.04.04

+ Recent posts