13.2. snmptrapd구성
snmptrapd
데몬에는 snmp-gateway
서비스를 만들 때 지정해야 하는 인증 설정이 포함되어 있으므로 snmp-gateway
를 배포하기 전에 SNMP(Simple Network Management Protocol) 대상을 구성하는 것이 중요합니다.
SNMP 게이트웨이 기능은 Prometheus 스택에서 생성된 경고를 SNMP 관리 플랫폼에 노출하는 수단을 제공합니다. snmptrapd
툴을 기반으로 대상로 SNMP 트랩을 구성할 수 있습니다. 이 도구를 사용하면 하나 이상의 SNMP 트랩 리스너를 설정할 수 있습니다.
다음 매개변수는 구성에 중요합니다.
-
engineid
는 hex에서 장치의 고유 식별자이며, TPMV3 게이트웨이에 필요합니다. Red Hat은 이 매개변수에 '8000C53F_CLUSTER_FSID_WITHOUT_DASHES_'를 사용할 것을 권장합니다. -
SNMP_COMMUNITY_FOR_SNMPV2 매개 변수인
snmp-community
(snmp-community)는 SNMPV2c 게이트웨이용으로공개됩니다
. -
AUTH_PROTOCOL 인
auth-protocol
은 SNMPV3 게이트웨이에는 필수입니다. 기본적으로SHA
입니다. -
개인 정보 보호 프로토콜
( PRIVACY_PROTOCOL )은 TPMV3 게이트웨이를 필요로 합니다. - PRIVACY_PASSWORD 는 암호화가 있는 SNMPV3 게이트웨이를 사용해야 합니다.
- SNMP_V3_AUTH_USER_NAME 은 사용자 이름이며, SNMPV3 게이트웨이에는 필수입니다.
- SNMP_V3_AUTH_PASSWORD 는 암호이며 SNMPV3 게이트웨이에는 필수입니다.
사전 요구 사항
- 실행 중인 Red Hat Ceph Storage 클러스터.
- 노드에 대한 루트 수준 액세스입니다.
-
Red Hat Enterprise Linux 시스템에
firewalld
를 설치합니다.
절차
SNMP 관리 호스트에서 SNMP 패키지를 설치합니다.
예제
[root@host01 ~]# dnf install -y net-snmp-utils net-snmp
TPM의 포트 162를 열어 경고를 받습니다.
예제
[root@host01 ~]# firewall-cmd --zone=public --add-port=162/udp [root@host01 ~]# firewall-cmd --zone=public --add-port=162/udp --permanent
MIB(관리 정보 기반)를 구현하여 SNMP 알림을 감지하고 대상 호스트에서 SNMP 지원을 향상시킵니다. 기본 리포지토리에서 원시 파일을 복사합니다. https://github.com/ceph/ceph/blob/master/monitoring/snmp/CEPH-MIB.txt
예제
[root@host01 ~]# curl -o CEPH_MIB.txt -L https://raw.githubusercontent.com/ceph/ceph/master/monitoring/snmp/CEPH-MIB.txt [root@host01 ~]# scp CEPH_MIB.txt root@host02:/usr/share/snmp/mibs
snmptrapd
디렉토리를 만듭니다.예제
[root@host01 ~]# mkdir /root/snmptrapd/
SNMP 버전을 기반으로 각 프로토콜의
snmptrapd
디렉터리에 구성 파일을 생성합니다.구문
format2 %V\n% Agent Address: %A \n Agent Hostname: %B \n Date: %H - %J - %K - %L - %M - %Y \n Enterprise OID: %N \n Trap Type: %W \n Trap Sub-Type: %q \n Community/Infosec Context: %P \n Uptime: %T \n Description: %W \n PDU Attribute/Value Pair Array:\n%v \n -------------- \n createuser -e 0x_ENGINE_ID_ SNMPV3_AUTH_USER_NAME AUTH_PROTOCOL SNMP_V3_AUTH_PASSWORD PRIVACY_PROTOCOL PRIVACY_PASSWORD authuser log,execute SNMP_V3_AUTH_USER_NAME authCommunity log,execute,net SNMP_COMMUNITY_FOR_SNMPV2
SNMPV2c의 경우 다음과 같이
snmptrapd_public.conf
파일을 만듭니다.예제
format2 %V\n% Agent Address: %A \n Agent Hostname: %B \n Date: %H - %J - %K - %L - %M - %Y \n Enterprise OID: %N \n Trap Type: %W \n Trap Sub-Type: %q \n Community/Infosec Context: %P \n Uptime: %T \n Description: %W \n PDU Attribute/Value Pair Array:\n%v \n -------------- \n authCommunity log,execute,net public
여기에서
공개
설정은snmp-gateway
서비스를 배포할 때 사용되는snmp_community
설정과 일치해야 합니다.인증만 사용하는 SNMPV3의 경우 다음과 같이
snmptrapd_auth.conf
파일을 만듭니다.예제
format2 %V\n% Agent Address: %A \n Agent Hostname: %B \n Date: %H - %J - %K - %L - %M - %Y \n Enterprise OID: %N \n Trap Type: %W \n Trap Sub-Type: %q \n Community/Infosec Context: %P \n Uptime: %T \n Description: %W \n PDU Attribute/Value Pair Array:\n%v \n -------------- \n createuser -e 0x8000C53Ff64f341c655d11eb8778fa163e914bcc myuser SHA mypassword authuser log,execute myuser
0x8000C53F64f64f341c655d11eb8778fa163e914bcc
문자열은engine_id
이고myuser
및mypassword
는 자격 증명입니다. 암호 보안은SHA
알고리즘에 의해 정의됩니다.이는
snmp-gateway
데몬을 배포하기 위한 설정에 해당합니다.예제
snmp_v3_auth_username: myuser snmp_v3_auth_password: mypassword
인증 및 암호화를 사용하는 SNMPV3의 경우 다음과 같이
snmptrapd_authpriv.conf
파일을 만듭니다.예제
format2 %V\n% Agent Address: %A \n Agent Hostname: %B \n Date: %H - %J - %K - %L - %M - %Y \n Enterprise OID: %N \n Trap Type: %W \n Trap Sub-Type: %q \n Community/Infosec Context: %P \n Uptime: %T \n Description: %W \n PDU Attribute/Value Pair Array:\n%v \n -------------- \n createuser -e 0x8000C53Ff64f341c655d11eb8778fa163e914bcc myuser SHA mypassword DES mysecret authuser log,execute myuser
0x8000C53F64f64f341c655d11eb8778fa163e914bcc
문자열은engine_id
이고myuser
및mypassword
는 자격 증명입니다. 암호 보안은SHA
알고리즘에 의해 정의되며DES
는 개인 정보 보호 암호화의 유형입니다.이는
snmp-gateway
데몬을 배포하기 위한 설정에 해당합니다.예제
snmp_v3_auth_username: myuser snmp_v3_auth_password: mypassword snmp_v3_priv_password: mysecret
SNMP 관리 호스트에서 데몬을 실행합니다.
구문
/usr/sbin/snmptrapd -M /usr/share/snmp/mibs -m CEPH-MIB.txt -f -C -c /root/snmptrapd/CONFIGURATION_FILE -Of -Lo :162
예제
[root@host01 ~]# /usr/sbin/snmptrapd -M /usr/share/snmp/mibs -m CEPH-MIB.txt -f -C -c /root/snmptrapd/snmptrapd_auth.conf -Of -Lo :162
스토리지 클러스터에서 트리거된 경고가 있는 경우 SNMP 관리 호스트에서 출력을 모니터링할 수 있습니다. SNMP 트랩 및 MIB에 의해 디코딩된 트랩도 확인합니다.
예제
NET-SNMP version 5.8 Agent Address: 0.0.0.0 Agent Hostname: <UNKNOWN> Date: 15 - 5 - 12 - 8 - 10 - 4461391 Enterprise OID: . Trap Type: Cold Start Trap Sub-Type: 0 Community/Infosec Context: TRAP2, SNMP v3, user myuser, context Uptime: 0 Description: Cold Start PDU Attribute/Value Pair Array: .iso.org.dod.internet.mgmt.mib-2.1.3.0 = Timeticks: (292276100) 3 days, 19:52:41.00 .iso.org.dod.internet.snmpV2.snmpModules.1.1.4.1.0 = OID: .iso.org.dod.internet.private.enterprises.ceph.cephCluster.cephNotifications.prometheus.promMgr.promMgrPrometheusInactive .iso.org.dod.internet.private.enterprises.ceph.cephCluster.cephNotifications.prometheus.promMgr.promMgrPrometheusInactive.1 = STRING: "1.3.6.1.4.1.50495.1.2.1.6.2[alertname=CephMgrPrometheusModuleInactive]" .iso.org.dod.internet.private.enterprises.ceph.cephCluster.cephNotifications.prometheus.promMgr.promMgrPrometheusInactive.2 = STRING: "critical" .iso.org.dod.internet.private.enterprises.ceph.cephCluster.cephNotifications.prometheus.promMgr.promMgrPrometheusInactive.3 = STRING: "Status: critical - Alert: CephMgrPrometheusModuleInactive Summary: Ceph's mgr/prometheus module is not available Description: The mgr/prometheus module at 10.70.39.243:9283 is unreachable. This could mean that the module has been disabled or the mgr itself is down. Without the mgr/prometheus module metrics and alerts will no longer function. Open a shell to ceph and use 'ceph -s' to determine whether the mgr is active. If the mgr is not active, restart it, otherwise you can check the mgr/prometheus module is loaded with 'ceph mgr module ls' and if it's not listed as enabled, enable it with 'ceph mgr module enable prometheus'"
위 예에서는 Prometheus 모듈이 비활성화된 후 경고가 생성됩니다.
추가 리소스
- Red Hat Ceph Storage Operations Guide 의 Deploying the SNMP gateway 섹션을 참조하십시오.