Is it safe to configure in /root/ directory such as running a script
-
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.0CI want to know if there is any impact on running firewall if I implement this procedure. Thanks in advance
-
@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))
-
You need to add it as a custom net-snmp extend object first. Though I'm also missing something to get it to run
-
@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.
-
-
: 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.0Cthis part need to run separately to get the snmp for the temperature of the firewall
-
@Gertjan Munin... haven't seen that in a long time!