How to send alerts as tickets to BMC Remedy

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
caterpillartce
Posts: 117
Joined: Mon Jul 11, 2016 11:22 am

Re: How to send alerts as tickets to BMC Remedy

Post by caterpillartce »

I PM'ed you with the profile and name of the command, template, service...

Please let me know what else you need.

Thanks!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How to send alerts as tickets to BMC Remedy

Post by lmiltchev »

Thanks for the configs! I didn't see anything wrong with them. I set up a similar event handler, which seemed to work for me.

command

Code: Select all

define command {
       command_name                  		event_handler_ticket
       command_line                  		$USER1$/event-handler-test.sh
}
service template

Code: Select all

define service {
       name                          		send_alert_as_ticket
       service_description           		use this template to send alerts as tickets
       event_handler                 		event_handler_ticket
       event_handler_enabled         		1
       register                    		0
}
service

Code: Select all

define service {
	host_name			localhost
	service_description		EvenHandlerTest
	use				send_alert_as_ticket
	check_command			check_linux_stats.pl!-C -w 90 -c 95 -s 5!!!!!!!
	max_check_attempts		5
	check_interval			5
	retry_interval			1
	check_period			24x7
	event_handler			event_handler_ticket
	notifications_enabled		1
	contacts			nagiosadmin	
	register			1
	}
event-handler-test.sh

Code: Select all

#!/bin/bash

DATE=$(date)
echo "The service has changed state at $DATE" >> /tmp/serviceinfo.txt
I submitted a few passive checks to the "EvenHandlerTest" service to change its state, and checked the "/tmp/serviceinfo.txt" file.

Code: Select all

[root@main-nagios-xi tmp]# cat /tmp/serviceinfo.txt
The service has changed state at Thu Oct  6 14:29:11 CDT 2016
The service has changed state at Thu Oct  6 14:29:45 CDT 2016
The service has changed state at Thu Oct  6 14:30:16 CDT 2016
Can you verify that your command is set as "misc command" (CCM->Commands-><your event handler command>)? If it is set as a "check command", the event handler won't work.
Be sure to check out our Knowledgebase for helpful articles and solutions!
caterpillartce
Posts: 117
Joined: Mon Jul 11, 2016 11:22 am

Re: How to send alerts as tickets to BMC Remedy

Post by caterpillartce »

yes it is set to Misc command ...
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How to send alerts as tickets to BMC Remedy

Post by rkennedy »

As @lmiltchev compared your configs, I think the issue may lie in the plugin at this point.

Let's test it from the CLI of Nagios -

Code: Select all

su - nagios
/usr/local/nagios/libexec/yourplugin.pl <pass your parameters as well>
Adjust the second line as needed, but essentially this will let us emulate how Nagios would run it. Are you able to get a ticket submitted this way?
Former Nagios Employee
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: How to send alerts as tickets to BMC Remedy

Post by gormank »

Can the OP share the send_to_bmc.pl script? I've been asked about doing the same think on the next Nagios system we build.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How to send alerts as tickets to BMC Remedy

Post by lmiltchev »

@caterpillartce Let us know if opening a new support ticket in our email ticketing system is an option for you. If it is, email us the "send_to_bmc.pl" script to [email protected]. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
caterpillartce
Posts: 117
Joined: Mon Jul 11, 2016 11:22 am

Re: How to send alerts as tickets to BMC Remedy

Post by caterpillartce »

I tried to run the script on Nagios server and got this error:

-bash: /usr/local/nagios/libexec/send_to_bmc.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

In fact the first line of the script, which is also the only place referencing "/usr/bin/perl" looks like being commented out:

#!/usr/bin/perl

but when trying to run it, it is not interpreted as a comment??

I think that is the issue. That the perl script isn't being interpreted as perl script...

I am no programmer and only have very limited knowledge about Linux. Hope this is just a simple issue (environment variables? is there such thing on Linux?), but if I need to open a ticket, I will. Please let me know. Thanks!
caterpillartce
Posts: 117
Joined: Mon Jul 11, 2016 11:22 am

Re: How to send alerts as tickets to BMC Remedy

Post by caterpillartce »

I think I may know why - on the Ngaios server, there is no perl directory under /user/bin...

Is perl supposed to be included in Nagios installation?

Thanks!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: How to send alerts as tickets to BMC Remedy

Post by gormank »

That error means you have DOS/Windows CFLFs in the file. dos2unix will fix it, or google how to remove them w/ sed or vi.
Use which perl to see if the perl binary exists.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: How to send alerts as tickets to BMC Remedy

Post by rkennedy »

caterpillartce wrote:I think I may know why - on the Ngaios server, there is no perl directory under /user/bin...

Is perl supposed to be included in Nagios installation?

Thanks!
@gormank is correct.
gormank wrote:That error means you have DOS/Windows CFLFs in the file. dos2unix will fix it, or google how to remove them w/ sed or vi.
Use which perl to see if the perl binary exists.
You may need to update the script to your path for where perl is installed. /usr/bin/perl is what is default on my machine.

Code: Select all

[root@localhost libexec]# which perl
/usr/bin/perl
Former Nagios Employee
Locked