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

Temperature Alert Script

Scheduled Pinned Locked Moved Development
7 Posts 7 Posters 8.6k 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.
  • J
    JMac87
    last edited by Jul 26, 2016, 6:47 PM

    I wrote a simple shell script to send an email alert when the average CPU temperature reaches a set threshold. It uses the php mail feature within PfSense since there is no "mail" command available.

    I'm using our firewall as a sort of temperature monitor for our server room, which frequently has HVAC issues. Instead of buying some sort of temperature monitor, I figured I'd just use the average temperature of the CPU and send an alert when it hits a certain temperature that is known to exist when our HVAC system is off/broken.

    I'm sure you guys could integrate this into the GUI for others to easily use, since pfSense has no such built-in function.

    https://gist.github.com/JMac87/1303f78c56a54165447568318eeca3b3

    Notes:
    You must set up a notification email in System > Advanced > Notifications.

    I had to edit /etc/inc/notices.inc to include:

    require_once("functions.inc");
    

    You can cron this script to run every X minutes or whatever interval you'd like to check.

    1 Reply Last reply Reply Quote 0
    • P
      pftdm007
      last edited by Aug 14, 2016, 10:10 PM

      Im amazed that pfsense is still not capable of sending a email notification when system or CPU temp goes above a set value.  All the pieces are there, its just to connect them together.

      • Email notification is there

      • CPU temp measurement is there

      • System temp measurement is there

      Whats the show stopper to integrate a GUI page to enter a treshold and set a checkbox to "Notify if above this value?"

      What about smart temps for HDDs??

      Freenas does this seamlessly AFAIK.  If I had any coding skills I'd attempt something on a VM but things as they are, I know nothing about coding.  ???

      Hardware monitoring and notification (temps, RAM and HDD status) are definitely something I'd be interested into.

      1 Reply Last reply Reply Quote 0
      • G
        guardian Rebel Alliance
        last edited by Aug 16, 2016, 9:14 PM

        Agreed… seems like an easy add, and could save someone's hardware from frying if a fan died.

        If you find my post useful, please give it a thumbs up!
        pfSense 2.7.2-RELEASE

        1 Reply Last reply Reply Quote 0
        • J
          jimp Rebel Alliance Developer Netgate
          last edited by Aug 23, 2016, 2:48 PM

          The stopper is primarily that we don't have a periodic polling script for monitoring those conditions. They are only displayed in the GUI when the dashboard is loaded. It's not difficult to add, but it would also need a GUI to control its settings (e.g. alert thresholds). Also support for temp sensors varies from system to system and hardware quirks with temp sensors make them not 100% reliable, so it may be something we'd have to restrict to hardware we can assure it will work for (e.g. systems we sell).

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • D
            dcol Banned
            last edited by Oct 2, 2017, 11:38 PM

            Worked like a charm.
            Now I need a script for CPU usage so if the CPU is pinned by suricata, I will be notified. It has happened to me on many occasions.

            1 Reply Last reply Reply Quote 0
            • K
              kpa
              last edited by Oct 3, 2017, 1:21 PM

              Jimp is right, this type of monitoring needs a lot of manual configuration because on many systems the readings are nonsensical unless adjusted properly using information from the manufacturer. For example some of the AMD CPUs give you negative values and you're supposed to know the reference temperature used to calculate the real temperature as reference+reported. On such systems the only out of the box reliable CPU temperature is the one show in BIOS setup.

              Such reporting system would work out of the box only on a small number of systems where the calibration values are known.

              1 Reply Last reply Reply Quote 0
              • L
                luckman212 LAYER 8
                last edited by Sep 3, 2022, 6:09 AM

                Leaving this here in case it's useful to anyone...

                github.com/luckman212/pfsense-temp-alert

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