Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Nagios-2JiraServerDesk-Issue-Creator
0.02
2017-03-02
- Nagios 4.x
- Nagios XI
https://twitter.com/sanjya7
MIT
8780
File | Description |
---|---|
NagiosIssue2JSD.pl | A perl script to create Jira JSD ticket for every Nagios incident. The script would run as Nagios global event handler and trigger Jira JSD issue by logging into JSD and adding Jira fields project, Type, Asignee, Reporter, Summary, Description. It would manipulate following Nagios fields: Assignee, State, Type, Attempt, Hostname, Service Description |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Nagios to Jira JSD Issue Creator:
NagiosIssue2JSD.pl is a perl script to create Jira JSD ticket for every Nagios incident. The script would run as Nagios global event handler and trigger Jira JSD issue by logging into JSD and adding Jira fields project, Type, Asignee, Reporter, Summary, Description. It would manipulate following Nagios fields: Assignee, State, Type, Attempt, Hostname, Service Description.
NagiosIssue2JSD.pl is a perl script to create Jira JSD ticket for every Nagios incident. The script would run as Nagios global event handler and trigger Jira JSD issue by logging into JSD and adding Jira fields project, Type, Asignee, Reporter, Summary, Description. It would manipulate following Nagios fields: Assignee, State, Type, Attempt, Hostname, Service Description.
Reviews (1)
byamarildosertorio, July 25, 2018
# grep NagiosIssue2JSD -A1 -B1 /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name NagiosIssue2JSD
command_line $USER1$/NagiosIssue2JSD.pl -s "$SERVICESTATE$" -t "$SERVICESTATETYPE$" -A "$SERVICEATTEMPT$" -H "$HOSTNAME$" -S "$SERVICEDESC$" -a "$SERVICEOUTPUT$" -d "$SHORTDATETIME$"
}
# cat /usr/local/nagios/libexec/NagiosIssue2JSD.pl
#!/bin/perl
use strict;
use warnings;
use JIRA::REST;
use Data::Dumper;
use Getopt::Std;
use Getopt::Long qw(:config no_ignore_case bundling);
my $jira = JIRA::REST->new({
url => 'https://jira.localhost',
username => 'nagios',
password => '******'
});
#my $baseurl = $jira->GET('/rest/servicedeskapi/info');
#print Dumper($baseurl);
use vars qw( $state $type $attempt $hostname $servicedesc $serviceoutput $datetime );
GetOptions(
'help|h' => \&print_usage,
'state|s=s' => \$state,
'type|t=s' => \$type,
'attempt|A=i' => \$attempt,
'hostname|H=s' => \$hostname,
'servicedesc|S=s' => \$servicedesc,
'serviceoutput|a=s' => \$serviceoutput,
'datetime|d=s' => \$datetime,
);
if(!$state or !$type or !$attempt or !$hostname or !$servicedesc) {
print "\tUSAGE:/usr/local/nagios/libexec/jira_eventhandler.pl -s -t -A -H -S \n";
exit 3; #unknown
}
if($type ne "HARD" or $state eq "OK") {
# not doing anything till its reaaaally a problem
exit 0; #ok
}
my $issue = $jira->POST('/issue', undef, {
fields => {
project => { key => 'CAT' },
issuetype => { name => 'Incident' },
summary => "[NAGIOS] Hostname:$hostname Service:$servicedesc State:$state",
description => "Hostname:$hostname\n Service:$servicedesc\n State:$state\n Info:$serviceoutput\n DateTime:$datetime\n"
},
});
exit 0;
define command{
command_name NagiosIssue2JSD
command_line $USER1$/NagiosIssue2JSD.pl -s "$SERVICESTATE$" -t "$SERVICESTATETYPE$" -A "$SERVICEATTEMPT$" -H "$HOSTNAME$" -S "$SERVICEDESC$" -a "$SERVICEOUTPUT$" -d "$SHORTDATETIME$"
}
# cat /usr/local/nagios/libexec/NagiosIssue2JSD.pl
#!/bin/perl
use strict;
use warnings;
use JIRA::REST;
use Data::Dumper;
use Getopt::Std;
use Getopt::Long qw(:config no_ignore_case bundling);
my $jira = JIRA::REST->new({
url => 'https://jira.localhost',
username => 'nagios',
password => '******'
});
#my $baseurl = $jira->GET('/rest/servicedeskapi/info');
#print Dumper($baseurl);
use vars qw( $state $type $attempt $hostname $servicedesc $serviceoutput $datetime );
GetOptions(
'help|h' => \&print_usage,
'state|s=s' => \$state,
'type|t=s' => \$type,
'attempt|A=i' => \$attempt,
'hostname|H=s' => \$hostname,
'servicedesc|S=s' => \$servicedesc,
'serviceoutput|a=s' => \$serviceoutput,
'datetime|d=s' => \$datetime,
);
if(!$state or !$type or !$attempt or !$hostname or !$servicedesc) {
print "\tUSAGE:/usr/local/nagios/libexec/jira_eventhandler.pl -s -t -A -H -S \n";
exit 3; #unknown
}
if($type ne "HARD" or $state eq "OK") {
# not doing anything till its reaaaally a problem
exit 0; #ok
}
my $issue = $jira->POST('/issue', undef, {
fields => {
project => { key => 'CAT' },
issuetype => { name => 'Incident' },
summary => "[NAGIOS] Hostname:$hostname Service:$servicedesc State:$state",
description => "Hostname:$hostname\n Service:$servicedesc\n State:$state\n Info:$serviceoutput\n DateTime:$datetime\n"
},
});
exit 0;