Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    ALIX 2c3 and pfsense (LEDs)

    Scheduled Pinned Locked Moved General pfSense Questions
    51 Posts 8 Posters 36.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jimpJ
      jimp Rebel Alliance Developer Netgate
      last edited by

      I found it here on the forum:
      http://forum.pfsense.org/index.php/topic,3454.msg21194.html#msg21194

      I'll keep experimenting.

      Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

      Need help fast? Netgate Global Support!

      Do not Chat/PM for help!

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        It still compiles and runs for me, I've got LED2 showing my WAN activity and LED3 showing my ath0 activity.

        It would still need some kind of a user interface to configure, I'll have to see if I can whip something up.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • S
          serialdie
          last edited by

          jimp,

          Thats great!!!!

          Lets see how it works out!

          Thanks!

          1 Reply Last reply Reply Quote 0
          • dotdashD
            dotdash
            last edited by

            Just grabbed a new image and loaded it on an Alix. The /dev/led devices are there and working- thank you Jim. I couldn't find blinkled, but that may not be in the build yet. Anyway, here are my two cents as to some handy options for the LEDs.

            1. Use an LED as a 'ready' or 'armed' light. Helpful when you are working with a remote end user. I did something like this by putting a script to light LED2 in  /usr/local/etc/rc.d/ and appending a command to turn it off in /etc/rc.shutdown (kind of a hack).
            2. Activity for an interface. RSW's blinkled works well for this eg- blinkled -i ath0 -l /dev/led/led3
            3. VPN linkup. I'd like to be able to do this with IPSec (like on a PIX or something), but I'm not sure how to go about it. Just putting it out there.
            4. Blink an LED on active alert. I believe this was done with WRAPs at some point, but I never had a WRAP to test with.
            5. A simple gui would be cool, enumerate the led devices and provide a menu with some stock options or a custom script.
              These are only suggestions, I'm happy just to have the led devices now. I can do more testing on this if you need it.
            1 Reply Last reply Reply Quote 0
            • jimpJ
              jimp Rebel Alliance Developer Netgate
              last edited by

              dotdash,

              Good to hear it's working for you, too. I have locally compiled blinkled and have it working, though it will take a little time before I can get any kind of gui going. blinkled is not currently in pfSense anywhere, but if I can get it working with a UI I'm sure it will find its way in.

              I doubt it would be a good candidate for a change that would make it into 1.2.3, but 2.0 may only be a couple months away at this point, depending on progress.

              I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3

              As long as I know blinkled works for people and doesn't cause any undue load issues, I'll carry on. It seems to work fine on my ALIX and I have yet to see top say it uses more than 0.00% cpu :)

              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 0
              • dotdashD
                dotdash
                last edited by

                @jimp:

                I think LED2 already does blink on an active alert, but a slow blink. I'd like something more like you see with: echo 'm…---...' > /dev/led/led3

                Ah, yes it does. I probably should have tested that first. Enabling ssh is an easy way to trigger an alert.
                This appears to be defined in /etc/inc/notices.inc:
                function close_notice($id) {
                       global $notice_path;
                       require_once("util.inc");
                       /* soekris /
                       if(file_exists("/dev/led/error"))
                               exec("/bin/echo 0 > /dev/led/error");
                       /
                wrap */
                       if(file_exists("/dev/led/led2"))
                               exec("/bin/echo 0 > /dev/led/led2");
                       $ids = array();
                       if(!$notices = get_notices()) return;
                       if($id == "all") {
                               unlink_if_exists($notice_path);
                               return;
                       }
                       foreach(array_keys($notices) as $time) {

                (Oops, that's the off stanza. The on is sending /bin/echo f5 > /dev/led/led2)

                Just verified /dev/led/error on a net5501 blinks the same as the Alix on an echo f5, so I'm not sure why the Soekris just gets a solid light and the Alix gets a blink.

                1 Reply Last reply Reply Quote 0
                • S
                  serialdie
                  last edited by

                  I try to compile it my self in my pfsense box and it error out with a bunch of errors….

                  
                  # gcc blinkled.c -lkvm -o blinkled
                  blinkled.c:9:23: error: no include path in which to search for sys/types.h
                  blinkled.c:10:24: error: no include path in which to search for sys/socket.h
                  blinkled.c:11:20: error: no include path in which to search for net/if.h
                  blinkled.c:12:23: error: no include path in which to search for arpa/inet.h
                  blinkled.c:13:24: error: no include path in which to search for netinet/in.h
                  blinkled.c:15:24: error: no include path in which to search for net/if_var.h
                  blinkled.c:17:23: error: no include path in which to search for net/pfvar.h
                  blinkled.c:18:17: error: no include path in which to search for kvm.h
                  blinkled.c:19:19: error: no include path in which to search for fcntl.h
                  blinkled.c:20:19: error: no include path in which to search for nlist.h
                  blinkled.c:21:23: error: no include path in which to search for sys/queue.h
                  blinkled.c:22:19: error: no include path in which to search for stdio.h
                  blinkled.c:23:20: error: no include path in which to search for string.h
                  blinkled.c:24:20: error: no include path in which to search for limits.h
                  blinkled.c:25:20: error: no include path in which to search for unistd.h
                  blinkled.c:27: error: array type has incomplete element type
                  blinkled.c:29: error: 'NULL' undeclared here (not in a function)
                  blinkled.c: In function 'main':
                  blinkled.c:52: error: storage size of 'sa' isn't known
                  blinkled.c:58: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:58: error: 'stderr' undeclared (first use in this function)
                  blinkled.c:58: error: (Each undeclared identifier is reported only once
                  blinkled.c:58: error: for each function it appears in.)
                  blinkled.c:72: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:78: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:82: error: 'F_OK' undeclared (first use in this function)
                  blinkled.c:84: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:93: error: 'O_WRONLY' undeclared (first use in this function)
                  blinkled.c:95: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:98: error: 'STDIN_FILENO' undeclared (first use in this function)
                  blinkled.c:99: error: 'STDOUT_FILENO' undeclared (first use in this function)
                  blinkled.c:100: error: 'STDERR_FILENO' undeclared (first use in this function)
                  blinkled.c:110: warning: incompatible implicit declaration of built-in function 'memset'
                  blinkled.c:110: error: invalid application of 'sizeof' to incomplete type 'struct sigaction' 
                  blinkled.c:113: error: 'SIGTERM' undeclared (first use in this function)
                  blinkled.c:115: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:118: error: 'SIGINT' undeclared (first use in this function)
                  blinkled.c:120: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:126: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:136: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:142: warning: incompatible implicit declaration of built-in function 'sprintf'
                  blinkled.c:147: warning: incompatible implicit declaration of built-in function 'sprintf'
                  blinkled.c:155: warning: incompatible implicit declaration of built-in function 'sprintf'
                  blinkled.c:160: warning: incompatible implicit declaration of built-in function 'printf'
                  blinkled.c: In function 'sigterm':
                  blinkled.c:167: error: 'SIG_IGN' undeclared (first use in this function)
                  blinkled.c: In function 'getifstats':
                  blinkled.c:174: error: storage size of 'ifh' isn't known
                  blinkled.c:180: error: storage size of 'ifc' isn't known
                  blinkled.c:182: error: 'kvm_t' undeclared (first use in this function)
                  blinkled.c:182: error: 'kd' undeclared (first use in this function)
                  blinkled.c:183: error: 'ssize_t' undeclared (first use in this function)
                  blinkled.c:183: error: expected ';' before 'n'
                  blinkled.c:184: error: '_POSIX2_LINE_MAX' undeclared (first use in this function)
                  blinkled.c:186: error: 'O_RDONLY' undeclared (first use in this function)
                  blinkled.c:189: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:189: error: 'stderr' undeclared (first use in this function)
                  blinkled.c:194: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:200: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:204: error: 'n' undeclared (first use in this function)
                  blinkled.c:207: warning: incompatible implicit declaration of built-in function 'fprintf'
                  blinkled.c:211: warning: assignment makes pointer from integer without a cast
                  blinkled.c:211: error: 'if_list' undeclared (first use in this function)
                  blinkled.c:211: warning: assignment makes pointer from integer without a cast
                  blinkled.c:213: error: 'u_long' undeclared (first use in this function)
                  blinkled.c:213: error: expected ')' before 'ifp'
                  blinkled.c:216: warning: incompatible implicit declaration of built-in function 'fprintf'
                  
                  

                  Any pointers will be greatly appreciated!

                  Thank You.

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    Does that FreeBSD box have all of the FreeBSD sources and includes present?

                    Seems weird that it wouldn't work. I compiled it from my pfSense builder box (RELENG_7_2) and it worked fine.

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • S
                      serialdie
                      last edited by

                      ooo mhhhh I dont think so… This is a production pfsense box... Is there a VMware image of the builders image?

                      Thank you!

                      1 Reply Last reply Reply Quote 0
                      • jimpJ
                        jimp Rebel Alliance Developer Netgate
                        last edited by

                        This is easier:

                        /etc/rc.conf_mount_rw
                        fetch -o /usr/local/bin/blinkled http://the-ori.org/pfs/blinkled
                        chmod a+x /usr/local/bin/blinkled
                        /etc/rc.conf_mount_ro
                        rehash
                        

                        I'll see about getting a package or something built, but it will be a couple days unless things clear up. Things are have been a little busy at work/home.

                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                        Need help fast? Netgate Global Support!

                        Do not Chat/PM for help!

                        1 Reply Last reply Reply Quote 0
                        • S
                          serialdie
                          last edited by

                          jimp,

                          Thank you very much!

                          1 Reply Last reply Reply Quote 0
                          • jimpJ
                            jimp Rebel Alliance Developer Netgate
                            last edited by

                            I know it's been a while but I do have some updates:

                            #1: I'm going to be adding some LED stuff to 2.0. Stuff that won't/can't make it into 1.2.3 because it will have to be in system files and not in a package.

                            #2: I did just add a blinkled package that will work on the 1.2.3-RC nanobsd images. It works for me, so give it a try. After installing the package, go to Interfaces -> Assign LEDs. Should be self-explanatory from there.

                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                            Need help fast? Netgate Global Support!

                            Do not Chat/PM for help!

                            1 Reply Last reply Reply Quote 0
                            • M
                              matrix200
                              last edited by

                              Hmm, just installed and not working here.
                              Nothing blinks and service remains stopped after I attempt to start it.
                              I have 1.2.3RC2 build from Jun 16.
                              The configuration is : enable both leds and assign led2 to wan and led3 to wifi.
                              Where should I look for logs?

                              Current network "hardware" :
                              Running 2.2RC in Virtualbox 4.2.16.

                              Retired:
                              ALIX2C2 , 4 gigabyte disk cf card running 2.0 (official release).

                              1 Reply Last reply Reply Quote 0
                              • jimpJ
                                jimp Rebel Alliance Developer Netgate
                                last edited by

                                @matrix200:

                                Hmm, just installed and not working here.
                                Nothing blinks and service remains stopped after I attempt to start it.
                                I have 1.2.3RC2 build from Jun 16.
                                The configuration is : enable both leds and assign led2 to wan and led3 to wifi.
                                Where should I look for logs?

                                There are no logs, not yet. It's only the first attempt at getting the package working. I'll polish it up some more over the next few days as I get time.

                                I only tested it on a nanobsd 2.0 snapshot from this past week.

                                So you checked the main enable box, the box for each led, and assigned them both?

                                I'm not sure if the service status works yet, it errors out for me so far. Try going to Diagnostics > Command, and type:

                                ps xa | grep blinkled
                                

                                It works for me, and even starts back up after a reboot.

                                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                Need help fast? Netgate Global Support!

                                Do not Chat/PM for help!

                                1 Reply Last reply Reply Quote 0
                                • M
                                  matrix200
                                  last edited by

                                  Yes, I have enabled both leds and checked the main enable box.
                                  The process doesn't seem to be running when I try using ps aux | grep blink
                                  Is there a way to run it manually from ssh shell?
                                  Also I don't have led device in the dev folder.
                                  Maybe 1.2.3RC2 from jun16 doesn't have the drivers for that?

                                  Just one  more thing I forgot to mention :
                                  I am running a regular full version (not nanobsd or embedded).

                                  Ok one more update :)
                                  I was able to run the blinkled from the ssh and here is an error message that I got :
                                  Error: Unable to access led

                                  Current network "hardware" :
                                  Running 2.2RC in Virtualbox 4.2.16.

                                  Retired:
                                  ALIX2C2 , 4 gigabyte disk cf card running 2.0 (official release).

                                  1 Reply Last reply Reply Quote 0
                                  • jimpJ
                                    jimp Rebel Alliance Developer Netgate
                                    last edited by

                                    You may not have a new enough build. I added the patch on about June 22nd to add support for ALIX LEDs.

                                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                    Need help fast? Netgate Global Support!

                                    Do not Chat/PM for help!

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      matrix200
                                      last edited by

                                      Yeah looks like it,
                                      Can you recommend a specific build known not to cause too many problem but is recent enough?
                                      I am kinda hestitant to install a new snapshot with all those horror stories about the latest build breaking everything etc :)

                                      Ok nevermind I went ahead and installed the latest snapshot and the led package works now:)
                                      One thing I don't understand though.
                                      When I do pinging say my wireless client from the pfsense nothing blinks.
                                      When I start browsing from the wireless client it does blink.
                                      Is pinging not enough for the light to start blinking?

                                      Current network "hardware" :
                                      Running 2.2RC in Virtualbox 4.2.16.

                                      Retired:
                                      ALIX2C2 , 4 gigabyte disk cf card running 2.0 (official release).

                                      1 Reply Last reply Reply Quote 0
                                      • jimpJ
                                        jimp Rebel Alliance Developer Netgate
                                        last edited by

                                        I haven't really looked at the source code for the blinkled program itself. It may ignore traffic until it passes a certain threshold.

                                        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                        Need help fast? Netgate Global Support!

                                        Do not Chat/PM for help!

                                        1 Reply Last reply Reply Quote 0
                                        • dotdashD
                                          dotdash
                                          last edited by

                                          Very nice, thanks Jimp. It's working fine on my test rig. One thought- maybe move the alert to LED1 and return the state to on, instead of using LED2, then turning it off when the alert is cleared? This would leave LED2 and LED3 free for blinkled.

                                          1 Reply Last reply Reply Quote 0
                                          • jimpJ
                                            jimp Rebel Alliance Developer Netgate
                                            last edited by

                                            @dotdash:

                                            Very nice, thanks Jimp. It's working fine on my test rig. One thought- maybe move the alert to LED1 and return the state to on, instead of using LED2, then turning it off when the alert is cleared? This would leave LED2 and LED3 free for blinkled.

                                            That's my intent after the code settles for a bit.

                                            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                                            Need help fast? Netgate Global Support!

                                            Do not Chat/PM for help!

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.