bth_khan
Joined: 25 Feb 2007 Posts: 1
|
Posted: Sun Feb 25, 2007 7:58 pm Post subject: SNMP Agent development |
|
|
Hi Every One,
i want to develop an emulator for an SNMP agent.which will act as an SNMP agent.
This Agent will start and register itself to service then it will respond to SNMP messages.
Actually i have seen a lot of codes about to implement managers but my task is to implement responses.
i have the ability to get SNMP command and Can respond them.
For that i am using PERL NetSNMP::Agent API.. i am doing all the work on Windows.. The problem is this when i run
following code this program does not give any error but this program does not work.. Means when the manager query to this
code this code does not do any thing...
if any one know about it please respond to it... i shall be very thankful to him
following is the code:
use NetSNMP::OID (':all');
use NetSNMP::agent(':all');
use NetSNMP::ASN(':all');
my $regOID = new NetSNMP::OID(".1.3.6.1.2.1");
my $agent = new NetSNMP::agent( 'Name' => "test_agent", 'AgentX' => 1 );
$agent->register("test_agent", $regOID, \&mysql_snmp_handler);
while(1)
{
$agent->agent_check_and_process(1);
}
$agent->shutdown();
sub mysql_snmp_handler {
my ($handler, $registration_info, $request_info, $requests) = @_;
my ($request);
for($request = $requests; $request; $request = $request->next()) {
print "INSIDE Main Loop\n";
my $val = $request_info->getMode();
}
}
Thanks
salman
|
|