Integrate JIRA with Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rituraj966323
Posts: 24
Joined: Tue Jul 17, 2018 9:40 am

Integrate JIRA with Nagios

Post by rituraj966323 »

Hi Team

I have followed below docs but getting below error.

http://albertolarripa.com/2012/11/17/in ... with-jira/

[root@nagios-core /]# /usr/bin/php -q /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php
PHP Fatal error: Script was called, but there were no Nagios environment variables present. Script was most likely not called from Nagios. Aborting. in /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php on line 500
[root@nagios-core /]#

Request you to help me to resolve this error please.

Regards,
Rituraj
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Integrate JIRA with Nagios

Post by mcapra »

You posted this in the Nagios Log Server forum, but this appears to be a Nagios Core related question.

Simply put:
rituraj966323 wrote:Script was most likely not called from Nagios.
I don't see anywhere in that documentation where it instructs you to run the script by hand from the CLI.

If this is not working when Nagios Core executes it, I would suggest leveraging the enable_environment_macros option in your main nagios.cfg. I don't see this step mentioned in the documentation, but I think it might be critical based on my brief reading of the script.
Former Nagios employee
https://www.mcapra.com/
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Integrate JIRA with Nagios

Post by scottwilkerson »

Also, I am moving this the the Core forum as it is not a Log Server Question
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rituraj966323
Posts: 24
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Post by rituraj966323 »

Hi Team,

I have enabled to enable_environment_macros- 1 as per below guidance but still getting same error.
https://support.nagios.com/forum/viewto ... =6&t=42341
I have followed below command because it is defined in the command.cfg

define command {
command_name nagios-to-jira
command_line /usr/bin/php -q $USER1$/to-jira/NTJ/nagios_to_jira.php
}
[root@nagios-core etc]# /usr/bin/php -q /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php
PHP Fatal error: Script was called, but there were no Nagios environment variables present. Script was most likely not called from Nagios. Aborting. in /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php on line 500
[root@nagios-core etc]#

need your guidance to complete this.Thank you.

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

Re: Integrate JIRA with Nagios

Post by rituraj966323 »

Hi Team,

I have enabled to 1 but still same error

[root@nagios-core etc]# cat nagios.cfg | grep -i enable_environment_macros
enable_environment_macros=1
[root@nagios-core etc]#

I have followed below cli command as it is mention in command.cfg file

define command {
command_name nagios-to-jira
command_line /usr/bin/php -q $USER1$/to-jira/NTJ/nagios_to_jira.php
}

[root@nagios-core etc]# /usr/bin/php -q /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php
PHP Fatal error: Script was called, but there were no Nagios environment variables present. Script was most likely not called from Nagios. Aborting. in /usr/local/nagios/libexec/to-jira/NTJ/nagios_to_jira.php on line 500
[root@nagios-core etc]#

Please provide ur suggestion to resolve this error
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Integrate JIRA with Nagios

Post by scottwilkerson »

rituraj966323 wrote: I have enabled to 1 but still same error

[root@nagios-core etc]# cat nagios.cfg | grep -i enable_environment_macros
enable_environment_macros=1
[root@nagios-core etc]#

I have followed below cli command as it is mention in command.cfg file

define command {
command_name nagios-to-jira
command_line /usr/bin/php -q $USER1$/to-jira/NTJ/nagios_to_jira.php
}
This is good, but per the error message, it is expecting to be run from Nagios

Code: Select all

Script was most likely not called from Nagios. Aborting.
this script may not work just running from the command line
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rituraj966323
Posts: 24
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Post by rituraj966323 »

Hi Team,

It might be script may not work.
Please confirm if any alternatives so that we can generate Jira ticket from Nagios Automatically.

Regards,
Rituraj
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Integrate JIRA with Nagios

Post by scottwilkerson »

We have documentation for a way to do it in Nagios XI but for Core, the only thing I found on the Nagios Exchange was this
https://exchange.nagios.org/directory/A ... or/details
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
rituraj966323
Posts: 24
Joined: Tue Jul 17, 2018 9:40 am

Re: Integrate JIRA with Nagios

Post by rituraj966323 »

Thank you Team,

I have followed the above docs and configured all the dependenices but getting below error.

[root@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]# /usr/local/nagios/libexec/NagiosIssue2JSD.pl -s "$SERVICESTATE$" -t "$SERVICESTATETYPE$" -A "$SERVICEATTEMPT$" -H "$HOSTNAME$" -S "$SERVICEDESC$" -a "$SERVICEOUTPUT$" -d "$SHORTDATETIME$"
Can't locate JIRA/REST.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/NagiosIssue2JSD.pl line 5.
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/NagiosIssue2JSD.pl line 5.

Hence to install JIRA-REST I have followed below docs but no go.
https://www.activestate.com/activeperl/ ... 1533633216#
[nagios@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]$ PATH=$PATH:/home/nagios/bin
[nagios@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]$ mkdir /home/nagios/bin
[nagios@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]$ ln -s /home/nagios/ActivePerl-5.26/bin/perl /home/nagios/bin/perl
[nagios@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]$ ln -s /home/nagios/ActivePerl-5.26/bin/ppm /home/nagios/bin/ppm
[nagios@nagios-core ActivePerl-5.26.1.2601-x86_64-linux-glibc-2.15-404865]$ perl -e 'print "Hello World!\n"'
Hello World!
[nagios@nagios-core ~]$ ppm install JIRA-REST
ppm install failed: Can't find any package that provides JIRA-REST
[nagios@nagios-core ~]$

Request you to help me to fix this issue.

Thanking in Anticipation

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

Re: Integrate JIRA with Nagios

Post by rituraj966323 »

Below docs I have followed to install JIRA-PERL but no go

https://code.activestate.com/ppm/JIRA-REST/

Regards,
Rituraj
Locked