OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • Monit is a great plugin.
« previous next »
  • Print
Pages: [1]

Author Topic: Monit is a great plugin.  (Read 7602 times)

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Monit is a great plugin.
« 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.
« Last Edit: February 05, 2018, 04:14:26 pm by dcol »
Logged

slackadelic

  • Full Member
  • ***
  • Posts: 147
  • Karma: 9
    • View Profile
Re: Monit is a great plugin.
« Reply #1 on: February 05, 2018, 02:32:03 pm »
I'm still trying to wrap my head around monit :) It seems quite simple, but meh.. Something new to play with hehe.
Logged

faunsen

  • Full Member
  • ***
  • Posts: 102
  • Karma: 17
    • View Profile
Re: Monit is a great plugin.
« Reply #2 on: February 08, 2018, 09:26:59 am »
Thank you for the feedback.
And yes, it's better to see problems before the customers do.  :)
Logged

mow4cash

  • Newbie
  • *
  • Posts: 37
  • Karma: 2
    • View Profile
Re: Monit is a great plugin.
« Reply #3 on: February 10, 2018, 05:12:20 am »
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.
Logged

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Monit is a great plugin.
« Reply #4 on: February 10, 2018, 09:02:05 pm »
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.
Logged

faunsen

  • Full Member
  • ***
  • Posts: 102
  • Karma: 17
    • View Profile
Re: Monit is a great plugin.
« Reply #5 on: February 12, 2018, 09:29:58 am »
You could write a script that to check the CPU temp and add it to Monit as described in the Monit HowTo (look for the CheckIPMI.sh script).

CheckCPUTemp.sh
Code: [Select]
#!/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
Logged

vikozo

  • Full Member
  • ***
  • Posts: 211
  • Karma: 5
    • View Profile
    • wombat.ch
Re: Monit is a great plugin.
« Reply #6 on: February 12, 2018, 12:53:30 pm »
would be nice to have monin too
Logged
apu2c4 / wle200nx / 240 Disk --> Firewall | FW-03
---
OPNsense 22.1.6-amd64
FreeBSD 13.0-STABLE
OpenSSL 1.1.1n 15 Mar 2022

faunsen

  • Full Member
  • ***
  • Posts: 102
  • Karma: 17
    • View Profile
Re: Monit is a great plugin.
« Reply #7 on: February 12, 2018, 01:15:47 pm »
If we had a Munin expert here...
Writing OPNsense plugins is such a simple thing.  :D
Logged

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Monit is a great plugin.
« Reply #8 on: February 12, 2018, 03:56:56 pm »
Added this to Monit
Thanks!
Logged

vikozo

  • Full Member
  • ***
  • Posts: 211
  • Karma: 5
    • View Profile
    • wombat.ch
Re: Monit is a great plugin.
« Reply #9 on: February 13, 2018, 02:01:05 pm »
@fanusen
how a plugin have to look like?
Logged
apu2c4 / wle200nx / 240 Disk --> Firewall | FW-03
---
OPNsense 22.1.6-amd64
FreeBSD 13.0-STABLE
OpenSSL 1.1.1n 15 Mar 2022

b0n3v

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Monit is a great plugin.
« Reply #10 on: March 01, 2018, 10:08:29 am »
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!
Logged

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Monit is a great plugin.
« Reply #11 on: March 03, 2018, 12:24:19 am »
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
Code: [Select]
#!/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?
« Last Edit: March 03, 2018, 05:42:56 pm by dcol »
Logged

dcol

  • Hero Member
  • *****
  • Posts: 635
  • Karma: 51
    • View Profile
Re: Monit is a great plugin.
« Reply #12 on: March 03, 2018, 05:43:58 pm »
Quote from: faunsen on February 12, 2018, 09:29:58 am
You could write a script that to check the CPU temp and add it to Monit as described in the Monit HowTo (look for the CheckIPMI.sh script).

CheckCPUTemp.sh
Code: [Select]
#!/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.
« Last Edit: March 03, 2018, 07:55:41 pm by dcol »
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • Monit is a great plugin.
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2