Possible Wrap LED Solution
-
Indeed it is! Thanks for that hint ;D
-
Ok…
So, is it possible to turn on LED 2 when PPPOE is established?
I'm an intermediate linux guy, not a BSD guy... where's the PPPOE script?
;)
E
-
Look in /usr/local/sbin/ppp-linkup IIRC
-
Cool!
Now I need to figure out how to remount the filesystem RW.
Thanks,
E
-
Run /etc/rc.conf_mount_rw
-
Hello E,
very good work. Do you find a way to read out the switch of the WRAP board?
Martin
-
Well I coded up a few PHP scripts to take advantage of the LED's. They're very rough. I'm sure for some of the things I could pull from the config.xml, but that just seemed like a lot of work / extra overhead.
The following will ping your gateway and something else of your choice. If both return a ping LED 2 gets lit. If the GW returns a ping but the other IP does not (internet down), then it flashes LED2. Otherwise LED 2 get turned off.
#!/usr/local/bin/php -q $gateway = "xxx.xxx.xxx.xxx"; $external = "yahoo.com"; $gwping=exec("/sbin/ping -c 1 -i 1 $gateway"); $extping=exec("/sbin/ping -c 1 -i 1 $external"); if(strlen($gwping)>1 && strlen($extping)>1) { exec("/bin/echo 1 > /dev/led/led2"); } else { if(strlen($gwping)>1 && strlen($extping)<=1) exec("/bin/echo f5 > /dev/led/led2"); else exec("/bin/echo 0 > /dev/led/led2"); } ?>
The next one tests for how many pptp users are connected. If there are users connected then it turns LED3 on. I was debating having it flash faster for more users, but meh.
#!/usr/local/bin/php -q exec("/sbin/ifconfig -a", $a); $pptpusers = 0; foreach($a as $val) { if(preg_match("/^ng.*UP/", $val)) $pptpusers++; } if($pptpusers > 0) exec("echo 1 > /dev/led/led3"); else exec("echo 0 > /dev/led/led3"); ?>
I set cron to run these every few minutes.
-
Nice, there are a lot of things to think about to be used with the LEDs. As the soekris only has 1 LED (which is labeled Error I think) we might want to have one LED indicating non acknowledged alerts in 1.1. However, the wrap has more LEDs and assigning different functions to these might be handy too (like dropdowns in the gui what which LED is indicating).
Feel free to make further suggestions and codesnippets here:
http://forum.pfsense.org/index.php?topic=398.0 -
This is pretty neat, but can you extend this a little more and make it work with config.xml ? If so, I'll commit.
-
I know I can get it to pull the gateway from config.xml for the inernet connection test. Should I add an entry in config.xml for the external site or just leave it yahoo? I guess a DNS server would also work.
I only have my WRAP for a few days this week before it's shipped off to a client. Having a lot of fun with it though. :)