I hope my question is in the right category.
I'm a student and our teacher has asked us to monitor packets sent on a machine with cacti. We have to do it via SNMP and via script. I did the part with SNMP and it's working fine, but I can't seem to make the script part work.
I've simplified my script to a maximum just to make sure I understand what's going on/ what I need to give to cacti.
Code: Select all
#!/bin/bash
# Function to get the number of received packets
get_received_packets() {
netstat -i | grep enp0s3 | sed "s/ . */ /g" | cut -d" " -f3
}
# Infinite loop
while true; do
# Get the number of received packets
nbp=$(get_received_packets)
# Output a timestamp and the number of received packets
echo $nbp
# Sleep for 5 seconds before the next iteration
sleep 5
done
Add the graph on localhost device
Can't seem to add another screeshot but I went into Management>Devices>Local Linux Machine>*Create Graphs for this Device> and added "AAAA"
When I go to graphs, I see my graph but it's empty.
I have 751 permission and www-data:www-data on the script.
I'm sorry if I made a dumb mistake or forgot something, i've just discovered cacti about a week ago.
Thanks in advance.
Friendly yours, Anone