Page 1 of 2

Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 4:20 pm
by linuxnag
Has anyone here attempted (or succeeded) in integrating Nagios and Netcool?

Specifically, I want Nagios to send certain events to Netcool (via SNMP)
and have Netcool ACK the event and send back to Nagios.

The real world reason I want this:

Netcool is a part of our infrastructure and there are people watching
the Netcool board 24/7 (NOC). Nagios is looking at other issues
and we wanted Nagios to send a subset of these issues
to Netcool for escalation and notification purposes.

So, I checked out this site: http://www.robinharwani.net/tag/nagios- ... tegration/

But it only documents half of the conversation: Nagios->Netcool
but not the reverse.

Any help is appreciated.

Re: Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 4:42 pm
by abrist
The link does look thin on explanation/examples. Have tried contacting the author of the post?

Re: Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 5:22 pm
by linuxnag
That post is very old. I did email the author but I am not expecting a reply. The blog itself
hasn't been updated in a few years.

-G

Re: Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 5:32 pm
by abrist
I found the following post in the old archive. He uses nsca on the netcool device to send back commands to the nagios server by way of a dummy host/service. I don't know if this will help, but it is something.

I wish the blog author from your first post got around to making part 2, but alas, even the Mona Lisa is falling apart.

EDIT forgot the link:
https://www.mail-archive.com/nagios-use ... 28699.html

Re: Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 6:02 pm
by linuxnag
If all else fails, I'll solve this the old fashioned way:
coffee and some long shifts in front of the computer.

When I start talking code in my sleep, I know I'm on the
right track.

BTW, that really does happen with me :)

So, let's leave this open and I'll update as I make
progress.

Cheers!

Re: Nagios <-> Netcool event handling

Posted: Tue Feb 04, 2014 6:03 pm
by abrist
Great, I am replying to get it off our dashboard. Be kind and don't reply until you have more actionable information :P

Re: Nagios <-> Netcool event handling

Posted: Fri Feb 28, 2014 11:19 am
by linuxnag
Well, I have made great progress on this.

There are two more issues left.
Issue 1:
I noticed that the "--serviceeventid=" parameter and the
"--servicestateid=" parameter that is passed to my script,
from nagios, look like unique numbers.

I could combine these two numbers say:

Code: Select all

$unique = sprintf "010f%010d", $serviceeventid, $servicestateid
to send netcool a unique number along with the alert.

This way when they ACK back to me
(via a DB row update which netcool would do)
I can trace the ACK back to the issue.

Does this sound like a good approach?
Does the contatenation of serviceeventid and servicestateid
guarantee uniqueness?

Issue 2:
From the command line, how would I ACK a nagios event
and possible add a comment such as:

"This event has been ACked from Netcool"

Re: Nagios <-> Netcool event handling

Posted: Fri Feb 28, 2014 1:26 pm
by sreinhardt
We will have to look into the exact command, but to ack via cli you would want to submit to the nagios.cmd pipe most likely or script a web connection to the local host. As for your values not being passed, you need to add a $ at the end as well, otherwise core will not expand them. Finally, I cannot guarantee that they will make a unique ID, however it is very very likely.

Re: Nagios <-> Netcool event handling

Posted: Fri Feb 28, 2014 3:19 pm
by linuxnag
I was only using that statement as a logic example.
I get the variables just fine.

Well, I was using this code (from bash) and I definitely got
a unique ID but I did not want to go overboard. Looks like
I was doing the right thing after all.

Code: Select all

#
# Create a unique ID
printf -v UNUMBER "%010d%010d%010d" $N_serviceeventid $N_serviceproblemid $(date "+%N")
printf -v LOGLINE "[Service -- %s %16s] HostStatus: %5s-[%d], nSvcStateID: %2d" ${UNUMBER} ${N_host_IP} ${N_hoststate} ${N_hoststate_n} ${N_servicestateid}
echo -e "${LOGLINE}" >>${CMDLOG}

Will give me:

[Service -- 000001376200000000000301840336     10.248.7.180] HostStatus:    UP-[0], nSvcStateID:  0
And I can pass that number to netcool. This part works like a charm.

Ok, issue 1 is solved then.

Next, is the issue where I want to Acknowledge the event from the command line.
I assume that I have to give Nagios the serviceeventid and/or the serviceproblemid
that corresponds to this alert somehow.

This is that part that I'm missing.

Re: Nagios <-> Netcool event handling

Posted: Mon Mar 03, 2014 11:06 am
by linuxnag
One more thing: How do I add a comment (from the command line) to a specific alert?

Thanks in advance on this and previous post as it is rather critical.

GKH