12.07.2015 Views

Advanced Monitoring with API - MUM - MikroTik

Advanced Monitoring with API - MUM - MikroTik

Advanced Monitoring with API - MUM - MikroTik

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OSPF Neighbor Check #get the interface status based on interface name!$ospfattrs{'=.proplist'} = 'interface,state,adjacency';!my(%results) = Mtik::get_by_name!! !('/routing/ospf/neighbor/getall', !! ! 'interface', $intname, \%ospfattrs);!if (%results) {!# IF the result is non empty, then check the state!!$state = $results{$intname}{'state'};!!$adjacency = $results{$intname}{‘adjacency’};!!if ($state ne "Full”) {!! !$errmsg = "OSPF for $intname status is $state";!! !$status = "WARNING";!!} else {!! !$status = "OK";!!}!} else {!# IF the result is empty, then it might be not there!!$errmsg = "OSPF for $intname status not connected";!!$status = "CRITICAL";!} ! !!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!