Please note that this capability is a part of the partner-only integration feature set, and we strongly advise against using it unless you have discussed it with our engineering team.
This logic can be changed or removed without any further notice, and it is not a part of FastNetMon's backward compatibility guarantee.
To enable the max talkers collection logic, you will need to enable these configuration options:
sudo fcli set main generate_max_talkers_report true sudo fcli set main generate_max_talkers_report_delay 60 sudo fcli commit
After that, FastNetMon will calculate top talkers for each per_host hostgroup you have in configuration and will store them to MongoDB in the collection: hostgroups_max_talkers. It will do it every generate_max_talkers_report_delay seconds.
To get them in MongoDB, you can use the following query:
db.hostgroups_max_talkers.find({})
Example output:
{ "_id" : ObjectId("65edd444cb342dccea093b66"), "hostgroups" : { "global" : { "ipv4" : { "incoming" : { "bytes_per_second" : [ { "host" : "192.168.1.108", "value" : 1631 } ], "icmp_bytes_per_second" : [ ], "icmp_packets_per_second" : [ ], "ip_fragmented_bytes_per_second" : [ ], "ip_fragmented_packets_per_second" : [ ], "packets_per_second" : [ { "host" : "192.168.1.108", "value" : 18 } ], "tcp_bytes_per_second" : [ ], "tcp_packets_per_second" : [ ], "tcp_syn_bytes_per_second" : [ ], "tcp_syn_packets_per_second" : [ ], "udp_bytes_per_second" : [ { "host" : "192.168.1.108", "value" : 1631 } ], "udp_packets_per_second" : [ { "host" : "192.168.1.108", "value" : 18 } ] }, "outgoing" : { "bytes_per_second" : [ { "host" : "192.168.1.106", "value" : 1486 } ], "icmp_bytes_per_second" : [ ], "icmp_packets_per_second" : [ ], "ip_fragmented_bytes_per_second" : [ ], "ip_fragmented_packets_per_second" : [ ], "packets_per_second" : [ { "host" : "192.168.1.106", "value" : 18 } ], "tcp_bytes_per_second" : [ ], "tcp_packets_per_second" : [ ], "tcp_syn_bytes_per_second" : [ ], "tcp_syn_packets_per_second" : [ ], "udp_bytes_per_second" : [ { "host" : "192.168.1.106", "value" : 1486 } ], "udp_packets_per_second" : [ { "host" : "192.168.1.106", "value" : 18 } ] } } } }, "period_end" : "2024-03-10T15:39:48Z", "period_start" : "2024-03-10T15:38:48Z" }
On recent versions of MongoDB, you can request the whole structure this way:
mongosh --username administrator --password `sudo cat /etc/fastnetmon/keychain/.mongo_admin` --eval 'use fastnetmon' --eval 'db.hostgroups_max_talkers.find()'
After that, you will be able to request the max talkers list via API. You can make a request to retrieve all records this way:
curl -X GET -u admin:password https://127.0.0.1:10007/hostgroup_max_talkers
To retrieve records from a specific date, please use another query:
curl -X GET -u admin:password https://127.0.0.1:10007/hostgroup_max_talkers/2022-02-01T00:58:40Z
FastNetMon has logic to remove these entries from MongoDB automatically every 15 minutes.
If you run a query and the API responds with error 500 in the following way:
[martini]2024/04/12 15:45:56 Completed GET /hostgroup_max_talkers/2023-04-12T31:44:38Z 500 Internal Server Error in 7.135398ms [martini]2024/04/12 15:45:56 Show function returned error: We do not have any samples for your query
This means that, for some reason, FastNetMon was not able to calculate max talkers and store them in MongoDB. Very likely, you will find details at /var/log/fastnetmon/fastnetmon.log.
