Open‑Source Monitoring in Practice: Building Full‑Link Monitoring for H3C Devices with HCL, Categraf, Nightingale, and Prometheus
This article walks through the end‑to‑end setup of a low‑cost, open‑source monitoring system for H3C switches using HCL simulator, Categraf for SNMP data collection, Nightingale for alerting and visualization, and Prometheus for time‑series storage, detailing tool selection, environment preparation, configuration, and result verification.
Tool Stack Selection and Core Responsibilities
The article compares two common open‑source approaches for monitoring switches: (1) using Prometheus SNMP exporter to collect SNMP data and Grafana for visualization, and (2) using Nightingale's Categraf to collect SNMP data, store it in Prometheus, and display it via Nightingale's web UI. The second approach is chosen because Nightingale provides built‑in visual management, personnel organization, and alarm configuration.
The chosen components are:
HCL simulator : simulates H3C devices, replaces physical switches, supports SNMP configuration, and verifies monitoring link connectivity.
Categraf : multi‑dimensional data collector that gathers CPU, port traffic, packet loss, etc., via SNMP and supports H3C private OIDs.
Prometheus : stores time‑series data from Categraf and enables PromQL queries for visualization and alerting.
Nightingale : provides alarm management and basic visualization, allowing configuration of alarm rules such as high CPU load or abnormal port packet loss.
Full‑Process Implementation Steps
1. Environment Preparation and Basic Configuration
Before building the monitoring system, the author shows the local environment layout. HCL simulator connects to a VirtualBox host‑only network, ensuring Categraf can capture SNMP packets from the simulated switch.
HCL configuration steps:
Add a HOST on the simulated switch, configure a routed port, and assign an IP that can communicate with the VM (e.g., 192.168.56.0/24).
Configure the switch port as shown in the accompanying diagram.
In the VM, add a network adapter and bridge it to the VirtualBox host‑only adapter.
2. Enable SNMP on the Simulated Switch
To allow Categraf to collect metrics, the following SNMP commands are executed on the HCL switch:
system-view
snmp-agent
snmp-agent community read xkxtest # read‑only community for collection
snmp-agent sys-info version all # enable all SNMP versions
save3. Verify Connectivity
From the Categraf host, run:
ping 192.168.56.103
snmpwalk -v 2c -c xkxtest 192.168.56.103 1.3.6.1.2.1.1Successful ping and SNMP walk confirm that the SNMP service is reachable.
4. Install Prometheus, Categraf, and Nightingale
The article omits detailed installation steps but notes two important requirements:
Categraf host must install the SNMP MIB libraries: yum install -y net-snmp net-snmp-utils net-snmp-libs.
Prometheus requires accurate time synchronization on the VM, otherwise queries may fail.
5. Core Configuration
Categraf writer configuration (config.toml) to push data to Nightingale:
[[writers]]
url = "http://127.0.0.1:17000/prometheus/v1/write"Heartbeat configuration for host status reporting:
[heartbeat]
enable = true
url = "http://127.0.0.1:17000/v1/n9e/heartbeat"SNMP collection configuration (input.snmp/snmp.toml) includes:
Polling interval of 10 seconds.
Two SNMP agents (192.168.56.103 and 192.168.56.104).
Labels: region="beijing", role="switch".
Timeout of 5 seconds, SNMP version 2, community "xkxtest".
Various OIDs for system uptime, device name, interface tables, inbound/outbound octets, packet counts, CPU usage, memory usage, fan status, PSU status, temperature, stack member number, and topology, each mapped to a field name and, where appropriate, marked as a tag.
Example snippet for interface metrics:
[[instances.table]]
name = "interface"
oid = "IF-MIB::ifTable"
inherit_tags = ["deviceName"]
[[instances.table.field]]
oid = "IF-MIB::ifDescr"
name = "ifDescr"
is_tag = trueNightingale configuration (config.toml) includes the writer URL pointing to Prometheus:
[[Pushgw.Writers]]
Url = "http://127.0.0.1:9090/api/v1/write"Nightingale also requires MySQL and Redis back‑ends, as noted.
6. Result Demonstration
After confirming data collection, the author shows Nightingale’s metric console displaying collected H3C metrics. By applying Nightingale’s SNMP template, a final monitoring dashboard is produced, illustrating CPU load, interface traffic, fan status, and other device health indicators.
7. Summary
The end‑to‑end practice using HCL, Categraf, Nightingale, and Prometheus successfully achieves full‑link monitoring of H3C devices, addressing compatibility and cost issues of traditional solutions. The author plans to further enhance the setup with log monitoring and link tracing capabilities.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
xkx's Tech General Store
Code with the left hand, enjoy with the right; a keystroke sweeps away worries.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
