Configuring contextEngineId and Context Name

2007-08-30 Thread gauravmeh2004
Hello,

Do we need to configure "context Name" and "context Engine" somewhere in 
snmpd.conf or it is automatically done for snmpv3
by Net-SNMP

I have added following lines in snmpd.conf for authentication :
defSecurityName abc
defAuthTypeMD5
defSecurityLevel   authPriv
defAuthPassphrase  mysecretpass
defPrivType  DES
defPrivPassphrasemypassphrase
defVersion3


and it works fine through command line when i give following :

snmpwalk -v3 -u abc -l authPriv -a MD5 -A mysecretpass -x DES -X  mypassphrase 
localhost

but through a MIB Browser(GUI) it ask for "context Name" and "Context Engine" ; 
-- if i keep it empty i get a response : User Authentication Failed
-- If i enter something i get a response : Timeout

I had searched a lot on this .. but was unable to find it
Could u please help in this


Br
Gaurav

--
My life has changed. What about yours?
Log on to the new Indiatimes Mail and Live out of the Inbox!
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Passing context name and Engine ID in Request

2007-08-31 Thread gauravmeh2004
Hello,

Do we need to configure "context Name" and "context Engine" somewhere in 
snmpd.conf or it is automatically done for snmpv3
by Net-SNMP

I have added following lines in snmpd.conf for authentication :
defSecurityName abc
defAuthTypeMD5
defSecurityLevel   authPriv
defAuthPassphrase  mysecretpass
defPrivType  DES
defPrivPassphrasemypassphrase
defVersion3
defContextName   context


and it works fine through command line when i give following :

snmpwalk -v3 -u abc -l authPriv -a MD5 -A mysecretpass -x DES -X  mypassphrase 
localhost

but through a MIB Browser(Mibbel GUI) it ask for "context Name" and "Context 
Engine" ;
-- if i keep it empty i get a response
-- If i enter something(context) i get a response : Timeout

do anything to be done in access specifiers in snmpd.conf

I had searched a lot on this .. but was unable to find it
Could u please help in this


Br
Gaurav

--
Guess 1st innings score. Win 1 Lakh* Rupees.
SMS RUN to . 

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Failed to connect to agentx master agent

2007-08-31 Thread gauravmeh2004
Hello ,

I am running the agent as a Agentx configuration
snmpd--- Master Agent
myAgent --- subAgent

But each time i try to run it i get message "Failed to connect to agentX master 
agent(localhost:706)

Following are the configuration related to agentx in 
/usr/local/share/snmp/snmpd.conf

#
masteragentx
AgentXSocket  tcp:localhost:706
#

I am running the snmpd(master) as
/usr/local/sbin/snmpd -c /usr/local/share/snmpsnmpd.conf -X tcp:localhost:706

In the subagent main() method i have added
if (agentx_subagent) 
{
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_ROLE, 1);
/*
 * AGENTX_ADDRESS is initialized to default port for AgentX.
 */
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET, "localhost:706");

syslog(LOG_INFO, "Agent starting as AgentX Subagent.");
}

But when i run the subagent it gives me error as:
Warning: Failed  to connect to agentX master agent(localhost:706):
Warning: Failed  to connect to agentX master agent(localhost:706):

Please could u provide me some hint whats the problem in this case.


Thanks
Gaurav

--
Guess 1st innings score. Win 1 Lakh* Rupees.
SMS RUN to . 

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


RE: Failed to connect to agentx master agent

2007-09-03 Thread gauravmeh2004
Hi,

That was mistakenly written but i actually used,
/usr/local/sbin/snmpd -c /usr/local/share/snmpd.conf -X tcp:localhost:706


But anyhow , i was successfull in running it ,
the problem was that in the sub agent code i changed the agentx port from 
"localhost:706" to "tcp:localhost:706" and it worked fine

if (agentx_subagent) 
{
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_ROLE, 1);
/*
 * AGENTX_ADDRESS is initialized to default port for
AgentX.
 */
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET,
"tcp:localhost:706");


Br
Gaurav


- Original Message -
From: Jayaprakasha Guddenahalli Naganna <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], [EMAIL PROTECTED], net-snmp-coders@lists.sourceforge.net
Sent: Fri, 31 Aug 2007 21:04:58 +0530 (IST)
Subject: RE: Failed to connect to agentx master agent

>>/usr/local/sbin/snmpd -c /usr/local/share/snmpsnmpd.conf -X
>>tcp:localhost:706
I think you have given wrong configuration file name "snmpsnmpd.conf".
Please check the file name.
Thanks
-JP

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, August 29, 2007 10:50 AM
To: [EMAIL PROTECTED];
net-snmp-coders@lists.sourceforge.net
Subject: Failed to connect to agentx master agent

Hello ,

I am running the agent as a Agentx configuration
snmpd--- Master Agent
myAgent --- subAgent

But each time i try to run it i get message "Failed to connect to agentX
master agent(localhost:706)

Following are the configuration related to agentx in
/usr/local/share/snmp/snmpd.conf

#
masteragentx
AgentXSocket  tcp:localhost:706
#

I am running the snmpd(master) as
/usr/local/sbin/snmpd -c /usr/local/share/snmpsnmpd.conf -X
tcp:localhost:706

In the subagent main() method i have added
if (agentx_subagent) 
{
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_ROLE, 1);
/*
 * AGENTX_ADDRESS is initialized to default port for
AgentX.
 */
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET,
"localhost:706");

syslog(LOG_INFO, "Agent starting as AgentX Subagent.");
}

But when i run the subagent it gives me error as:
Warning: Failed  to connect to agentX master agent(localhost:706):
Warning: Failed  to connect to agentX master agent(localhost:706):

Please could u provide me some hint whats the problem in this case.


Thanks
Gaurav

--
Guess 1st innings score. Win 1 Lakh* Rupees.
SMS RUN to . 


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


--
Guess 1st innings score. Win 1 Lakh* Rupees.
SMS RUN to . 

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Able to send v2 traps but Issue in sending v3 traps

2007-09-27 Thread gauravmeh2004
Hello,

I am facing problem sending SNMPv3 traps to the trap listener (snmptrad , 
AdventNet Trap Listener) from the agent which i have compiled as Master - 
subagent configuration(Agentx)


Following is the configuration i did in /usr/local/share/snmp/snmpd.conf

com2sec  v3_userlocalhost v3_private
group   v3_group   usm   v3_user
rwuser v3_user auth
viewall included  .1  80
accessv3_group""  any   noauth   exact  allall
none

master  agentx
AgentXSockettcp:localhost:706

trapsess -e 0x0102030405 -v 3 -u v3_user -a MD5 -A mysecretpass -l authNoPriv 
localhost:162
snmpsess -e 0x0102030405 -v 3 -u v3_user -a MD5 -A mysecretpass -l authNoPriv 
localhost:162
=


Following is the configuration for /usr/local/share/snmp/snmptrapd.conf
==
logoption  o
ignoreauthfailure  no
authCommunity log v3_private
==


Following lines were added in /var/net-snmp/snmpd.conf & 
/var/net-snmp/snmptrapd.conf 
===
snmpd.conf  >  createUser v3_user MD5 mysecretpass DES mypassphrase
snmptrapd.conf >  createUser 0x0102030405 v3_user MD5 mysecretpass DES 
mypassphrase

===


Problem is that when i run "snmptrapd -Dusm -P" and the run my agent from where 
i send trap using "send_v2trap()" it gives me following error and no traps are 
recieved 

USM processing begun...
usm: usm: match on user v3_user
match on user v3_user
usm: no match on engineID (80 00 1F 88 04 53 54 52 49 4E 47 usm: no match on
engineID (80 00 1F 88 04 53 54 52 49 4E 47 )
)
usm: usm: match on user v3_user
match on user v3_user
usm: usm: Verification succeeded.
Verification succeeded.
usm: usm: USM processing completed.
USM processing completed.


Could u help me in this case as when i use "trap2sink localhost v3_private" 
directive in snmpd.conf then i am able to recieve the traps but these are V2 
trap.How to get V3 traps


Thanks
Gaurav

--
My life has changed. What about yours?
Log on to the new Indiatimes Mail and Live out of the Inbox!
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Possibility of HardCoding engine-ID for each USM user??

2007-10-10 Thread gauravmeh2004
Hello ,


Could it be possible that i can hardcode the engine id for each user i create

i.e
In /var/net-snmp/snmpd.conf
createUser -e 0x0102030405 v3_user MD5 mysecretpass DES mypassphrase

This lines in snmpd.conf is replaced by an encrypted key , but what i suppose 
that the entry for this user does not get created in USM table
as when i hit snmpget request as:

snmpget -e 0x0102030405 -v v3_user -l authNoPriv -a MD5 -A mysecretpass 
localhost sysUptime.0
RESPONSE = "Timeout : No Response from localhost"

snmpget  -v v3_user -l authNoPriv -a MD5 -A mysecretpass localhost sysUptime.0
RESPONSE = snmpget  : Unkwon user Name

Whereas for TRAPS:
Though i read that we need to hardcode the engineID for sending trap in 
snmd.conf as the engineID of the engine *sending* the trap PDU and the trap 
reciever would need to be configured with appropriate users for each trap 
generator with the hardcoded engineID as send by the agent 
{ [ -- FROM EMAIL ARCHIVE NET-SNMP FORUM -- ] If you are sending an SNMPv3 trap 
PDU, then the engineID should be that of the engine *sending* the trap (and the 
trap receiver would need to be configured with appropriate users for each trap 
generator. If you are sending an SNMPv3 inform PDU, then the engine ID should 
be that of the engine *receiving* the trap.}

so i hardcoded the engine-id at agent in /usr/local/share/snmp/snmpd.conf as :
trapsess -e 0x0102030405 -v 3 -u v3_user -a MD5 -A mysecretpass -l authNoPriv

I was able to recieve the traps 

Could u explain why so and can we hardcode the engineID for the Users while 
creating


Br
Gaurav


--
My life has changed. What about yours?
Log on to the new Indiatimes Mail and Live out of the Inbox!
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


addding new fd in select() for recieving request

2008-06-09 Thread gauravmeh2004
Hello,

I have a requirement that i also need to listen for alarms coming from another 
application on socket and forward them to manager apart from GET/SET request 
from Manager

Now in order to listen on socket for alarms i need to accept the connection but 
this will make it blocking. So i have to add it in select() to hear whether it 
is ready to be read or not and then accept connection.

I am thinking of doing it in following manner.
Please comment on the following if it is wrong
This code will be main

main()
{
fd_set master;
fd_set read_fds;
int listener;
int fdmax;
int newfd;

FD_ZERO(&master); 
FD_ZERO(&read_fds);

listener = socket(AF_INET, SOCK_STREAM, 0);
bind(listener, (struct sockaddr *)&myaddr, sizeof(myaddr));
listen(listener, 10)

// add the listener to the master set
FD_SET(listener, &master);
fdmax = listener;

 while()
 {
 read_fds = master;
 snmp_select_info(&numfds, &read_fds, NULL, 0);
 
 select(numfds,&read_fds,0,0,NULL)
 if (FD_ISSET(listener , &read_fds)) 
 {
 newfd = accept(listener, (struct sockaddr 
*)&remoteaddr,&addrlen)
 //function1 --->reads the data add it to queue and forward to 
manager as a TRAP
 }

 }
}


But this does'nt seem to work , do i need to register my function1.Please help 
me on this


Thanks



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Logging of subagent to different file

2008-06-12 Thread gauravmeh2004
Hello,

Could it be possible for creating a different log file for subagent and manage 
the log level and type of log messages to be logged.

What i understood was that all the logs are written to /var/log/snmpd.log , but 
is it right that 2 different process master agent and subagen write to this 
same file


Thanks

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Timeout on GET request from second Manager

2008-06-13 Thread gauravmeh2004
Hello,

Do NEtSnmp support request from multiple managers

I developed SNMPv3 master-subagent.
I started a first MibBrowser(Acting as first Manager) and sent GET rtequest , 
it was successful
Then i started second MibBrowser(Acting as second Manager) and sent GET request 
, it TimedOut.

Do i need to do some configuration or netsnmp not at all support this 
requirement

I also need to sent taps to these managers
How to do it.

My snmd.conf is 

###
rwuser sbssEmsUser auth
com2sec sbssEmsUser 192.168.150.5 sbssEmsCommPrivate
view sbssEmsAll included .1 80
access sbssEmsUserGroup "" usm auth exact sbssEmsAll sbssEmsAll sbssEmsAll
master  agentx
AgentXSockettcp:localhost:706

trap2sink  192.168.150.5 sbssEmsCommPrivate 162
informsink  192.168.150.5 sbssEmsCommPrivate 162
trapcommunity  sbssEmsCommPrivate


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Logging of subagent to different file

2008-06-13 Thread gauravmeh2004
OK i am using Agentx Configuration

as a read somewhere in the forum that :

###
If your subagent understands the standard command-line arguments,
then you can use the -Lf option to specify the appropriate log file to use.

Otherwise, you could either code your subagent to use the
snmp_log_options() routine (to handle command-line options),
or extract the relevant code from this routine.

You basically need to set up a NETSNMP_LOGHANDLER_FILE
style log handler, and specify the name of the file to log to
(logh->token)


i tried using this as

logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
if (logh) 
{
logh->pri_max = pri_max;
logh->token   = strdup("/root/myAgentx.log");
netsnmp_enable_filelog(logh,
   
netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,

  NETSNMP_DS_LIB_APPEND_LOGFILES)); 
}

but when i used API log file was created but logs for DEBUGMSG("Started") were 
found in the file

then i also added 
debug_register_tokens("snmpV3Agent,currentAlarmTable");
snmp_set_do_debugging(1);

Then the logs start coming but they were also shown on stdout(console) which i 
don,t won't so could it be possible that my subagent(Agentx) logs come in 
different file and master agent in different file


Thanks

- Original Message -
From: Magnus Fromreide <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Fri, 13 Jun 2008 11:44:56 +0530 (IST)
Subject: Re: Logging of subagent to different file

On Tue, 2008-06-10 at 23:28 +0530, [EMAIL PROTECTED] wrote:
> Hello,
> 
> Could it be possible for creating a different log file for subagent
> and manage the log level and type of log messages to be logged.

Eh, it already is?

> What i understood was that all the logs are written
> to /var/log/snmpd.log , but is it right that 2 different process
> master agent and subagen write to this same file

Lets assume that you have the programs

snmpd (generated from ./configure ; make ; make install) and subagent
(generated from net-snmp-config --compile-subagent subagent subagent1.c
subagent2.c)

then

snmpd -Lf /tmp/my.snmpd.log.file

will send all logs from snmpd to /tmp/my.snmpd.log.file


and

subagent -Lf /tmp/my.subagent.log.file

will send all logs from subagent to /tmp/my.subagent.log.file.

/MF



-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Logging of subagent to different file

2008-06-13 Thread gauravmeh2004
i tried using this as

netsnmp_log_handler *logh;
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);

if (logh)
{
   logh->pri_max = pri_max;
   logh->token   = strdup("/root/myAgentx.log");
   netsnmp_enable_filelog(logh,
   netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
   NETSNMP_DS_LIB_APPEND_LOGFILES));
}

but when i used API log file was created but logs for DEBUGMSG("Started") were 
found in the file

then i also added
debug_register_tokens("snmpV3Agent,currentAlarmTable");
snmp_set_do_debugging(1);

Then the logs start coming but they were also shown on stdout(console) which i 
don,t won't so could it be possible that my subagent(Agentx) logs come in 
different file and master agent in different file


Thanks

- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net, [EMAIL PROTECTED]
Sent: Wed, 11 Jun 2008 14:15:34 +0530 (IST)
Subject: Re: Logging of subagent to different file

2008/6/10  <[EMAIL PROTECTED]>:
> Could it be possible for creating a different log file for subagent
> and manage the log level and type of log messages to be logged.

If your subagent understands the standard command-line arguments,
then you can use the -Lf option to specify the appropriate log file to use.

Otherwise, you could either code your subagent to use the
snmp_log_options() routine  (to handle command-line options),
or extract the relevant code from this routine.

You basically need to set up a NETSNMP_LOGHANDLER_FILE
style log handler, and specify the name of the file to log to
(logh->token)

Dave

PS:  Can you please post requests to *one* of the mailing lists,
not both.  Thanks


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Timeout on GET request from second Manager

2008-06-13 Thread gauravmeh2004
Hello

These managers are configured for V3 request
I sent same GET request to retrieve the value of alarmID from the alarmtable 
and the User was "sbssEmsUser"

My snmd.conf:
--
trapsess -e 0x80001f888017454900b6f44848 -v 3 -u sbssEmsUser -a MD5 -A 
sbssEmsSecretpass  -l authNoPriv 192.168.150.5:162

rwuser sbssEmsUser auth
com2sec sbssEmsUser 192.168.150.5 sbssEmsCommPrivate
group sbssEmsUserGroup usm sbssEmsUser
view sbssEmsAll included .1 80
access sbssEmsUserGroup "" usm auth exact sbssEmsAll sbssEmsAll sbssEmsAll
master  agentx
AgentXSockettcp:localhost:706

That is i should be able to recieve request from multiple managers

One more question related to configuration were in agent we configure from 
which IP to listen for request or we just create user , it's group and view 
access

Thanks a lot

- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Fri, 13 Jun 2008 14:21:42 +0530 (IST)
Subject: Re: Timeout on GET request from second Manager

2008/6/13  <[EMAIL PROTECTED]>:
> Do NEtSnmp support request from multiple managers

Yes.

> I developed SNMPv3 master-subagent.
> I started a first MibBrowser(Acting as first Manager) and sent GET rtequest , 
> it was successful
> Then i started second MibBrowser(Acting as second Manager) and sent GET 
> request , it TimedOut.

How are these two browsers configured?
What version of SNMP and what community/user are they using?

What were the two GET requests?

> My snmd.conf is

> rwuser sbssEmsUser auth
> com2sec sbssEmsUser 192.168.150.5 sbssEmsCommPrivate

No.
Do not use the same security name for an SNMPv3 user
and an SNMPv1/2c community.   It *might* work, but I'm
not convinced.  And it's just asking for confusion.

Keep different access control settings distinct

> view sbssEmsAll included .1 80
> access sbssEmsUserGroup "" usm auth exact sbssEmsAll sbssEmsAll sbssEmsAll

You haven't defined 'sbssEmsUserGroup'
(and I assume that you've created the SNMPv3 user 'sbssEmsUser'
 in the /var/net-snmp/snmpd.conf file?)


Why not simply use

   rocommunity  sbssEmsCommPrivate

?
That's much simpler!


> trap2sink  192.168.150.5 sbssEmsCommPrivate 162
> informsink  192.168.150.5 sbssEmsCommPrivate 162

Do you really want to send two copies of every trap
to the same management station?

> trapcommunity  sbssEmsCommPrivate

The trapcommunity needs to come *before* the sink lines.

Dave


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Logging of subagent to different file

2008-06-14 Thread gauravmeh2004
The priority was set to LOG_DEBUG

sorry for the mistake

but when i used API log file was created but logs for DEBUGMSG("Started") were 
"NOT" found in the file


The problem is that if i don't add following lines in code the logs for 
DEBUGMSG("Started") and DEBUGMSGTL("snmpV3Agent","Started") do not come but my 
logfile is created

debug_register_tokens("snmpV3Agent,currentAlarmTable");
snmp_set_do_debugging(1);

but on adding these above lines log start coming in my logfile but also come on 
console

code piece:
-
debug_register_tokens("snmpV3Agent,currentAlarmTable");
snmp_set_do_debugging(1);

/* Logging to a different file */
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
if (logh) 
{
logh->pri_max = pri_max;
logh->token   = strdup("/root/AGENT/Agent.log");
netsnmp_enable_filelog(logh,
   netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
 NETSNMP_DS_LIB_APPEND_LOGFILES));  
}
if (agentx_subagent) 
{
DEBUGMSG(("Using as Agentx SubAgent\n"));
DEBUGMSGTL(("snmpV3Agent", "Using as Agentx SubAgent\n"));
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_ROLE, 1);

netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
NETSNMP_DS_AGENT_X_SOCKET, AGENTX_ADDRESS);

DEBUGMSGTL(("snmpV3Agent","Agent starting as AgentX 
Subagent.\n"));

}
--

I am attaching my main file.I actually wanted that logs of mysubagent(AgentX) 
come in mylogfile and master agent in /var/logs/snmpd.log




Thanks a Lot 

- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Fri, 13 Jun 2008 18:46:56 +0530 (IST)
Subject: Re: Logging of subagent to different file

2008/6/13  <[EMAIL PROTECTED]>:
> i tried using this as
>
> netsnmp_log_handler *logh;
> logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);

"priority" ?
What value does this have?


> but when i used API log file was created but logs for DEBUGMSG("Started") 
> were found in the file

Isn't that what you wanted?
For messages to be logged in this file?


> then i also added
>debug_register_tokens("snmpV3Agent,currentAlarmTable");
>snmp_set_do_debugging(1);
>
> Then the logs start coming but they were also shown on stdout(console) which 
> i don,t won't

Where in your subagent code did you add these lines?
It's almost impossible to comment on what might be happening,
given such an isolated fragment of code.


>  so could it be possible that my subagent(Agentx) logs come in
> different file and master agent in different file

Yes - both Magnus and I have already told you that this
is possible.

But without a better description of what you are actually doing,
there's no way that we can help you find out what's going wrong.

Dave



snmpV3Agent.c
Description: Binary data
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Logging of subagent to different file

2008-06-15 Thread gauravmeh2004
Thanks it worked fine setting the log handler *before* activating the debug 
code.


Thanks
- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Sat, 14 Jun 2008 18:31:28 +0530 (IST)
Subject: Re: Logging of subagent to different file

2008/6/14  <[EMAIL PROTECTED]>:
> The problem is that if i don't add following lines in code the logs for 
> DEBUGMSG("Started")
> and DEBUGMSGTL("snmpV3Agent","Started") do not come but my logfile is created
>
>debug_register_tokens("snmpV3Agent,currentAlarmTable");
>snmp_set_do_debugging(1);
>
> but on adding these above lines log start coming in my logfile but also come 
> on console
>
> code piece:
> -
>debug_register_tokens("snmpV3Agent,currentAlarmTable");
>snmp_set_do_debugging(1);
>
>/* Logging to a different file */
>logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);



Try setting up the log handler *before* activating the debug code.

If you look at the output currently produced, my guess is that
it probably starts with:

No log handling enabled - turning on stderr logging

Dave


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Timeout on GET request from second Manager

2008-06-15 Thread gauravmeh2004
When the request from AdventNet Mib Browser configured for V3 request , then 
request from second Mibbrowser timed out

But from command line both were successfull

>From Machine 1:
===
snmpget -v 3 -u sbssEmsUser -l authPriv -a MD5 -A sbssEmsSecretPass -x DES -X 
sbssEmsPassphrase localhost HNS-MSV-3GSBSS-EMS-OSS-MIB::currentAlarmID.0

RESPONSE : SUCCESS

>From Machine 2:
===
snmpget -v 3 -u sbssEmsUser -l authPriv -a MD5 -A sbssEmsSecretPass -x DES -X 
sbssEmsPassphrase 192.168.150.6 HNS-MSV-3GSBSS-EMS-OSS-MIB::currentAlarmID.0

RESPONSE : SUCCESS


Thanks

- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Fri, 13 Jun 2008 18:49:29 +0530 (IST)
Subject: Re: Timeout on GET request from second Manager

2008/6/13  <[EMAIL PROTECTED]>:
> These managers are configured for V3 request
> I sent same GET request to retrieve the value of alarmID from the alarmtable 
> and the User was "sbssEmsUser"

So you sent the exact same request from two client systems to the same
SNMP agent.
One worked, and one timed out.   Is that correct?

Can you post the *exact* commands that you used in each case?

Dave


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Multithreaded : IS IT Safe to create new thread for updating CONTAINERS

2008-06-19 Thread gauravmeh2004
Hello,

I read NET_SNMP is single threaded and does not claim to be thread safe either. 
Now I have requirement to periodically fetch all the alarms related data from 
DB and update the NETSNMP CONTAINER from which GET/GET NEXT/GET BULK request 
will return data.

I have implemented this in following way.
I created a new thread and make that thread sleep for some time and after it 
resumes it fetches the data from DB (this happens continously in while(1)). Now 
in this thread only,i updated the NetSNMP CONTAINER using CONTAINER.INSERT() 
and took a mutex before updating it. But the cacth here is while updation is 
going on and mutex lock is there and some GET/GET NEXT/GET BULK request comes 
so it won't be able to access CONTAINER and will timeout/ error will be thrown.
So how to handle this. Is my approach right


Thanks

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Multithreaded : IS IT Safe to create new thread for updating CONTAINERS

2008-06-29 Thread gauravmeh2004
Hello,

Yes you are right that lock should be taken on all areas where the shared 
CONTAINER is being used/accessed
I have a query related to this only

I have alarmTable mib module
The alarmTable CONTAINER will be accessed by 2 different threads
1) netsnmp thread for GET/SET operations
2) my subagent(master-subagent configuration) thread which will continously 
updating this container with new alarms recieved

As this is a table so using mib2c.array.conf it gave me folowing methods:
currentAlarmTable_cmp()
currentAlarmTable_get()
init_currentAlarmTable()
currentAlarmTable_row_copy()
currentAlarmTable_extract_index()
currentAlarmTable_can_delete()
currentAlarmTable_duplicate_row()
currentAlarmTable_delete_row()
currentAlarmTable_set_reserve1()
currentAlarmTable_set_reserve2()
currentAlarmTable_set_action()
currentAlarmTable_set_commit()
currentAlarmTable_set_free()
currentAlarmTable_set_undo()
initialize_table_currentAlarmTable()
currentAlarmTable_get_value()
currentAlarmTable_get_by_idx()
updateCurrentAlarmTable_MyOwnMethod()--->In this method i do CONTAINER.INSERT()

So in order to have syncronization i am using mutex and condition variable. But 
i am not sure where all to use mutexs.
I am using mutexes in following places :
updateCurrentAlarmTable_MyOwnMethod()
initialize_table_currentAlarmTable()

Do i also need to take lock on following methods provided by netsnmp
currentAlarmTable_set_reserve1()
currentAlarmTable_set_reserve2()
currentAlarmTable_set_action()
currentAlarmTable_set_commit()
currentAlarmTable_set_free()
currentAlarmTable_set_undo()
currentAlarmTable_get_value() 
as they also access CONTAINER


- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Fri, 20 Jun 2008 14:30:34 +0530 (IST)
Subject: Re: Multithreaded : IS IT Safe to create new thread for updating 
CONTAINERS

2008/6/19  <[EMAIL PROTECTED]>:
> I created a new thread and... in this thread only,i updated the NetSNMP 
> CONTAINER using
> CONTAINER.INSERT() and took a mutex before updating it.

That's half of the task, yes.

But as I understand threading (and I am *not* an expert in this field),
you will also need to have a corresponding lock around the code that
*uses* this container.   I.e. the code for your MIB module (and any
helpers that it might rely on).

You will need to look closely at the code that implements your MIB
module, to see exactly where the container is referenced, and hence
the region you need to protect with the lock.

Dave


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Multithreaded : IS IT Safe to create new thread for updating CONTAINERS

2008-06-30 Thread gauravmeh2004
I agree to your point that we need to take lock on every place of my mib module 
(whose code is generated by mib2c) which access the CONTAINER (*_set_reserve1() 
, *_set_reserve2()., *_set_free(), *_set_undo(),*_get_value()...)
But could u just let me know that do in any case locking to be done in netsnmp 
code and api's.

Br
Gaurav
- Original Message -
From: Dave Shield <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: net-snmp-coders@lists.sourceforge.net
Sent: Mon, 30 Jun 2008 13:38:44 +0530 (IST)
Subject: Re: Multithreaded : IS IT Safe to create new thread for updating 
CONTAINERS

2008/6/30  <[EMAIL PROTECTED]>:
> . But i am not sure where all to use mutexs.
> I am using mutexes in following places :
> updateCurrentAlarmTable_MyOwnMethod()
> initialize_table_currentAlarmTable()
>
> Do i also need to take lock on following methods provided by netsnmp
> currentAlarmTable_set_reserve1()
> currentAlarmTable_set_reserve2()
> currentAlarmTable_set_action()
> currentAlarmTable_set_commit()
> currentAlarmTable_set_free()
> currentAlarmTable_set_undo()
> currentAlarmTable_get_value()
> as they also access CONTAINER

Bear in mind that I am not an expert in multi-threaded programming.
But I would expect that you would need a mutex lock around *every*
bit of code that works with row data obtained from the table container,

That's the code in your MIB module *and* any similar code within
the relevant handler routines.

I am not familiar with the module framework you are using,
but I would expect that most of the places you mention would
indeed need to be protected.

  The question to bear in mind throughout is:

"would it matter if  updateCurrentAlarmTable_MyOwnMethod()
cleared all the rows from the table at this precise moment?"

If the table being emptied would break a given section of code,
then that code needs to be protected.

Or at least, that's my understanding.
Someone who actually knows about such things might be
able to advise you differently.

Dave


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Control Logging Priorities(LOG_DEBUG , LOG_CRIT) for different log file

2008-07-11 Thread gauravmeh2004
Hello,

I want to do logging of my subagent(Master[snmpd] - subagent[myAgent] 
configuration) to a different file for this i have created a new handler and 
registered my tokens :

:
=
netsnmp_log_handler *logh;
int priority = LOG_DEBUG;
int pri_max  = LOG_EMERG;
/* Logging to a different file */
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_FILE, priority);
if (logh) 
{
logh->pri_max = pri_max;
logh->token   = strdup("mySubAgent.log");
netsnmp_enable_filelog(logh,
   netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  NETSNMP_DS_LIB_APPEND_LOGFILES)); 
}

debug_register_tokens("snmpV3Agent,currentAlarmTable");
snmp_set_do_debugging(1);
=
:

and then use DEBUGMSGTL() to enter logs, e.g :

:
=
DEBUGMSGTL(("snmpV3Agent", "Using as Agentx SubAgent\n"));
=
:

But i want to do logging of my subagent to a different file for various 
priorities and control that priority through config file i.e

LOG_DEBUG , LOG_INFO , LOG_WARNING , LOG_CRIT

i.e While debugging just enable log messages for LOG_DEBUG and in production 
enable log messages for LOG_CRIT and LOG_WARNING.

Which api to use for this ( shall i use snmp_log or DEBUGMSGTL api) and how to 
control logging through configuration

Thanks

-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Updating existing rows in CONTAINER

2008-08-15 Thread gauravmeh2004
Hello,

I have a table which have index ranging from 1-1000 , once the index reaches 
1000 it is rounded off back to 1.
Now in such case the existing rows with that index need to be updated.

1) Can i safely go ahead with finding a row with the index(rounded off back to 
1) and simpy updating it.
i.e 
CONTAINER_FIND(cb.container,index);
if(found)
{
   simply update the row
}

2) Or I first need to delete that particular row from table with the 
index(rounded off back to 1) , allocate new memory and then insert the row with 
same index
i.e
CONTAINER_FIND(cb.container,index);
if(found)
{
delete row
SNMP_MALLOC_TYPEDEF() //allocate memory 
CONTAINER_INSERT() //insert the row with same index
}

As i read in forum that:
"modifying pointers after they've been inserted, without removing them is NOT 
allowed options for a container."

Thanks
Gaurav

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Issues while handling data in CONTAINER

2008-09-10 Thread gauravmeh2004
Hello,
1)When ever i insert a row in CONTAINER i get error

--- "error on subcontainer '' insert (-1)"

What could be the reason for this.
This happens always when i insert a row


2) When deleting a row from CONTAINER(array-user) , can i simply call 
CONTAINER_REMOVE(cb , ctx) or i need to call _delete_row() method generated 
by mib2c after calling CONTAINER_REMOVE(cb , ctx)

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Regarding error on subcontainer '' insert (-1)

2009-02-28 Thread gauravmeh2004
Hello,

We are getting error in log file for every insert, delete on NetSnmp container 
as -->
"error on subcontainer '' insert (-1)"
it is flling up the log file unneccesary.

I went through net-snmp mailing list and came to know that:
1) It is likely one of default network-related agent/mib with net-snmp which is 
causing the issue
2) ipAddressTable could not deal with the interfaces with the same IP(The 
indexes for this table are ipAddressAddrType and ipAddressAddr. That means that 
an ipAddress on multiple interfaces will not have a unique index.) , but our 
interfaces are not having same IP
3) i even tried to disable this mib by sing:
 snmpd -I-ip...
but still the error is coming in log file

Could anyone help me out in this. Or is there any patch available.We are using 
net-snmp release 5.4.1


Thanks
Gaurav


--
Check out the Mahindra Xylo inside out with reviews, pictures, video and 
more.Exclusively on ZigWheels.com
http://www.zigwheels.com/b2cam/mahindra-xylo.html

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Issue with sending Traps as fast rate

2009-09-08 Thread gauravmeh2004
Hello,

We are using netsnmp release 5.4.1. We are facing issue with trap sending

We are sending trap at a fast rate 1000 Alarms/sec. The Agent hangs. Adding 
some debug statement , we found that the code hangs when we give call to 
send_v2trap(var_list);

At our trap receiver we received 500 Alarms and then we saw no traps (as agent 
which was forwarding traps was hanged) . Could you suggest what is the issue.

Following is the configuration in snmpd.conf for sending trap:

trapsess -e  -v 3 -u  -a MD5 -A  -l authNoPriv :

Following is the code used for sending trap:

<>
int
send_alarmChanged_trap(struct alarmdata trapData)
{
netsnmp_variable_list *var_list = NULL;


oid alarmChanged_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 3, 6 };
oid currentAlarmIndex_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 1
/* insert index here */  };
oid currentAlarmNotificationID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 2
/* insert index here */  };
oid currentAlarmID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 3
/* insert index here */  };
oid currentAlarmEventType_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 4
/* insert index here */  };
oid currentAlarmSeverity_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 5
/* insert index here */  };
oid currentAlarmReportingElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 6
/* insert index here */  };
oid currentAlarmFaultElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 7
/* insert index here */  };
oid currentAlarmName_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 8
/* insert index here */  };
oid currentAlarmProbableCause_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 9
/* insert index here */  };
oid currentAlarmAdditionalInformation_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 10
/* insert index here */  };
oid currentAlarmChangedTime_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 12
/* insert index here */  };
oid ipAddress_oid[] = {1, 3, 6, 1, 6, 3, 18, 1, 3 };

char ip_address_buffer[128];
struct sockaddr_in my_addr;

OSSAgentConfiguration::getAgentAddress(ip_address_buffer);

inet_aton(ip_address_buffer, &(my_addr.sin_addr));

/*
 * Set the snmpTrapOid.0 value
 */
snmp_varlist_add_variable(&var_list,
  snmptrap_oid, OID_LENGTH(snmptrap_oid),
  ASN_OBJECT_ID,
  (const u_char *)&alarmChanged_oid, 
sizeof(alarmChanged_oid));

/*
 * Add any objects from the trap definition
 */
snmp_varlist_add_variable(&var_list,
  currentAlarmIndex_oid,
  OID_LENGTH(currentAlarmIndex_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmIndex, 
sizeof(trapData.alarmIndex));
snmp_varlist_add_variable(&var_list,
  currentAlarmNotificationID_oid,
  OID_LENGTH(currentAlarmNotificationID_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmNotificationId, 
sizeof(trapData.alarmNotificationId));
snmp_varlist_add_variable(&var_list,
  currentAlarmID_oid,
  OID_LENGTH(currentAlarmID_oid), ASN_INTEGER,
  (const u_char *)&trapData.alarmId, 
sizeof(trapData.alarmId));
snmp_varlist_add_variable(&var_list,
  currentAlarmEventType_oid,
  OID_LENGTH(currentAlarmEventType_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmEventType, 
sizeof(trapData.alarmEventType));
snmp_varlist_add_variable(&var_list,
  currentAlarmSeverity_oid,
  OID_LENGTH(currentAlarmSeverity_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmSeverity, 
sizeof(trapData.alarmSeverity));
snmp_varlist_add_variable(&var_list,
  currentAlarmReportingElement_oid,
  OID_LENGTH(currentAlarmReportingElement_oid),
  ASN_OCTET_STR,
  (const u_char *)alarmReportingElement, 
strlen(alarmReportingElement));
snmp_varlist_add_variable(&var_list,
  currentAlarmFaultElement_oid,
  OID_LENGTH(currentAlarmFaul

Fw: Issue with sending Traps as fast rate

2009-09-13 Thread gauravmeh2004
Hello,

I am wondering wheter there is something related to adding up varbid in varlist 
using api

snmp_varlist_add_variable() or issue with send_v2trap(). Because when traps are 
send at fast rate 1000 alarm/sec then the code hangs somewhere in send_v2trap() 
api.

Could any body guide me on this.

Thanks and Regards
Gaurav



- Original Message -
From: gauravmeh2...@indiatimes.com
To: D T Shield , dave shield 

Cc: net-snmp-coders@lists.sourceforge.net
Sent: Wed, 9 Sep 2009 11:12:25 +0530 (IST)
Subject: Issue with sending Traps as fast rate

Hello,

We are using netsnmp release 5.4.1. We are facing issue with trap sending

We are sending trap at a fast rate 1000 Alarms/sec. The Agent hangs. Adding 
some debug statement , we found that the code hangs when we give call to 
send_v2trap(var_list);

At our trap receiver we received 500 Alarms and then we saw no traps (as agent 
which was forwarding traps was hanged) . Could you suggest what is the issue.

Following is the configuration in snmpd.conf for sending trap:

trapsess -e  -v 3 -u  -a MD5 -A  -l authNoPriv :

Following is the code used for sending trap:

<>
int
send_alarmChanged_trap(struct alarmdata trapData)
{
netsnmp_variable_list *var_list = NULL;


oid alarmChanged_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 3, 6 };
oid currentAlarmIndex_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 1
/* insert index here */  };
oid currentAlarmNotificationID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 2
/* insert index here */  };
oid currentAlarmID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 3
/* insert index here */  };
oid currentAlarmEventType_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 4
/* insert index here */  };
oid currentAlarmSeverity_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 5
/* insert index here */  };
oid currentAlarmReportingElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 6
/* insert index here */  };
oid currentAlarmFaultElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 7
/* insert index here */  };
oid currentAlarmName_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 8
/* insert index here */  };
oid currentAlarmProbableCause_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 9
/* insert index here */  };
oid currentAlarmAdditionalInformation_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 10
/* insert index here */  };
oid currentAlarmChangedTime_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 12
/* insert index here */  };
oid ipAddress_oid[] = {1, 3, 6, 1, 6, 3, 18, 1, 3 };

char ip_address_buffer[128];
struct sockaddr_in my_addr;

OSSAgentConfiguration::getAgentAddress(ip_address_buffer);

inet_aton(ip_address_buffer, &(my_addr.sin_addr));

/*
 * Set the snmpTrapOid.0 value
 */
snmp_varlist_add_variable(&var_list,
  snmptrap_oid, OID_LENGTH(snmptrap_oid),
  ASN_OBJECT_ID,
  (const u_char *)&alarmChanged_oid, 
sizeof(alarmChanged_oid));

/*
 * Add any objects from the trap definition
 */
snmp_varlist_add_variable(&var_list,
  currentAlarmIndex_oid,
  OID_LENGTH(currentAlarmIndex_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmIndex, 
sizeof(trapData.alarmIndex));
snmp_varlist_add_variable(&var_list,
  currentAlarmNotificationID_oid,
  OID_LENGTH(currentAlarmNotificationID_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmNotificationId, 
sizeof(trapData.alarmNotificationId));
snmp_varlist_add_variable(&var_list,
  currentAlarmID_oid,
  OID_LENGTH(currentAlarmID_oid), ASN_INTEGER,
  (const u_char *)&trapData.alarmId, 
sizeof(trapData.alarmId));
snmp_varlist_add_variable(&var_list,
  currentAlarmEventType_oid,
  OID_LENGTH(currentAlarmEventType_oid),
  ASN_INTEGER,
  (const u_char *)&trapData.alarmEventType, 
sizeof(trapData.alarmEventType));
snmp_varlist_add_variable(&var_list,
  currentAlarmSeverity_oid,
  OID_LENGTH(currentAlarmSeverity_oid),
  ASN_INTEGER,
  (c

Issue sending traps (Is it Master-subAgent Configuration usingAgentx ?? )

2009-09-19 Thread gauravmeh2004
Hello,

We are using Using net-snmp release 5.4.1

Facing issue with sending traps at high rate.

As sending traps at high rate snmpv2_trap() api hangs somewhere , i am doubting 
that it is somewhere when 
sending data to master agent on port 706 on tcp.

I am running master agent using following command:
/usr/local/sbin/snmpd -D -Lsd -Lf /root/GAURAV_OSS_AGENT/TEST_ENV/snmpd.log -a 
-c /usr/local/share/snmp/snmpd.conf -x tcp:localhost:706 

In log file i also saw "AgentX master agent failed to respond to ping.  
Attempting to re-register." thrice
So i am doubting that tcp queue is filling up while sending data at fast rate.
Is there some issue with using Agentx configuration using master-subagent

Can i configure my agent without agentx configuration.
So could it be possible that if i run my agent without agentx confgiuration , 
it might solve the issue

Following is the configuration in snmpd.conf for sending v3 traps:
trapcommunity  sbssEmsOssTrapCommPrivate

trapsess -e 0x80001f8804534253535f454d535f4f53535f31 -v 3 -u sbssEmsOss -a MD5 
-A sbssEmsOssSecretpass -l authNoPriv 192.168.150.5:9162

Can anyone help me on it, or provide me some direction where can i debug.

Thanks and Regards


--
Click for exclusive coverage on the New Bajaj Pulsar 220 the fastest Indian bike
http://www.zigwheels.com/Features/Bajaj-Pulsar-220-DTSi-Special-Coverage/Pulsar_20090623-1-1

--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders