맛집 여행 캠핑 일상 생활

[CentOS] mrtg snmpd 안되는 경우 본문

LINUX

[CentOS] mrtg snmpd 안되는 경우

영은파더♥ 2024. 10. 22. 10:34
728x90

CentOS 7.x 버전에서 mrtg 와 snmp 를 설치하고 테스트 하는데 snmpd Connectio from UDP 161 REFUSED 가 되네요~

[root@centos ~]# snmpwalk -v2c -c public localhost system
Timeout: No Response from localhost

[root@centos conf.d]# systemctl status snmpd
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
   Loaded: loaded (/usr/lib/systemd/system/snmpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2024-10-22 08:31:35 KST; 47s ago
 Main PID: 21843 (snmpd)
    Tasks: 1
   CGroup: /system.slice/snmpd.service
           └─21843 /usr/sbin/snmpd -LS0-6d -f

Oct 22 08:31:52 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:53497->[127.0.0.1]:161 REFUSED
Oct 22 08:31:53 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:53497->[127.0.0.1]:161 REFUSED
Oct 22 08:31:54 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:53497->[127.0.0.1]:161 REFUSED
Oct 22 08:31:55 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:53497->[127.0.0.1]:161 REFUSED
Oct 22 08:32:07 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Oct 22 08:32:08 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Oct 22 08:32:09 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Oct 22 08:32:10 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Oct 22 08:32:11 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Oct 22 08:32:12 example.com snmpd[21843]: Connection from UDP: [127.0.0.1]:34629->[127.0.0.1]:161 REFUSED
Hint: Some lines were ellipsized, use -l to show in full.

# tail -f /var/log/message 로 확인해도 됩니다.

Rocky Linux 는 방화벽과 상관없이 잘 되는데 CentOS 는 /etc/hosts.deny 에서 ALL:ALL 때문에 안되는 것 같습니다.

/etc/hosts.allow 파일에 snmpd:localhost 를 추가해줍니다.

[root@centos conf.d]# snmpwalk -v2c -c public localhost system
...
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (2) 0:00:00.02

이제 잘 되네요~

 

728x90
반응형
Trackback : | Comments :