I’m trying to log the internet bandwidth I use each month. My Airport Extreme is an older model that supports SNMP. These two terminal commands extract the correct counters for downloads and uploads (in bytes).
snmpget -v 2c -c public Hostname ifInOctets.2
snmpget -v 2c -c public Hostname ifOutOctets.2
The results look like this
IF-MIB::ifInOctets.2 = Counter32: 3994037720
IF-MIB::ifOutOctets.2 = Counter32: 2161993538
I would appreciate help automating a log of the extracted data with a shell script that would periodically run both commands and append the results to a text file with the current time.
It would be nice for the resulting text file to be in the following format: dd/mm/yy DownloadCounter UploadCounter. This would make the data easier to load into a spreadsheet for analysis/graphing. But I don't mind cleaning up the log manually if necessary.
FWIW I already own NetUse Traffic Monitor which tells me the downloads and uploads in real time and will report a cumulative total. But it does not maintain a record of these data that can be analyzed/graphed.
Thanks in advance.
—GetRealBro
snmpget -v 2c -c public Hostname ifInOctets.2
snmpget -v 2c -c public Hostname ifOutOctets.2
The results look like this
IF-MIB::ifInOctets.2 = Counter32: 3994037720
IF-MIB::ifOutOctets.2 = Counter32: 2161993538
I would appreciate help automating a log of the extracted data with a shell script that would periodically run both commands and append the results to a text file with the current time.
It would be nice for the resulting text file to be in the following format: dd/mm/yy DownloadCounter UploadCounter. This would make the data easier to load into a spreadsheet for analysis/graphing. But I don't mind cleaning up the log manually if necessary.
FWIW I already own NetUse Traffic Monitor which tells me the downloads and uploads in real time and will report a cumulative total. But it does not maintain a record of these data that can be analyzed/graphed.
Thanks in advance.
—GetRealBro
Last edited: