Adding Metrics and adding SNMP - How?

47 views
Skip to first unread message

Jan Kühnemund

unread,
Apr 22, 2024, 12:00:29 PMApr 22
to sFlow-RT
Hi y'all,

hope I'm doing this right, I've not yet used a mailing list 🙂
I would like to know:
  1. My browse_metrics is empty, except if I poll using prometheus, but then it calls the metrics prometheus_0 prometheus_1 and so on. How can I add metrics, how are they defined? I seem to have misssed that in the fetting started guide
  2. I tried activating snmp by adding the relevant params via argument ("-Dsnmp.ifname=yes -Dsnmp.version=3" and so on) but it has not had a noticable effect. Where should I be able to see the network interface names?

Kind Regards Jan

Peter Phaal

unread,
Apr 22, 2024, 12:24:04 PMApr 22
to sFlow-RT
Did you follow the instructions in the Getting Started guide (https://sflow-rt.com/intro.php)?
Are you sure you have configured the switches to send sFlow packet samples and counters (https://sflow-rt.com/agents.php)?
Does it look like the data is being received? The sFlow-RT status page should report non-zero sFlow Bytes and sFlow Packets.
Have you checked to see that status of the agents using the REST API, http://sflow-rt:8008/agents/json
What do you see if you use the REST API, for example, http://sflow-rt:8008/metrics/json?

You might want to using the sflow-test application to further verify the sFlow agent configurations (https://blog.sflow.com/2015/11/sflow-test.html).

Enabling snmp.ifname should result in interface names appearing in the Prometheus metrics query, for example,

Jan Kuehnemund

unread,
Apr 22, 2024, 2:29:49 PMApr 22
to Peter Phaal, sFlow-RT
I installed sflow-rt as a docker container on kubernetes with the application preinstalled (sflow-rt/prometheus) and I can see packets arriving. I have 3 agents which input packets and am able to see flows if I ask for e.g. ipsource. What I cannot see however are predefined metrics.
The /metrics/json outputs:
{ "prometheus_0": 31, "prometheus_2": 31, "prometheus_1": 31 }
While the /agents/json outputs:

{ "10.x.0.238": {  "sFlowDatagramsLost": 2, ...snip...  "sFlowDatagramsDuplicates": 0,  "sFlowCounterLostSamples": 0 }, "10.x.0.240": {  "sFlowDatagramsLost": 43, ...snip...  "sFlowCounterDuplicateSamples": 0,  "lastSeen": 11,  "sFlowDatagramsDuplicates": 0,  "sFlowCounterLostSamples": 0 } }
The sflow code is on a huawei router, it is not something I can change, but I'm pretty sure it is solid.
I did install the sflow network interface dashboard on grafana, but given my /prometheus/metrics/ALL/ALL/txt endpoint is empty, I am not able to see any data

Von: sflo...@googlegroups.com <sflo...@googlegroups.com> im Auftrag von Peter Phaal <peter...@gmail.com>
Gesendet: Montag, 22. April 2024 18:24
An: sFlow-RT <sflo...@googlegroups.com>
Betreff: [sflow-rt] Re: Adding Metrics and adding SNMP - How?
 
--
You received this message because you are subscribed to a topic in the Google Groups "sFlow-RT" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sflow-rt/_MO5BYmwuLM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sflow-rt+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sflow-rt/c59a2aee-7729-4a62-b6d1-9490a58f18can%40googlegroups.com.

Peter Phaal

unread,
Apr 22, 2024, 5:11:31 PMApr 22
to sFlow-RT
The pre-defined metrics are the result of sFlow counter polling. Have you defined a counter polling interval on the Huawei routers and enabled counter polling on the interfaces? The following configuration guide is very old, but maybe the commands haven't changes much:
https://blog.sflow.com/2012/08/configuring-huawei-switches.html

FYI The prometheus_0, ... metrics are the flows defined by the prometheus application. If you enable counter polling you should also see metrics like ifinoctets, ifoutoctets, etc.

Jan Kühnemund

unread,
Apr 23, 2024, 11:02:06 AMApr 23
to sFlow-RT
Hi Peter,
thanks, I looked into it, but the router I am using only supports flow sampling, not counter sampling. https://support.huawei.com/enterprise/en/doc/EDOC1100279274/c520bf56/sflow-configuration#EN-US_CONCEPT_0172373310
Is there any other way I could possibly get the interface names using SNMP, and be it writing my own sflow-rt application?
If not I am looking into using the MAC Adresses instead, but that would be very hacky and ugly

Peter Phaal

unread,
Apr 23, 2024, 12:12:00 PMApr 23
to sFlow-RT
Hi Jan,

You should raise a defect report with Huawei since counter polling is a required feature of an sFlow agent:

3. Sampling Mechanisms

   The sFlow Agent uses two forms of sampling: statistical packet-based
   sampling of switched or routed Packet Flows, and time-based sampling
   of counters.

See https://sflow.org/sflow_version_5.txt. You could give them a pointer to sFlow-Test so that they can validate their sFlow implementation:

sFlow-RT relies on the sFlow counters to discover device interfaces, interface speeds, etc. and to trigger SNMP requests to discover ifName information if it isn't already present in the port_name counter structure:

/* Port name */
/* opaque = counter_data; enterprise = 0; format = 1005 */
struct port_name {
  string<255> name;
}

As a work around, you could load a topology, https://sflow-rt.com/topology.php.  You would need to include the nodes structure which uses names the ports on each device. In your flow definitions, you can use ifname:inputifindex to add the ifname as a flow key, https://sflow-rt.com/define_flow.php

It shouldn't be too hard to programmatically extract the mapping if ifName to ifIndex using Huawei APIs or via SNMP in order to build the topology.json object.

Peter
Reply all
Reply to author
Forward
0 new messages