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.
    • 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
                                  • X
                                    xbipin
                                    last edited by

                                    i was waiting for this since the day i bought the alix, is it possible to configure the led to blink even faster or lets say a way to configure the on and off period, i want it to blick link the leds on  a switch or a router, which is faster.

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

                                      @xbipin:

                                      i was waiting for this since the day i bought the alix, is it possible to configure the led to blink even faster or lets say a way to configure the on and off period, i want it to blick link the leds on  a switch or a router, which is faster.

                                      You would have to look at the source of the blinkled program for that, which I didn't write. I don't think it can be used as a realtime indicator like a real switch port. It only polls periodically and flashes if it sees activity within a specific timeframe, if I recall correctly.

                                      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
                                      • X
                                        xbipin
                                        last edited by

                                        how about if it was used for the correct purpose of the LED being in the alix in the first place, think of it as a computer, LED1 could be power which it already is, LED2 as processor indicator and LED3 as HDD or CF read/write as the LEDs on the network adapters are enough of LEDs already blinking as for me they face the wall and there not being any way to turn them off as its directly plugged to the network card chip

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

                                          It being a customizable device, there is no real "correct purpose" for the LEDs, they can be whatever someone programs them to be. Personally, I like LED1 to be power and alerts, and LED2/3 to be network activity.

                                          If someone wants to come along and write a program that will flash the LEDs based on other types of activity, it would be more than welcome.

                                          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

                                            Here is an old thread with some additional ideas on using the LEDs. http://forum.pfsense.org/index.php/topic,327.0.html

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