asimple math subtraction and its giving me a fit.
I'm doing an snmp walk getting a value and then waiting a period of time and doing it again. Then subtracting to get the difference. I know the diff isn't 0
[#!/bin/bash
#
OLD= snmpwalk -v2c -c AE4ML 192.168.20.254 | grep 'iso.3.6.1.2.1.31.1.1.1.6.2 =' | awk -F ' ' '{print $4}'
#
#
sleep 10
#
NEW= snmpwalk -v2c -c AE4ML 192.168.20.254 | grep 'iso.3.6.1.2.1.31.1.1.1.6.2 =' | awk -F ' ' '{print $4}'
(( TOTAL=NEW-OLD))
echo "$((NEW - OLD))"]
RESULTS:
./process.sh
133136725551
133147152935
0
I'm doing an snmp walk getting a value and then waiting a period of time and doing it again. Then subtracting to get the difference. I know the diff isn't 0
[#!/bin/bash
#
OLD= snmpwalk -v2c -c AE4ML 192.168.20.254 | grep 'iso.3.6.1.2.1.31.1.1.1.6.2 =' | awk -F ' ' '{print $4}'
#
#
sleep 10
#
NEW= snmpwalk -v2c -c AE4ML 192.168.20.254 | grep 'iso.3.6.1.2.1.31.1.1.1.6.2 =' | awk -F ' ' '{print $4}'
(( TOTAL=NEW-OLD))
echo "$((NEW - OLD))"]
RESULTS:
./process.sh
133136725551
133147152935
0