Page 1 of 1

Checking 2 OSPF neighbors to confirm host is up

Posted: Fri May 09, 2014 12:32 am
by mgraygray
Hi,

We have 2 core routers in our DC going to a single router at a campus. At the moment, I've set up SNMP polling on the core router to check the ospf neighbor table for a IP address to confirm the link is up. Given that some of the campuses come off the other router via a different link, half the hosts appear offline.

Is it possible for a service to check 2 ospf neighbors to confirm one or the other is up?

Sorry for my english.

Thanks

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Fri May 09, 2014 12:29 pm
by tmcdonald
I would write a simple script that runs the plugin twice - once for each router - and then applies some logic to determine if Nagios should receive an alert. Basically an exit status of 0 is OK, 1 is Warning, and 2 is Critical. Then just create a single service in Nagios that runs this new script as a command.

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Mon May 12, 2014 7:28 pm
by mgraygray
Great, thanks! Good suggestion, didn't think of that.

Time to brush up on my poor scripting (non-existant) skills -- I'm sure I can find something on the net which will help.

Thanks again! Appreciate it.

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Tue May 13, 2014 12:38 pm
by tmcdonald
If you need any help along the way with your script we'd be more than happy to help. I'll keep this thread open for a week or so in case you need anything.

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Tue May 13, 2014 11:13 pm
by mgraygray
tmcdonald wrote:If you need any help along the way with your script we'd be more than happy to help. I'll keep this thread open for a week or so in case you need anything.
That would be awesome. Like I wrote in the original post, I have it checking a single OSPF neighbour via SNMP by sending an IP address.

So I start on the right foot, you suggested creating a script which runs that check_ospf!x.x.x.x command twice, one for each different IP.

This means I'd make a script which had check_ospf!x.x.x.x and check_ospf!y.y.y.y in it, run 1 after the other expecting an OK (or 0) to return and if it sees a 0 from either plugin run, it is deemed acceptable? Is that the right track?

Cheers

Edit: to clarify my OP, it doesn't have to connect to another router as the OSPF states are maintained between both routers.

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Wed May 14, 2014 2:29 pm
by tmcdonald
mgraygray wrote: This means I'd make a script which had check_ospf!x.x.x.x and check_ospf!y.y.y.y in it, run 1 after the other expecting an OK (or 0) to return and if it sees a 0 from either plugin run, it is deemed acceptable? Is that the right track?
I'd say you're half-way there already!

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Wed May 21, 2014 11:37 pm
by mgraygray
Hrmm having no luck. I tried to adapt the code from check_sla and it's not playing the game. I think I might be over complicating something which could be done with much less code.

Do you have any ideas? It's on a off-net machine away from my desk -- can't SSH to it so I can't paste the code I tried into here but if you look at check_sla, it's essentially the component which does multiple checks then applies the a+b*y algorithm to produce a number which is OK or CRITICAL.

Thanks and sorry!

Re: Checking 2 OSPF neighbors to confirm host is up

Posted: Thu May 22, 2014 4:33 pm
by tmcdonald
I'd rather look at what you specifically have coded. Programming is a game of subtleties after all. Post the plugin when you can.