The fixed time basis is variable (set with a switch). It defaults to 1 minute for checking modems and 5 minutes for refreshing the IP cache.
It sounds like running the snmp queries sequentially is the way to go. If I am passing a hash reference to the forked subs, wouldn't that allow all of them to access the data in 'real time'?
IE the snmp polling child is halfway through, so half the values are updated and half are stale, but the analysis/plotting child would still access that hash without waiting for the first child to finish. Would perl complain that the resource was being used by to processes?
Secondly,
I'm starting to convert code over (I have all of the polling stuff written for another project, but I guess I'm not understading how to pass/use references in a sub.
I have this sub:
sub loadIPs {
my $datahashref = shift;
my $parmhashref = shift;
my $IPs = '1.3.6.1.2.1.10.127.1.3.3.1.3';
my ($session, $error) = Net::SNMP->session($parmhashref);
my $reply = $session->get_table(-baseoid=> $IPs);
my %reply = %$reply;
while ( my ($oid, $ip) = each(%reply) ) {
my %tmpHash = (rx=>NULL, tx=>NULL);
%$datahashref{$ip} = %tmpHash unless exists $datahashref{$ip};
}
}
Basically the master hash is a hash of hashes. This sub gets a list of IPs and updates the master list with a blank entry.
However, it doesn't like how I'm referencing %$datahashref