Re: trapsink2 - example\notification.c

2010-09-10 Thread Dave Shield
On 9 September 2010 15:30, Leo Lin  wrote:
>  I also started the trap listener, snmptrapd

How?

> the snmpd.log shows that the trap is being sent, but some how I don't see it 
> in the stdout.

What's the configuration of snmptrapd?
Is it authorized to accept traps with the community "secret"


Dave

--
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: trapsink2 - example\notification.c

2010-09-10 Thread Leo Lin
Hi Dave,
 
I started snmptrapd witht this command;
 
$/usr/local/sbin/snmptrapd -Lo
 
snmptrapd.conf has this
 
authCommunity log secret
 
Also, I check the snmpd.log and it seems that the trap is issued once only, and 
it doesn't repeat every 30 sec.  I'm suspecting that this is because I didn't 
provide the handlers for heartbeatRate, and heartbeatName oids.  I'm writting 
the handlers, and will re-compile to check.
 
Leo;

--- On Fri, 9/10/10, Dave Shield  wrote:


From: Dave Shield 
Subject: Re: trapsink2 - example\notification.c
To: "Leo Lin" 
Cc: "Net-snmp-users" 
Date: Friday, September 10, 2010, 2:50 AM


On 9 September 2010 15:30, Leo Lin  wrote:
>  I also started the trap listener, snmptrapd

How?

> the snmpd.log shows that the trap is being sent, but some how I don't see it 
> in the stdout.

What's the configuration of snmptrapd?
Is it authorized to accept traps with the community "secret"


Dave



  --
Automate Storage Tiering Simply
Optimize IT performance and efficiency through flexible, powerful, 
automated storage tiering capabilities. View this brief to learn how
you can reduce costs and improve performance. 
http://p.sf.net/sfu/dell-sfdev2dev___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


RE: Fails:: SNMPGetNext and GetBulk has the IP Address Index reversed in the request.

2010-09-10 Thread anup.shankar
Hi Dave,

I made the host to network order suggestion, and now it works for Get, GetNext 
and BulkGet calls.

However iam facing a issues with Getnext/Bulk/Snmpwalk get calls going to the 
next table, the bulk/walk requests are NOT going to next table, it traverses to 
the beginning of the same table row.

Attached is the file. I really appreciate any help in this regard as this is a 
blocking issue.

Thanks,
Anup


-Original Message-
From: dave.shi...@googlemail.com [mailto:dave.shi...@googlemail.com] On Behalf 
Of Dave Shield
Sent: Friday, August 27, 2010 11:10 AM
To: Shankar, Anup
Cc: net-snmp-users@lists.sourceforge.net
Subject: Re: Fails:: SNMPGetNext and GetBulk has the IP Address Index reversed 
in the request.

On 26 August 2010 12:10,   wrote:
> Any one else in the group, have faced this issue. it's extremely
> high priority to get this issue resolved.
>
> Any help in this is highly appreciated.

If you want a quick-n-dirty hack to get things working,
you could always tweak the vplexDirectorFETable_entry
(and similar) structure to include *two* fields for the
IP address - one held in host order and one in network
order.
   Then use one for the index processing (in the get_first
and get_next routines), and the other in the handler
itself (for the column object).

Dave

/*
* Note: this file originally auto-generated by mib2c using
*  : mib2c.iterate.conf 17695 2009-07-21 12:22:18Z dts12 $
*/

#include 
#include 
#include 
#include "Vplexstats.h"
#include "StatsManager.h"
#include "Configurator.h"
#include "OID.h"
#include "Logger.h"
#include "Globals.h"

USING_VPLEX_NAMESPACE

struct vplexDirectorTable_entry;
struct vplexDirectorTable_entry * vplexDirectorTable_createEntry( in_addr_t  
vplexDirectorPrimaryIpAddr);
struct vplexDirectorCacheTable_entry * vplexDirectorCacheTable_createEntry( 
in_addr_t  vplexDirectorPrimaryIpAddr); 

static int agent_shutdown(int majorID, int minorID, void *serverarg, void 
*clientarg);


/** Initializes the vplexStats module */

void
init_vplexStats(void)
{
try 
{

/* here we initialize all the tables we're planning on supporting */
initialize_table_vplexDirectorTable();
initialize_table_vplexDirectorMemTable();

VPLEX_CHANGE_BEGIN

snmp_register_callback(SNMP_CALLBACK_LIBRARY, 
SNMP_CALLBACK_SHUTDOWN,agent_shutdown, NULL); 
VPLEX_CHANGE_END
}
catch(std::exception& e)
{
LOG(LOG_ERR,"Exception :: %s\n",e.what());
exit(0);
}

}

VPLEX_CHANGE_BEGIN

static int agent_shutdown(int majorID, int minorID, void *serverarg, void 
*clientarg)
{

DEBUGMSGTL(("vplexStats:init", "shutdown table vplexstatsTable\n"));
LOG(LOG_INFO,"shutdown stats table \n");

return 0;
}
VPLEX_CHANGE_END

/* Typical data structure for a row entry */

/*
This is a hack made to the Table entry structures since IP Address
index used to be in reversed orded for GETNext and Get Bulk calls.
The hack to get things working,is to tweak the vplexDirectorFETable_entry
(and similar) structure to include *two* fields for the
IP address - one held in host order and one in network
order.
Then use one for the index processing (in the get_first
and get_next routines), and the other in the handler
itself (for the column object).
*/
struct vplexDirectorTable_entry {
/* Index values */
in_addr_t vplexDirectorPrimaryIpAddr;
in_addr_t vplexDirectorPrimaryIpAddrHostOrder;
/* Column values */
in_addr_t vplexDirectorFailoverIpAddr;
char vplexDirectorName[NNN];
size_t vplexDirectorName_len;
/* Illustrate using a simple linked list */
int   valid;
struct vplexDirectorTable_entry *next;
};

//  # Determine the first/last column names

/** Initialize the vplexDirectorTable table by defining its contents and how 
it's structured */
void initialize_table_vplexDirectorTable(void)
{
oid vplexDirectorTable_oid[] = {1,3,6,1,4,1,1139,21,2,2,1};
const size_t vplexDirectorTable_oid_len   = 
OID_LENGTH(vplexDirectorTable_oid);
netsnmp_handler_registration*reg;
netsnmp_iterator_info   *iinfo;
netsnmp_table_registration_info *table_info;

DEBUGMSGTL(("vplex:init", "initializing table vplexDirectorTable\n"));

reg = netsnmp_create_handler_registration(
"vplexDirectorTable", vplexDirectorTable_handler,
vplexDirectorTable_oid, vplexDirectorTable_oid_len,
HANDLER_CAN_RONLY
);

table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
netsnmp_table_helper_add_indexes(table_info,
ASN_IPADDRESS,  /* index: vplexDirectorPrimaryIpAddr */
0);
table_info->min_column = COLUMN_VPLEXDIRECTORPRIMARYIPADDR;
table_info->max_column = COLUMN_VPLEXDIRECTORNAME;

iinfo = SNMP_MALLOC_TYPEDEF( netsnmp_iterator_info );
iinfo->get_first_data_point = vplexDirectorTable_get_first_data_point;
iinfo->get_next_data_point  = vplexDirectorTable_get_next_d