
SNMP Monitoring: ตั้งค่า SNMP v3 และ NMS สำหรับ Network Monitoring
SNMP (Simple Network Management Protocol) เป็น protocol มาตรฐานสำหรับ monitor และจัดการอุปกรณ์ network (switches, routers, firewalls, servers, APs) จากจุดเดียว NMS (Network Management System) ใช้ SNMP เพื่อเก็บข้อมูล (CPU, memory, bandwidth, interface status) แสดงผลเป็น dashboard แจ้งเตือนเมื่อมีปัญหา
SNMP มี 3 versions: v1 (เก่า ไม่ปลอดภัย), v2c (นิยมใช้ แต่ community string เป็น plaintext), v3 (ปลอดภัยที่สุด มี authentication + encryption) บทความนี้จะสอนตั้งค่า SNMP v3 บนอุปกรณ์ Cisco และเลือก NMS ที่เหมาะสม
SNMP Versions เปรียบเทียบ
| คุณสมบัติ | SNMP v1 | SNMP v2c | SNMP v3 |
|---|---|---|---|
| Authentication | Community string (plaintext) | Community string (plaintext) | Username + password (MD5/SHA) |
| Encryption | ไม่มี | ไม่มี | DES/AES-128/AES-256 |
| Security Level | ต่ำมาก | ต่ำ | สูง |
| GetBulk | ไม่มี | มี (เร็วกว่า) | มี |
| แนะนำ | อย่าใช้ | ใช้ได้ใน trusted network | แนะนำสำหรับ production |
SNMP ทำงานอย่างไร
Components
SNMP Manager (NMS): ส่ง requests ไปยัง agents เก็บข้อมูล แสดงผล SNMP Agent: software บนอุปกรณ์ network ตอบ requests จาก manager MIB (Management Information Base): โครงสร้างข้อมูลที่ agent เก็บ (OIDs) OID (Object Identifier): ตัวระบุข้อมูลแต่ละชิ้น เช่น 1.3.6.1.2.1.1.3.0 = sysUpTime
Operations
| Operation | ทิศทาง | หน้าที่ |
|---|---|---|
| GET | Manager → Agent | ขอค่า OID เฉพาะ |
| GETNEXT | Manager → Agent | ขอค่า OID ถัดไป (walk) |
| GETBULK | Manager → Agent | ขอค่า OIDs หลายตัวพร้อมกัน (v2c/v3) |
| SET | Manager → Agent | เปลี่ยนค่า OID (configure) |
| TRAP | Agent → Manager | แจ้งเตือนเมื่อเกิด event (async) |
| INFORM | Agent → Manager | เหมือน TRAP แต่มี acknowledgment |
ตั้งค่า SNMP v3 บน Cisco
Security Levels
noAuthNoPriv: ใช้ username อย่างเดียว ไม่มี auth ไม่มี encryption authNoPriv: มี authentication (MD5/SHA) ไม่มี encryption authPriv: มี authentication + encryption (DES/AES) แนะนำ authPriv เสมอสำหรับ production
Configuration Steps
สร้าง SNMP v3 group: กำหนดชื่อ group, security model (v3), security level (authPriv), view (กำหนด OIDs ที่เข้าถึงได้) สร้าง SNMP v3 user: กำหนดชื่อ user, group, auth protocol (SHA), auth password, priv protocol (AES128), priv password สร้าง SNMP view: กำหนด OID tree ที่ user เข้าถึงได้ (เช่น iso = 1.3.6.1 ทั้งหมด หรือจำกัดเฉพาะบางส่วน)
NMS (Network Management System)
| NMS | ราคา | จุดเด่น | เหมาะกับ |
|---|---|---|---|
| Zabbix | ฟรี (open-source) | Feature ครบ SNMP+Agent flexible มาก | ทุกขนาด แนะนำมากที่สุด |
| LibreNMS | ฟรี (open-source) | Auto-discovery SNMP-focused สวย | Network-focused monitoring |
| PRTG | ฟรี 100 sensors | ง่ายมาก Windows-based | SMB ที่ใช้ Windows |
| Nagios/Icinga | ฟรี (open-source) | เก่าแก่ stable plugin ecosystem | Linux admins |
| SolarWinds NPM | แพงมาก | Enterprise features ครบ | Large enterprise |
| Datadog | แพง (SaaS) | Cloud-native integrations มาก | Cloud + hybrid environments |
สิ่งที่ควร Monitor
อุปกรณ์ Network
| Metric | OID/วิธี | Threshold แนะนำ |
|---|---|---|
| Interface Status (Up/Down) | ifOperStatus | Alert เมื่อ down |
| Bandwidth Utilization | ifInOctets, ifOutOctets | Warning 70%, Critical 90% |
| CPU Usage | vendor-specific OID | Warning 80%, Critical 95% |
| Memory Usage | vendor-specific OID | Warning 80%, Critical 95% |
| Uptime | sysUpTime | Alert เมื่อ uptime reset (reboot) |
| Error Counters | ifInErrors, ifOutErrors | Alert เมื่อ errors เพิ่มขึ้นเร็ว |
SNMP Traps
Event-Driven Monitoring
SNMP Traps คือ notifications ที่อุปกรณ์ส่งมาหา NMS เมื่อเกิด event สำคัญ ไม่ต้องรอ NMS มา poll (real-time) ตัวอย่าง traps: interface down/up, config change, authentication failure, temperature alarm, fan failure configure อุปกรณ์ให้ส่ง traps ไปยัง NMS server configure NMS ให้รับและ process traps
Best Practices
Security
ใช้ SNMP v3 เสมอ (authPriv) อย่าใช้ default community strings (public/private) จำกัด SNMP access ด้วย ACL (อนุญาตเฉพาะ NMS IP) ใช้ read-only access (ไม่ให้ SET) ยกเว้นจำเป็นจริงๆ เปลี่ยน SNMP credentials เป็นประจำ
Performance
Polling interval ที่เหมาะสม: 5 นาทีสำหรับ metrics ทั่วไป, 1 นาทีสำหรับ critical interfaces อย่า poll ถี่เกินไป (เพิ่ม load บนอุปกรณ์และ NMS) ใช้ SNMP v2c/v3 GetBulk แทน GetNext (เร็วกว่า) ใช้ Traps สำหรับ events ที่ต้อง real-time (ไม่ต้องรอ poll)
ทิ้งท้าย: Monitor ก่อนที่จะพัง
SNMP Monitoring ทำให้เห็นปัญหาก่อนที่ users จะแจ้ง เห็น trend ก่อนที่ capacity จะเต็ม วางแผน upgrade ได้ล่วงหน้า เริ่มจาก Zabbix หรือ LibreNMS (ฟรี) ตั้งค่า SNMP v3 บนอุปกรณ์ทุกตัว monitor metrics สำคัญ ตั้ง alerts
อ่านเพิ่มเติมเกี่ยวกับ Network TAP และ SPAN และ Network Troubleshooting ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com