How to send alerts as tickets to BMC Remedy
-
caterpillartce
- Posts: 117
- Joined: Mon Jul 11, 2016 11:22 am
Re: How to send alerts as tickets to BMC Remedy
I PM'ed you with the profile and name of the command, template, service...
Please let me know what else you need.
Thanks!
Please let me know what else you need.
Thanks!
Re: How to send alerts as tickets to BMC Remedy
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
service template
service
event-handler-test.sh
I submitted a few passive checks to the "EvenHandlerTest" service to change its state, and checked the "/tmp/serviceinfo.txt" file.
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.
command
Code: Select all
define command {
command_name event_handler_ticket
command_line $USER1$/event-handler-test.sh
}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
}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
}Code: Select all
#!/bin/bash
DATE=$(date)
echo "The service has changed state at $DATE" >> /tmp/serviceinfo.txtCode: 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 2016Be 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
yes it is set to Misc command ...
Re: How to send alerts as tickets to BMC Remedy
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 -
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?
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>
Former Nagios Employee
Re: How to send alerts as tickets to BMC Remedy
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
@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
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!
-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
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!
Is perl supposed to be included in Nagios installation?
Thanks!
Re: How to send alerts as tickets to BMC Remedy
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.
Use which perl to see if the perl binary exists.
Re: How to send alerts as tickets to BMC Remedy
@gormank is correct.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!
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.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.
Code: Select all
[root@localhost libexec]# which perl
/usr/bin/perl
Former Nagios Employee