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

    Netgate SG-3100 LEDs

    Scheduled Pinned Locked Moved Official Netgate® Hardware
    54 Posts 20 Posters 35.5k 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.
    • M
      msf2000 @wgstarks
      last edited by

      @wgstarks

      Got a working tcsh shell script. It updates the left LED to green, amber, red, or blue, depending on the gateway status of the WAN port. Should be easy to customize.

      #!/bin/tcsh
      #
      # This script updates the SG-3100 device's first LED with gateway status
      #
      #   php /usr/local/sbin/pfSsh.php playback gatewaystatus
      #
      set gw = `/usr/local/bin/php /usr/local/sbin/pfSsh.php playback gatewaystatus | grep WAN `
      set gwping = `echo $gw | awk '{ ORS="  "; print $6 }' `
      set gwstatus = `echo $gw | awk '{ ORS="  "; print $7 }' `
      
      # based on gwstatus, set color of first LED
      # led a  -  led b  -  led c
      # 6 7 8  -  3 4 5  -  0 1 2 
      
      switch ($gwstatus)
      case "none":
      case "Online": 
          /usr/sbin/gpioctl 6 duty 0
          /usr/sbin/gpioctl 7 duty 128
          /usr/sbin/gpioctl 8 duty 0
          breaksw
      case "down": 
      case "Offline":
          /usr/sbin/gpioctl 6 duty 128
          /usr/sbin/gpioctl 7 duty 0
          /usr/sbin/gpioctl 8 duty 0
          breaksw
      case "highloss":
      case "loss": 
      case "highdelay":
      case "delay":
      case "Warning": 
          /usr/sbin/gpioctl 6 duty 128
          /usr/sbin/gpioctl 7 duty 32
          /usr/sbin/gpioctl 8 duty 0
          breaksw
      default:
          /usr/sbin/gpioctl 6 duty 0
          /usr/sbin/gpioctl 7 duty 0
          /usr/sbin/gpioctl 8 duty 128
      endsw
      
      B 1 Reply Last reply Reply Quote 2
      • wgstarksW
        wgstarks
        last edited by

        @msf2000 said in Netgate SG-3100 LEDs:

        @wgstarks
        Got a working tcsh shell script.

        How/where should I install this? Needs to run at boot I'm guessing?

        Box: SG-4200

        M 1 Reply Last reply Reply Quote 0
        • M
          msf2000 @wgstarks
          last edited by

          @wgstarks

          Yes, upload the shell script as a file. (Root's home directory is fine.) Then, install the "Cron" package. Add the shell script as a cron job to run every minute.

          wgstarksW 1 Reply Last reply Reply Quote 0
          • wgstarksW
            wgstarks @msf2000
            last edited by

            @msf2000
            Thanks. Looks like it's working.

            Box: SG-4200

            D 1 Reply Last reply Reply Quote 0
            • D
              dpasadis @wgstarks
              last edited by

              @wgstarks It would be great if the lights could serve 2 purposes:
              (1) show boot status during a power-on or reboot (like they do now)
              (2) show network activity on 3 network segments the rest of the time (WAN, LAN, OPT1)

              If #2 was implemented, a glance at the firewall would tell us a lot about what's going on. It would be greatly appreciated.

              wgstarksW M 2 Replies Last reply Reply Quote 0
              • wgstarksW
                wgstarks @dpasadis
                last edited by

                @dpasadis said in Netgate SG-3100 LEDs:

                @wgstarks It would be great if the lights could serve 2 purposes:
                (1) show boot status during a power-on or reboot (like they do now)
                (2) show network activity on 3 network segments the rest of the time (WAN, LAN, OPT1)

                If #2 was implemented, a glance at the firewall would tell us a lot about what's going on. It would be greatly appreciated.

                This isn’t my code. It was provided by @msf2000.

                Box: SG-4200

                1 Reply Last reply Reply Quote 0
                • M
                  msf2000 @dpasadis
                  last edited by

                  @dpasadis

                  1. You could install the "ShellCmd" package and have the LED script run on bootup, if you'd like.
                  2. Just rotate the device 180 degrees, and you'll see the network traffic. ;)

                  The script I wrote was more for users to see that the firewall is working, instead of power-cycling the pfsense unnecessarily when their internet is slow.

                  1 Reply Last reply Reply Quote 0
                  • D
                    dpasadis
                    last edited by

                    Thanks msf2000. I appreciate your contribution.

                    I like your first suggestion (and your second for different reasons).

                    I've done a lot of work on operating systems, including Unix/Linux, so I might be able to figure out #1 without spending a crazy amount of time on it. If I get a good result, I'll share it here.

                    1 Reply Last reply Reply Quote 0
                    • Mr_AJM
                      Mr_AJ
                      last edited by

                      Cool thread!

                      1 Reply Last reply Reply Quote 0
                      • Z
                        z4xh
                        last edited by

                        I wrote some more comprehensive documentation on my blog, which explains the timings in more depth. https://www.zacharyschneider.ca/blog/post/2019/12/customizing-leds-netgate-sg-3100

                        Hope it helps!

                        1 Reply Last reply Reply Quote 3
                        • J
                          jchonchi
                          last edited by

                          I took some of the information in this article and wrote a script that sets the LED colors based on network interface state and bandwidth usage.

                          K styxlS 2 Replies Last reply Reply Quote 5
                          • K
                            KnowbuddyYuno @jchonchi
                            last edited by

                            @jchonchi Sounds useful. Does the script work as intended?

                            I'm a complete moron when it comes to coding, so my risk tolerance is near zero.

                            1 Reply Last reply Reply Quote 0
                            • styxlS
                              styxl @jchonchi
                              last edited by

                              @jchonchi i am using the script, works like charm. Thanks

                              1 Reply Last reply Reply Quote 0
                              • jchonigJ
                                jchonig
                                last edited by jchonig

                                Very helpful thread.

                                I re-wrote msf2000s script as a sh script and generalized it a bit.

                                I use the left (circult) and middle (square) LEDs to monitor my two WAN connections.

                                I also toned it down a bit so I don't need sunblock.

                                You can find it here

                                Thanks

                                Jeff

                                SG-4100
                                SG-2100
                                SG-1100

                                1 Reply Last reply Reply Quote 2
                                • B
                                  bldnightowl @msf2000
                                  last edited by

                                  @msf2000 This was working for a long time in 2.4.5 -- but doesn't seem to anymore in 21.02.

                                  wgstarksW M Z 3 Replies Last reply Reply Quote 0
                                  • wgstarksW
                                    wgstarks @bldnightowl
                                    last edited by

                                    @bldnightowl said in Netgate SG-3100 LEDs:

                                    @msf2000 This was working for a long time in 2.4.5 -- but doesn't seem to anymore in 21.02.

                                    After reading the release notes I’m guessing this is the reason-

                                    
                                    Several abandoned and deprecated packages have been removed, including:
                                    
                                    OpenBGPD (use FRR instead)
                                    Quagga OSPF (use FRR instead)
                                    routed
                                    blinkled
                                    gwled
                                    
                                    

                                    Box: SG-4200

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      msf2000 @bldnightowl
                                      last edited by

                                      @bldnightowl
                                      What the crap is NetGate doing with version numbers? Breaking their own products? I don't plan to update past 2.4.5. Guess I'll read up on what's going on later.

                                      As for my script, sorry, you are probably on your own if you upgrade to v21.

                                      1 Reply Last reply Reply Quote 0
                                      • Z
                                        z4xh @bldnightowl
                                        last edited by

                                        @bldnightowl Check that you're using the right GPIO device:

                                        sysctl dev.gpio | grep .led.
                                        

                                        When I upgraded to 21.02/2.5, the GPIO device changed from 0 to 2 on my SG-3100.

                                        @wgstarks The blinkled and gwled packages aren't needed for the SG-3100 LED driver, those are for controlling the LEDs on ALIX and WRAP platforms.

                                        jchonigJ 1 Reply Last reply Reply Quote 0
                                        • jchonigJ
                                          jchonig @z4xh
                                          last edited by

                                          @z4xh What is the relationship between the output of that command to the numbers I provide to gpioctl? I'll update my script to make use of that and test it on 2.4.5 while they figure out the issues with 21.02.

                                          Thanks.

                                          Jeff

                                          Thanks

                                          Jeff

                                          SG-4100
                                          SG-2100
                                          SG-1100

                                          Z 1 Reply Last reply Reply Quote 0
                                          • Z
                                            z4xh @jchonig
                                            last edited by

                                            @jchonig This github commit explains it best: https://github.com/justdaniel-gh/sg3100customleds/commit/ddbf412cb1cf3ba32160972e2177c356611ff57f

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