Integrate JIRA with Nagios

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Integrate JIRA with Nagios

Postby scottwilkerson » Tue Aug 07, 2018 11:11 am

Lets install with cpan

Code: Select all
cpan -i JIRA::REST
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12594
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Integrate JIRA with Nagios

Postby rituraj966323 » Thu Aug 09, 2018 1:45 am

Hi Team,

Please provide an update on above request.

Regards,
Rituraj
rituraj966323
 
Posts: 23
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Postby scottwilkerson » Thu Aug 09, 2018 8:42 am

Did you install with the command given?

scottwilkerson wrote:Lets install with cpan

Code: Select all
cpan -i JIRA::REST


Do you still have the same error?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12594
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Integrate JIRA with Nagios

Postby rituraj966323 » Mon Aug 13, 2018 4:16 am

Hi Team,

Jira-Perl module has been fixed by using above mentioned command.

cpan -i JIRA::REST

Installing /usr/local/share/man/man3/install.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
DAGOLDEN/install-0.01.tar.gz
/usr/bin/make install -- OK
JIRA::REST is up to date (0.019).

But getting below error post running adhoc command

[root@nagios-core /]# /usr/local/nagios/libexec/NagiosIssue2JSD.pl -s "$SERVICESTATE$" -t "$SERVICESTATETYPE$" -A "$SERVICEATTEMPT$" -H "$HOSTNAME$" -S "$SERVICEDESC$" -a "$SERVICEOUTPUT$" -d "$SHORTDATETIME$"
Value "$" invalid for option A (number expected)
USAGE:/usr/local/nagios/libexec/jira_eventhandler.pl -s -t -A -H -S

Kindly confirm if we need to add /usr/local/nagios/libexec/jira_eventhandler.pl configuration file please.

Regards,
Rituraj
rituraj966323
 
Posts: 23
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Postby mcapra » Mon Aug 13, 2018 6:50 am

I would recommend reviewing the documentation on macros:
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/macros.html

Those macros ($SERVICESTATE$, $HOSTNAME$, etc) require an internal Nagios state in order to resolve to anything.

You can still use them in command executions, but it needs to be done in your Nagios command definitions.

If you're simply trying to test this from the command line, you should put in dummy values rather than trying to use the macros.
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3462
Joined: Thu May 05, 2016 3:54 pm

Re: Integrate JIRA with Nagios

Postby scottwilkerson » Mon Aug 13, 2018 7:14 am

@mcapra is correct, when testing from the command like you would need to fill with values that are not the Macros
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12594
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Integrate JIRA with Nagios

Postby rituraj966323 » Fri Sep 21, 2018 5:10 am

Hi Team,

After some modiification in codebase and post resolving some OS and jIra level dependencies ,I am able to generate a jira ticket from Nagios core.Thanks much for your support.
rituraj966323
 
Posts: 23
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Postby rituraj966323 » Fri Sep 21, 2018 5:19 am

But have little concerns about the $HOSTADDRESS$ parameters and notificationrecipients parameters --> Output unable to get from address directive in $HOSTADDRESS.Please check Description screenshot which i have attached earlier.
Please find the codebase below .

#!/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 => '***************88',
username => '**********',
password => '****************'
#password => '*********'
});

#my $baseurl = $jira->GET('/rest/servicedeskapi/info');
##print Dumper($baseurl);

use vars qw( $state $type $attempt $hostname $servicedesc $serviceoutput $datetime $hostaddress $notificationrecipients );
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,
'hostaddress|h=s' => \$hostaddress,
'notification|n=s' => \$notificationrecipients,
);


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" or $state eq "WARNING" ) {
# not doing anything till its reaaaally a problem
exit 0; #ok
}

my $issue = $jira->POST('/issue', undef, {
fields => {
project => { key => '*****' },
issuetype => { name => '*******' },
summary => "[24]7-NAGIOS] Hostname:$hostname Service:$servicedesc State:$state ",
description => "Hostname:$hostname\n IP:$hostaddress\n Service:$servicedesc\n State:$state\n Info:$serviceoutput\n Contact:$notificationrecipients\n DateTime:$datetime\n"
},
});

exit 0;
rituraj966323
 
Posts: 23
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Postby scottwilkerson » Fri Sep 21, 2018 8:16 am

Can you share the command you are using and how you have it integrated in nagios?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12594
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Integrate JIRA with Nagios

Postby rituraj966323 » Sun Sep 23, 2018 4:36 am

Please find the request details below and confirm if any concerns

define command{
command_name jira
command_line $USER1$/NagiosIssue2JSD.pl -s "$SERVICESTATE$" -t "$SERVICESTATETYPE$" -A "$SERVICEATTEMPT$" -H "$HOSTNAME$" -S "$SERVICEDESC$" -a "$SERVICEOUTPUT$" -d "$SHORTDATETIME$"
}

Regards,
rituraj
rituraj966323
 
Posts: 23
Joined: Tue Jul 17, 2018 9:40 am

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: Exabot [Bot], luczynski@mac.com and 21 guests