Page 2 of 3
Re: How to send alerts as tickets to BMC Remedy
Posted: Thu Oct 06, 2016 1:29 pm
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!
Re: How to send alerts as tickets to BMC Remedy
Posted: Thu Oct 06, 2016 2:45 pm
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.
Re: How to send alerts as tickets to BMC Remedy
Posted: Thu Oct 06, 2016 3:03 pm
by caterpillartce
yes it is set to Misc command ...
Re: How to send alerts as tickets to BMC Remedy
Posted: Thu Oct 06, 2016 3:19 pm
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?
Re: How to send alerts as tickets to BMC Remedy
Posted: Thu Oct 06, 2016 6:12 pm
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.
Re: How to send alerts as tickets to BMC Remedy
Posted: Fri Oct 07, 2016 10:08 am
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!
Re: How to send alerts as tickets to BMC Remedy
Posted: Fri Oct 07, 2016 3:06 pm
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!
Re: How to send alerts as tickets to BMC Remedy
Posted: Fri Oct 07, 2016 3:15 pm
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!
Re: How to send alerts as tickets to BMC Remedy
Posted: Fri Oct 07, 2016 5:35 pm
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.
Re: How to send alerts as tickets to BMC Remedy
Posted: Mon Oct 10, 2016 9:26 am
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