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

    Can I trigger/create my own notifications?

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 2 Posters 760 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.
    • N
      neo4070
      last edited by neo4070

      Trying to find info if I can trigger a notification by myself/by my config.
      I've set up Pushover and it works. But I would like to configure my own, fine grained notifications. (Can't find this in docs or here in the forum - at least not succeeded finding this)

      Two examples:

      • I would like notifications sent when a named Alias is updated
      • I would also like notifications sent when X happens... (perhaps by filtering some string in a log)

      Thanks in advance for feedback :-)

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan @neo4070
        last edited by

        @neo4070

        Did you saw this https://forum.netgate.com/topic/137707/auto-update-check-checks-for-updates-to-base-system-packages-and-sends-email-alerts/16?_=1640877410356

        Get the script, edit it.
        Like this - remove a lot of lines :

        <?php
        
          require_once("pkg-utils.inc");
          require_once("notices.inc");
          require_once("util.inc");
        
          if (!empty($msg)) {
            log_error("Updates were found - sending email");
            notify_via_pushover($msg);
          }
        
        ?>
        

        add one line :

          $msg = "Hello there !"
        

        Like this :

        <?php

        require_once("pkg-utils.inc");
        require_once("notices.inc");
        require_once("util.inc");

        $msg = "Hello there !"

        if (!empty($msg)) {
        log_error("Updates were found - sending email");
        notify_via_pushover($msg);
        }

        ?>

        Save the with a filename and 'php' extension.

        Now go for it :

        php - q yourfilename.php
        

        You should receive something over pushover (dono what that is actually - so I could test myself).

        Remember : PHP is what Basic was at the end of the last century : you can do what you want.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        N 1 Reply Last reply Reply Quote 2
        • N
          neo4070 @Gertjan
          last edited by neo4070

          @gertjan Nope - missed that one. But great tip, thanks for the details as well ๐Ÿ‘ ๐ŸŽ–

          1 Reply Last reply Reply Quote 0
          • N
            neo4070
            last edited by

            Worked :-) Two small typos (?) but excellent tip - thank you very much!

            <?php
            
            	require_once("pkg-utils.inc");
            	require_once("notices.inc");
            	require_once("util.inc");
            
                    # Added ';' to the end of line
            	$msg = "Great tip from Gertjan!";
            
            	if (!empty($msg)) {
            		notify_via_pushover($msg);
            	}
            
            # When executed, removed space -> '-q':
            # php -q /root/pushover_test.php
            
            ?>
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.