FastPing and SNMP working together

Alexey Mikhailov alexey.mikhailov at gmail.com
Sat Sep 24 16:08:18 CEST 2016


Hello!

I am working on some kind of monitoring system. It has 2 types
of tests: SNMP (using AnyEvent::SNMP) and Ping (using AnyEvent::Fastping).
Core of the script uses Proclet (https://github.com/kazeburo/Proclet) to
get tests running in forked processes e.g.:

==========================================
$proclet->service(
    tag => 'SNMP',
    code => sub {
        setproctitle("SNMP tests");
        My::Tests::SNMP::startup();
    }
);

$proclet->service(
    tag => 'ping',
    code => sub {
        setproctitle("SMUS: ping tests");
        My::Tests::Ping::startup();
    }
);

$proclet->run;

==========================================

SNMP module is used like this:

==========================================
use AnyEvent::SNMP;
use EV;
use Net::SNMP;

.....

 my ($session, $error) = Net::SNMP->session(%snmpconf);
 next if $error;


my $result = $session->get_request
          (-varbindlist => [$conf{oid}],
           -callback => ....

============================================

Ping module is used like this:

============================================

my $pinger = new AnyEvent::FastPing;
$pinger -> max_rtt($max_rtt);

my $cv = AnyEvent->condvar;

my $addr_count = keys %tests;

foreach my $addr (keys %tests) {
       $pinger->add_hosts([($addr) x $c],$h_interval);
}

$pinger->on_idle( sub {
         $cv->end;
         $pinger->stop;
         undef $pinger;
});

$pinger->on_recv( sub {
          ...
              }
 );

$pinger->start;
$cv->wait;
undef $cv;

============================================

The problem is that I run Ping (or SNMP) test alone, it works
perfectly and never locks/halts.
But if I run it together, it works fine for some (random) amount of
time and then Ping stops to
work as on_idle() callback never gets called and I get stuck at $cv->wait

Any idea what can be causing this and how can I debug the issue?

Any help will be greatly appreciated.

- Alexey



More information about the anyevent mailing list