Shutdown dependent on network activity ?

Status
Not open for further replies.

Child

Dabbler
Joined
Sep 25, 2011
Messages
44
I suspected as much ... the output looks like this:

Code:
# snmpwalk -c public -v 2c localhost ifName                  
IF-MIB::ifName.1 = STRING: usbus0                                               
IF-MIB::ifName.2 = STRING: re0                                                  
IF-MIB::ifName.3 = STRING: usbus1                                               
IF-MIB::ifName.4 = STRING: lo0                                                  
IF-MIB::ifName.5 = STRING: bridge0                                              
IF-MIB::ifName.6 = STRING: epair0a
 

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
You just need to change SNMP_INDEX from 1 to 2.

Or if the index keeps changing, and you'd rather use the name to identify the index (OID) programatically...

Code:
IFNAME=re0
SNMP_INDEX=`/usr/local/bin/snmpwalk -c $SNMP_COMMUNITY -v 2c $SNMP_HOST ifName | grep ": $IFNAME$" | awk '{ print $1 }' | awk -F. '{ print $2 }'`


should work...
 

Milhouse

Guru
Joined
Jun 1, 2011
Messages
564
Just in case anyone faithfully copied the original script in post #2, ausFreeNAS has brought to my attention a typo that is rather important...

Code:
	if [ ${OCT_IN-0} -lt $THRESHOLD_IN -a ${OUT_OUT-0} -lt $THRESHOLD_OUT ]; then


should be:

Code:
	if [ ${OCT_IN-0} -lt $THRESHOLD_IN -a ${OCT_OUT-0} -lt $THRESHOLD_OUT ]; then


I have updated the original script in post #2. Apologies for any problems this may have caused.

Thanks ausFreeNAS.
 

Ismael Duarte

Contributor
Joined
Jun 13, 2011
Messages
154
Finally!!! :):):):) is working again :D
Code:
IF-MIB::ifName.1 = STRING: usbus0
IF-MIB::ifName.2 = STRING: usbus1
IF-MIB::ifName.3 = STRING: usbus2
IF-MIB::ifName.4 = STRING: usbus3
IF-MIB::ifName.5 = STRING: usbus4
IF-MIB::ifName.6 = STRING: sk0
IF-MIB::ifName.7 = STRING: lo0

Had to change the index to 6

@ Milhouse - I've changed the line, never notice that error and somehow it seems to work ok :cool:

Thank you all
 

denist

Contributor
Joined
Jan 28, 2013
Messages
188
hi all could someone post a guide on how to implement the script and service to freenas 8.3 rc1 embedded....

thanx

Denis
 
Status
Not open for further replies.
Top