Ad Widget

Collapse

Growl (sending on the local network)?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KimmoJ
    Junior Member
    • Aug 2011
    • 12

    #1

    Growl (sending on the local network)?

    Hey all.

    I'd be interested in getting Zabbix to send Growl notifications straight to the admin workstation IP's (running Growl for Windows or some other Growl variant that handles network notifications). Is there some simple howto on howto get a new "Growl" Media option for Zabbix?

    I mean, how hard can it be? (famous last words...)

    Grateful for any input.
  • untergeek
    Senior Member
    Zabbix Certified Specialist
    • Jun 2009
    • 512

    #2
    Growl, don't know.

    Prowl, however (which allows growl notifications to be sent to your iOS device) does work and we use it to send notifications to our iPhones.

    I had not thought to send growl out to the computers directly as our production boxes are behind a separate firewall.

    Comment

    • KimmoJ
      Junior Member
      • Aug 2011
      • 12

      #3
      I'm monitoring a fairly small network and everything (well, most things) are on the same network or else I have control over the firewall so I can pass the packets from server to client specifically. And I already have growl going for other reasons so it seemed like a no brainer.

      Yeah, looking at Prowl too, but that won't be an option until they get an Android app out. But I believe one is in the works.

      Will probably go with a combo of Growl, email and SMS (probably even in that order, ie growl first, mail a few minutes after if nobody acks the alert first etc.)

      Comment

      • KimmoJ
        Junior Member
        • Aug 2011
        • 12

        #4
        Simple script that does the job

        I cobbled together a simple script that just accepts three command line arguments. If anyone wants to use it, feel free, and if it breaks everything and gets you fired... well, serves you right for using a script made by a guy who is a proud graduate of the "cut and paste school of programming". This script could probably be improved in so many ways it's not even funny and I'm sure Perl programmers everywhere are crying out in pain... but it works and that's enough for me.

        I borrowed big chunks of it from here: http://gothamlabs.org/?p=90

        Prerequisites are Net::Growl installed in Perl.

        Nothing esoteric about installation - just create a script (say, growl.pl) with the content below, make sure it is executable, save it in eg /home/zabbix/bin, make sure that is set as AlertScriptsPath in your zabbix_server.conf file.

        Then create a new media type and call it something (like Growl) and you're done. You'll probably want to add the media type to specific user accounts and make sure those users have statically mapped IP addresses on their machines - enter those static IP's as their "Send to" in the Growl media for their user. Then, of course, you need an action that fires on a trigger as per usual.

        Code:
        #!/usr/bin/perl
        #
        # Simple script that takes address, subject and message and passes it
        # to a growl recipient on the net. Highly minimal error checking. For use
        # with Zabbix as a notification script.
        #
        
        use strict;
        use warnings;
        use Net::Growl;
        
        if ($#ARGV != 2) {
            print "usage: growl.pl address subject message\n";
            exit;
        }
        
        # Grab the first three command line arguments to pass along
        
        my $growlto = $ARGV[0];
        my $subject = $ARGV[1];
        my $message = $ARGV[2];
        
        # Static stuff for all notifications, edit as needed. 
        
        my $application = 'Zabbix';
        my $password = 'Test';
        my $priority = '2';
        my $sticky = '1';
        
        # Set up the Socket
        my %addr = (
          PeerAddr => $growlto,
          PeerPort => Net::Growl::GROWL_UDP_PORT,
          Proto    => 'udp',
        );
        
        my $s = IO::Socket::INET->new ( %addr ) || die "Could not create socket: $!\n";
        
        # Register the application
        my $p = Net::Growl::RegistrationPacket->new(
          application => $application,
          password    => $password,
        );
        
        $p->addNotification();
        
        print $s $p->payload();
        
        # Send a notification
        $p = Net::Growl::NotificationPacket->new(
          application => $application,
          title       => $subject,
          description => $message,
          priority    => $priority,
          sticky      => $sticky,
          password    => $password,
        );
        
        print $s $p->payload();
        
        close($s);

        Comment

        Working...