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

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

Scheduled Pinned Locked Moved General pfSense Questions
7 Posts 4 Posters 514 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.
  • O
    opahla
    last edited by Dec 4, 2023, 8:29 AM

    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

    G D 3 Replies Last reply Dec 4, 2023, 8:46 AM Reply Quote 0
    • G
      Gertjan @opahla
      last edited by Dec 4, 2023, 8:46 AM

      @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
      • S
        stephenw10 Netgate Administrator
        last edited by Dec 4, 2023, 1:13 PM

        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
        • D
          dennypage @opahla
          last edited by Dec 5, 2023, 12:00 AM

          @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
          • G
            Gertjan @opahla
            last edited by Dec 5, 2023, 6:40 AM

            @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 ??

            D 1 Reply Last reply Dec 5, 2023, 2:55 PM Reply Quote 0
            • O
              opahla
              last edited by Dec 5, 2023, 6:55 AM

              : 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
              • D
                dennypage @Gertjan
                last edited by Dec 5, 2023, 2:55 PM

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

                1 Reply Last reply Reply Quote 0
                7 out of 7
                • First post
                  7/7
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                  This community forum collects and processes your personal information.
                  consent.not_received