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

    Is it safe to configure in /root/ directory such as running a script

    General pfSense Questions
    4
    7
    505
    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.
    • O
      opahla
      last edited by

      Hi team,

      I have been wondering is it safe to put a script inside the /root/ path. Such as this script:

      Type: extend
      Name: gettemps
      Program: /root/gettemps.sh
      Then in /root/gettemps.sh, put:

      #!/bin/sh
      /sbin/sysctl dev.cpu | /usr/bin/awk '/temperature/ {print $2;}'
      Set it executable, and then use the line-by-line extended OID to access it:

      : snmpwalk -c mycommunity -v 2c 127.0.0.1 nsExtendOutLine."gettemps"
      NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".1 = STRING: 42.0C
      NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".2 = STRING: 42.0C
      NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".3 = STRING: 41.0C
      NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".4 = STRING: 42.0C

      I want to know if there is any impact on running firewall if I implement this procedure. Thanks in advance

      GertjanG dennypageD 3 Replies Last reply Reply Quote 0
      • GertjanG
        Gertjan @opahla
        last edited by

        @opahla said in Is it safe to configure in /root/ directory such as running a script:

        #!/bin/sh
        /sbin/sysctl dev.cpu | /usr/bin/awk '/temperature/ {print $2;}'

        That script echos two (or more) values, the CPU core temperature.
        You could call that xxx ties a second : no risk.
        It's not logging to file, so no worries about that file becoming to big over time.

        @opahla said in Is it safe to configure in /root/ directory such as running a script:

        : snmpwalk -c mycommunity -v 2c 127.0.0.1 nsExtendOutLine."gettemps"

        Not sure what that does : the same thing ?
        It doesn't work on my pfSense :

        [23.09-RELEASE][root@pfSense.bhf.tld]/root: snmpwalk -c mycommunity -v 2c 127.0.0.1 nsExtendOutLine."gettemp"
        nsExtendOutLine.gettemp: Unknown Object Identifier (Index out of range: gettemp (nsExtendToken))
        

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 0
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          You need to add it as a custom net-snmp extend object first. Though I'm also missing something to get it to run

          1 Reply Last reply Reply Quote 0
          • dennypageD
            dennypage @opahla
            last edited by

            @opahla said in Is it safe to configure in /root/ directory such as running a script:

            I want to know if there is any impact on running firewall if I implement this procedure.

            There is no problem with this.

            FWIW, if you are feeding this to a monitoring system, you might want to adjust your script slightly to remove the type suffix so that you have a pure numeric value.

            My version of this is...

            Type: extend
            Name: temperatures
            Program: /root/net-snmp/temperatures

            [23.09-RELEASE][root@fw]/root: cat net-snmp/temperatures
            #!/bin/sh
            /sbin/sysctl dev.cpu | /usr/bin/awk '/temperature/ {print $2;}' | sed 's/[CF]//g'
            [23.09-RELEASE][root@fw]/root: 
            

            I also use extends for ntp-client, unbound, and dpinger.

            1 Reply Last reply Reply Quote 1
            • GertjanG
              Gertjan @opahla
              last edited by

              @opahla

              Ok, I get it : a monitoring system like this

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

              dennypageD 1 Reply Last reply Reply Quote 0
              • O
                opahla
                last edited by

                : snmpwalk -c mycommunity -v 2c 127.0.0.1 nsExtendOutLine."gettemps"
                NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".1 = STRING: 42.0C
                NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".2 = STRING: 42.0C
                NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".3 = STRING: 41.0C
                NET-SNMP-EXTEND-MIB::nsExtendOutLine."gettemps".4 = STRING: 42.0C

                this part need to run separately to get the snmp for the temperature of the firewall

                1 Reply Last reply Reply Quote 0
                • dennypageD
                  dennypage @Gertjan
                  last edited by

                  @Gertjan Munin... haven't seen that in a long time!

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