OPNsense Forum
English Forums => General Discussion => Topic started by: dcol on February 05, 2018, 12:00:53 am
-
Monit is just another example and reason why OPNsense is the choice of firewalls. I highly recommend this plugin because of the built-in system monitoring capability. This plugin gives us a heads up on stressed or failing hardware which is crucial for me since some of my firewalls are very remote. It can also alert when the network has issues. Just one of many reasons I forked over to OPNsense.
-
I'm still trying to wrap my head around monit :) It seems quite simple, but meh.. Something new to play with hehe.
-
Thank you for the feedback.
And yes, it's better to see problems before the customers do. :)
-
Looks pretty nice, Is there a guide to add more metrics to watch? Or is it what you see is what you get? CPUtemp would be nice.
-
I second that. CPU temp along with CPU Usage would be a good alert for a failing CPU or fan. CPU Usage is already in monit, but if CPU temp was up and CPU Usage was not, that would tell you that maybe a fan was going out.
-
You could write a script that to check the CPU temp and add it to Monit as described in the Monit HowTo (https://forum.opnsense.org/index.php?topic=5303.0) (look for the CheckIPMI.sh script).
CheckCPUTemp.sh
#!/bin/csh
set MaxCPUTemp = 75
set NumCPUs = `sysctl -n kern.smp.cpus`
set CurrentCPU = 0
while ( $CurrentCPU < $NumCPUs )
set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'`
echo "CPU $CurrentCPU temp: $CPUTemp"
if ( $CPUTemp >= $MaxCPUTemp ) then
exit 1
endif
@ CurrentCPU = $CurrentCPU + 1
end
exit 0
-
would be nice to have monin too
-
If we had a Munin expert here...
Writing OPNsense plugins is such a simple thing. :D
-
Added this to Monit
Thanks!
-
@fanusen
how a plugin have to look like?
-
Monit is very nice plugin.
I have one case, i want to receive email notification for WAN IP, on change or just every day report. How can do this?
Thanks!
-
The CPU temp plugin did not work. Followed the How-To
I get 'Status Failed' response.
Is there a driver I need to install?
What condition should I use?
I did the following
#!/bin/csh
set MaxCPUTemp = 60
set status = 0
set NumCPUs = `sysctl -n kern.smp.cpus`
set CurrentCPU = 0
while ( $CurrentCPU < $NumCPUs )
set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'`
echo "CPU $CurrentCPU temp: $CPUTemp"
if ( $CPUTemp >= $MaxCPUTemp ) then
set status = 1
exit 1
endif
@ CurrentCPU = $CurrentCPU + 1
end
exit 0
if ( $Status == 0 ) then
echo "System Health: OK
endif
exit $Status
And used condition - status notequal 0
This code delivers a 'status failed' error?
I am not a coder, can anyone help out?
-
You could write a script that to check the CPU temp and add it to Monit as described in the Monit HowTo (https://forum.opnsense.org/index.php?topic=5303.0) (look for the CheckIPMI.sh script).
CheckCPUTemp.sh
#!/bin/csh
set MaxCPUTemp = 75
set NumCPUs = `sysctl -n kern.smp.cpus`
set CurrentCPU = 0
while ( $CurrentCPU < $NumCPUs )
set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'`
echo "CPU $CurrentCPU temp: $CPUTemp"
if ( $CPUTemp >= $MaxCPUTemp ) then
exit 1
endif
@ CurrentCPU = $CurrentCPU + 1
end
exit 0
What is the condition to set in the 'Service Test Settings'?
Also, if I try and run this script from the shell I get a 'Command not found' error. This is a csh script. Should work with FreeBSD. How can I test this script from the shell?
[UPDATE]
OMG, figured it out. when I copied/pasted the file into FreeBSD I was using Windows line endings. File worked in the shell after I changed to UNIX (LF) line endings. Linux is a PIA.