I'm testing my network infrastructure where I'm using iPerf and UDP protocol.
I'm running Cacti an open-source, web-based network monitoring and graphing. SNMP server is enabled in Linux servers.
First of all, so far, Cacti is able to monitor all template's graphs which are already there (e.g., Memory, CPU, Average Load, Interface Statistics) But I could not find the graph for
Packet loss graph for the Interface. It should be like in Cisco Router
In/Out Errors/Discarded Packets but maybe with different notation. Does anybody have an idea?
Secondly, I would like also to plot/graph what
netstat shows. For instance
netstat -su shows:
Udp: 1354844 packets received 0 packets to unknown port received. 5854 packet receive errors 1360713 packets sent RcvbufErrors: 5854
I want to graph the sent, received packets and the packet receive errors. Is that possible with
SNMP NETSTAT. In another words, I'd like to plot UDP packet loss.
Is there any python, Perl or bash script that can be used to collect data of
SNMP NETSTAT for UDP packets? Would be much better if it is SNMP queries.
snmpnetstat -v2c -c public -Cs -Cp udp 18.104.22.168 where it shows only
Then, I tried
snmpnetstat -v2c -c public -Cs 22.214.171.124 but it does not show any values.
tcp: udp: .... - output errors icmp6 histogram: input output type
I have written the bash script and it returns exactly the output I want when I run for example
#!/bin/bash rs="$(snmpnetstat -v2c -c public -Cs -Cp udp "$@")" # You have to quote "$rs" so newlines don't break ReceivedDatagrams="$(echo "$rs" | cut -d$'\n' -f2 | tr -s ' '| cut -d' ' -f2)" InvalidPort="$(echo "$rs" | cut -d$'\n' -f3 | tr -s ' '| cut -d' ' -f2)" DroppedDatagrams="$(echo "$rs" | cut -d$'\n' -f4 | tr -s ' '| cut -d' ' -f2)" DatagramRequests="$(echo "$rs" | cut -d$'\n' -f5 | tr -s ' '| cut -d' ' -f2)" echo "Received Datagrams:$ReceivedDatagrams Invalid port:$InvalidPort Dropped datagrams:$DroppedDatagrams Datagram requests:$DatagramRequests"
"$@" is for the hostname device for cacti
The output of bash script is:
Received Datagrams:258 Invalid port:63 Dropped datagrams:0 Datagram requests:471520
Starting with data input method, I gave the following path
/usr/share/cacti/site/scripts/udp_netstat <hostname> then I added the input fields as well as the output, according to the bash file output.
For the Data Source, I added data source items also according to the bash file output and made Data source type as COUNTER. Then, I proceed to Graph Template where I added the line of each output I have.
It seems to be in the workflow of adding new script, however, nothing so far is shown in the graph.
I assume there is a mistake with the Input String.