This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zonas = ['OUTSIDE', 'DMZ', 'COMERCIAL', 'TECNICA', 'VPN'] | |
def createrule(zonain, zonaout): | |
if zonain == zonaout: | |
print(f'add action=jump chain=desde-{zonain} comment="{zonain} a {zonaout}" jump-target=MISMAZONA out-interface-list={zonaout}') | |
else: | |
print(f'add action=jump chain=desde-{zonain} comment="{zonain} a {zonaout}" jump-target={zonain}-a-{zonaout} out-interface-list={zonaout}') | |
for zonain in zonas: | |
for zonaout in zonas: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_alive(host): | |
ret = os.system('ping -c 3 -t 3 -n -q {} > /dev/null'.format(host)) | |
if ret == 0: | |
return True | |
return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $1 ]; then | |
THEFILE=`date +%s` | |
COMMAND=`rsh $1 show pppoe session | grep "VLAN: " | awk '{print $3}' | sed s/:// > /tmp/$THEFILE`; | |
LIST=`cat /tmp/$THEFILE | sort -uh | xargs`; | |
TOTAL=0 | |
for ITEM in $LIST; do | |
CANT=`grep $ITEM /tmp/$THEFILE | wc -l`; | |
echo "VLAN $ITEM has $CANT clients"; | |
TOTAL=$[ $TOTAL + $CANT ]; |