Checking 2 OSPF neighbors to confirm host is up

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
mgraygray
Posts: 4
Joined: Fri May 09, 2014 12:17 am

Checking 2 OSPF neighbors to confirm host is up

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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.
Former Nagios employee
mgraygray
Posts: 4
Joined: Fri May 09, 2014 12:17 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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.
Former Nagios employee
mgraygray
Posts: 4
Joined: Fri May 09, 2014 12:17 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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!
Former Nagios employee
mgraygray
Posts: 4
Joined: Fri May 09, 2014 12:17 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Checking 2 OSPF neighbors to confirm host is up

Post 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.
Former Nagios employee
Locked