Page 1 of 4

Integrate JIRA with Nagios

Posted: Mon Jul 30, 2018 7:50 am
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

Re: Integrate JIRA with Nagios

Posted: Mon Jul 30, 2018 8:11 am
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.

Re: Integrate JIRA with Nagios

Posted: Mon Jul 30, 2018 3:46 pm
by scottwilkerson
Also, I am moving this the the Core forum as it is not a Log Server Question

Re: Integrate JIRA with Nagios

Posted: Tue Jul 31, 2018 4:06 am
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

Re: Integrate JIRA with Nagios

Posted: Tue Jul 31, 2018 5:17 am
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

Re: Integrate JIRA with Nagios

Posted: Tue Jul 31, 2018 8:13 am
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

Re: Integrate JIRA with Nagios

Posted: Thu Aug 02, 2018 5:47 am
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

Re: Integrate JIRA with Nagios

Posted: Thu Aug 02, 2018 7:45 am
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

Re: Integrate JIRA with Nagios

Posted: Tue Aug 07, 2018 10:19 am
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

Re: Integrate JIRA with Nagios

Posted: Tue Aug 07, 2018 10:32 am
by rituraj966323
Below docs I have followed to install JIRA-PERL but no go

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

Regards,
Rituraj