Nagios Exchange
  • Home
  • Directory
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up

Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now

Plugins4379Themes and Skins11Addons732Documentation283Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Network Connections, Stats and Bandwidth FreeBSD network bandwidth
RSS Feed
Newest Listings Updated Listings
Top Contributors
Julien DESMAREST (4)Davide Lemma (4)deskwork_itunes142 (4)Joerg Hoerter (3)TcoUpLoad (1) See More
Newest Contributors
Community Member (51)Davide Lemma (4)Alarig Le Lay (1)Penn Rabb (1)Sean Falzon (1) See More
Home > Daniel Lundh
DL

Daniel Lundh

@dlundh

User Stats

Favorites0

Views

Projects0

No Projects Found
Notification for Microsoft Teams

Small changes make it work for me

No more empty Teams postings, and UTF-8 support: #!/usr/bin/perl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. use warnings; use strict; use Getopt::Long; use HTTP::Request::Common qw(POST); use HTTP::Status qw(is_client_error); use LWP::UserAgent; use JSON; use Encode; my %opt_fields; my %event; my %nagios; my @sections; my @actions; my @targets; my $webhook = "https://outlook.office365.com/webhook/MISSING"; my $nagios_url = ""; my %color = ( 'OK' => '008000', 'WARNING' => 'ffff00', 'UNKNOWN' => '808080','CRITICAL' => 'ff0000', 'UP' => '008000', 'DOWN' => 'ff0000', 'UNREACHABLE' => 'ff8700'); $event{'title'} = "Nagios Notification"; $event{'@type'} = "MessageCard"; $event{'@context'} = "https://schema.org/extensions"; $nagios{'HOSTNOTES'} = "not defined"; # # Get command-line options # GetOptions ("webhook=s" => $webhook, "nagios_url=s" => $nagios_url, "field=s%" => %opt_fields) or die("Error in command line argumentsn"); # # Read Nagios events # while ((my $k, my $v) = each %ENV) { next unless $k =~ /^(?:NAGIOS|ICINGA)_(.*)$/; $nagios{$1} = $v; print STDERR "$1 is $nagios{$1}n"; } # Merge in passed-in variables %nagios = (%nagios, %opt_fields); # # Format message card # if (not length($nagios{'SERVICESTATE'})) { # if service state env is not defnined or empty, event is host notification. $nagios{'SERVICEDESC'} = "host status"; $nagios{'SERVICESTATE'} = $nagios{'HOSTSTATE'}; $nagios{'SERVICEOUTPUT'} = $nagios{'HOSTOUTPUT'}; } $event{'themeColor'} = $color{"$nagios{'SERVICESTATE'}"}; $event{'title'} = "$nagios{'HOSTALIAS'}/$nagios{'SERVICEDESC'} is $nagios{'SERVICESTATE'}"; $event{'summary'} = $event{'title'}; my @facts = ({ 'name' => "Host:", 'value' => "$nagios{'HOSTALIAS'}" },{ 'name' => "Details:", 'value' => "$nagios{'SERVICEOUTPUT'}" }); my %section = ( 'facts' => @facts, ); push(@sections, %section); $event{'sections'} = @sections; if ($nagios_url ne '') { my %target = ( 'os' => 'default', 'uri' => "$nagios_url/cgi-bin/status.cgi?host=$nagios{'HOSTNAME'}" ); push(@targets, %target); my %link = ( '@type' => 'OpenUri', 'name' => 'View in Nagios', 'targets' => @targets ); push(@actions, %link); $event{'potentialAction'} = @actions; } my $json = encode_json %event; # # Make the request # my $ua = LWP::UserAgent->new; $ua->timeout(15); my $req = HTTP::Request->new('POST', $webhook); $req->header('Content-Type' => 'application/json;charset=utf-8'); $req->content(Encode::decode_utf8($json)); my $s = $req->as_string; print STDERR "Request:n$sn"; my $resp = $ua->request($req); $s = $resp->as_string; print STDERR "Response:n$sn";

Reviewed 6 years ago

HP Procurve SNMP monitor

Works as advertised

Works right out of the box with 2610-24 and 2510-24.

Reviewed 12 years ago

Nagios And SMS Notifications With Gammu And Siemens MC35i

Easy to follow and works

I set this up on a Raspberry Pi running Nagios from repository. Simple and straightforward.

Reviewed 12 years ago

No Favorites Found

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks