Re: A MIB file dilemma

2012-10-25 Thread Sverre Moe
The file system scenario was the closest example I could think of. 
The device I am creating a MIB file for has ALOT of parameters which is 
organized in a hierarchy must like a file system. Each node in the path can 
have a few scalars(parameters), but most of them are at the end of a path (a 
subsystem).

My application running against a test system created a MIB file with almost 
5000 scalars and aprox 500 groups. 

According to the SMIv2 (RFC 2578) descriptor names must be unique and mnemonic. 
Using a hash is not exactly very mnemonic.


/Sverre

- Original Message - 

Fra: Heiko Gerstung he...@am-anger-1.de 
Til: net-snmp-users@lists.sourceforge.net 
Sendt: 24. oktober 2012 16:00:25 
Emne: Re: A MIB file dilemma 


On 24.10.2012 14:07, Sverre Moe wrote: 
 
 I have come up with the following hack for names over 64 characters. I'm not 
 sure if this hack is a very good solution. 
 
 Truncate in the middle with the number of characters over 64 (+2) and replace 
 it with -. 
 
 
 std::string tmp_string = name; 
 const int length = tmp_string.length(); 
 if (length  64) { 
 
 const int half = length / 2; //We truncate in the middle. 
 
 const int numberOff = (length - 64) + 2; //The number of characters to 
 truncate. 
 const std::string dash = -; 
 tmp_string = tmp_string.replace(half, numberOff, dash); 
 } 
 
 

Sverre, 

the stuff you seem to want to do with a MIB scares the hell out of me ;-) ... 
Not sure what you want to achieve with that 
(creating an SNMP file system). However, maybe you should take the MD5 hash of 
the full path (echo $FILENAME | md5sum) and 
use it as the name of the object and (for better readability) add a comment 
-- this is file /etc/hosts -- or something 
similar that helps you to find out which object is which file ... 

Again: for all the possible things that I could come up with as a reason why 
you are doing this, I would see a better 
(non-MIB abusing :-)) alternative. But: what do I know :-) 

Regards, 
Heiko 

P.S.: ... 
 CONFIDENTIALITY 
 This e-mail and any attachment contain KONGSBERG information which may be 
 proprietary, confidential or subject to export regulations, and is only meant 
 for the intended recipient(s). Any disclosure, copying, distribution or use 
 is 
 prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
 error, please delete it immediately from your system and notify the sender 
 properly. 
[insert rant about privacy disclaimers in mailing list / newsletter posts here] 


-- 
Everyone hates slow websites. So do we. 
Make your web apps faster with AppDynamics 
Download AppDynamics Lite for free today: 
http://p.sf.net/sfu/appdyn_sfd2d_oct 
___ 
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 


CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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: A MIB file dilemma

2012-10-25 Thread Heiko Gerstung
Hi Sverre,

On 25.10.2012 08:50, Sverre Moe wrote:
 The file system scenario was the closest example I could think of. 
 The device I am creating a MIB file for has ALOT of parameters which is 
 organized in a hierarchy must like a file system. Each node in the path can 
 have a few scalars(parameters), but most of them are at the end of a path (a 
 subsystem).

I see, thanks for the explanation.


 My application running against a test system created a MIB file with almost 
 5000 scalars and aprox 500 groups. 
OK.


 According to the SMIv2 (RFC 2578) descriptor names must be unique and 
 mnemonic. Using a hash is not exactly very mnemonic.
I know. But since it seems that you yourself cannot come up with 5000 unique 
and mnemonic names (at least not
programmatically/automatically) while being limited to 64 chars, a hash at 
least meets the unique requirement.

Regards,
 Heiko



 /Sverre

 - Original Message - 

 Fra: Heiko Gerstung he...@am-anger-1.de 
 Til: net-snmp-users@lists.sourceforge.net 
 Sendt: 24. oktober 2012 16:00:25 
 Emne: Re: A MIB file dilemma 


 On 24.10.2012 14:07, Sverre Moe wrote: 
 I have come up with the following hack for names over 64 characters. I'm not 
 sure if this hack is a very good solution. 

 Truncate in the middle with the number of characters over 64 (+2) and 
 replace it with -. 


 std::string tmp_string = name; 
 const int length = tmp_string.length(); 
 if (length  64) { 

 const int half = length / 2; //We truncate in the middle. 

 const int numberOff = (length - 64) + 2; //The number of characters to 
 truncate. 
 const std::string dash = -; 
 tmp_string = tmp_string.replace(half, numberOff, dash); 
 } 


 Sverre, 

 the stuff you seem to want to do with a MIB scares the hell out of me ;-) ... 
 Not sure what you want to achieve with that 
 (creating an SNMP file system). However, maybe you should take the MD5 hash 
 of the full path (echo $FILENAME | md5sum) and 
 use it as the name of the object and (for better readability) add a 
 comment -- this is file /etc/hosts -- or something 
 similar that helps you to find out which object is which file ... 

 Again: for all the possible things that I could come up with as a reason why 
 you are doing this, I would see a better 
 (non-MIB abusing :-)) alternative. But: what do I know :-) 

 Regards, 
 Heiko 

 P.S.: ... 
 CONFIDENTIALITY 
 This e-mail and any attachment contain KONGSBERG information which may be 
 proprietary, confidential or subject to export regulations, and is only 
 meant 
 for the intended recipient(s). Any disclosure, copying, distribution or use 
 is 
 prohibited, if not otherwise explicitly agreed with KONGSBERG. If received 
 in 
 error, please delete it immediately from your system and notify the sender 
 properly. 
 [insert rant about privacy disclaimers in mailing list / newsletter posts 
 here] 


 --
  
 Everyone hates slow websites. So do we. 
 Make your web apps faster with AppDynamics 
 Download AppDynamics Lite for free today: 
 http://p.sf.net/sfu/appdyn_sfd2d_oct 
 ___ 
 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 


 CONFIDENTIALITY
 This e-mail and any attachment contain KONGSBERG information which may be 
 proprietary, confidential or subject to export regulations, and is only meant 
 for the intended recipient(s). Any disclosure, copying, distribution or use 
 is 
 prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
 error, please delete it immediately from your system and notify the sender 
 properly.



--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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: A MIB file dilemma

2012-10-25 Thread Dave Shield
On 25 October 2012 07:50, Sverre Moe sve...@spacetec.no wrote:
 The file system scenario was the closest example I could think of.
 The device I am creating a MIB file for has ALOT of parameters
 which is organized in a hierarchy must like a file system. Each node
 in the path can have a few scalars(parameters), but most of them
 are at the end of a path (a subsystem).

Typically how deep is this hierarchy?
How meaningful are the individual names?
How _long_ are the individual names?


 My application running against a test system created a MIB file with almost 
 5000 scalars and aprox 500 groups.

 According to the SMIv2 (RFC 2578) descriptor names must be unique and 
 mnemonic. Using a hash is not exactly very mnemonic.

You could always try a combination of both names and hash values.
Given a path such as
   /one/two/three/four/five/six/seven/node

possibilities for the final MIB object name might include:

 {hash}-node(hash of directory path)
 one-{hash}-node (use root in full)
 six-seven-{hash}-node   (use selected directories in full)
 ottffss-{hash}-node (use initials of directories)
 ottff-six-seven-{hash}-node   (use initials plus selected directories)
 one-ttffs-seven-{hash}-node   (ditto)

In each case, the hash would be probably be calculated over
/one/two/three/four/five/six/seven in order to keep related scalars together.

You know what the path heirarchy actually looks like,
so are best positioned to decide which elements are best
taken in full, which can be taken using initials, and which
omitted altogether.
   But that should give you some ideas to work with.

Dave

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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: A MIB file dilemma

2012-10-25 Thread Sverre Moe

Not very deep. Each system is different, but I don't think more than 5-8 
levels. 
Individual names can be from 5 to 20 characters long. Also since some paths can 
have either status, config, cmd(command) I prefix with these strings on the 
scalar names (which adds to build up length of characters). 



I'll look into using hash in the descriptor name, in part or in full. 


/Sverre 
- Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: Heiko Gerstung he...@am-anger-1.de, 
net-snmp-users@lists.sourceforge.net 
Sendt: 25. oktober 2012 09:32:26 
Emne: Re: A MIB file dilemma 

On 25 October 2012 07:50, Sverre Moe sve...@spacetec.no wrote: 
 The file system scenario was the closest example I could think of. 
 The device I am creating a MIB file for has ALOT of parameters 
 which is organized in a hierarchy must like a file system. Each node 
 in the path can have a few scalars(parameters), but most of them 
 are at the end of a path (a subsystem). 

Typically how deep is this hierarchy? 
How meaningful are the individual names? 
How _long_ are the individual names? 


 My application running against a test system created a MIB file with almost 
 5000 scalars and aprox 500 groups. 
 
 According to the SMIv2 (RFC 2578) descriptor names must be unique and 
 mnemonic. Using a hash is not exactly very mnemonic. 

You could always try a combination of both names and hash values. 
Given a path such as 
/one/two/three/four/five/six/seven/node 

possibilities for the final MIB object name might include: 

{hash}-node (hash of directory path) 
one-{hash}-node (use root in full) 
six-seven-{hash}-node (use selected directories in full) 
ottffss-{hash}-node (use initials of directories) 
ottff-six-seven-{hash}-node (use initials plus selected directories) 
one-ttffs-seven-{hash}-node (ditto) 

In each case, the hash would be probably be calculated over 
/one/two/three/four/five/six/seven in order to keep related scalars together. 

You know what the path heirarchy actually looks like, 
so are best positioned to decide which elements are best 
taken in full, which can be taken using initials, and which 
omitted altogether. 
But that should give you some ideas to work with. 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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


conformance and compliance.

2012-10-25 Thread Benix Vincent


I am in the process of defining a new module entity (SMI_v2) with 800+ objects 
beneath.
Now, I have finished defining the module identity  finished adding objects 
underneath.
But I haven't taken care of the conformance and compliance as I don't know what 
they are.
In regards to this,
#1 Are conformance  compliance must for all module entity on SMI_v2?
#2 What do they actually mean?

Thanks,Vincent.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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


Attaching a MIB Module into a C++ program

2012-10-25 Thread Sverre Moe

I am trying to attach a MIB Module into my C++ program. Making it an AgentX 
subagent. Any help/suggestion is appreciated. 



I followed the MIB Module Tutorial on Net-SNMP, created myself a MIB module 
with 3 scalars. 
Then running the command net-snmp-config --compile-subagent mysnmp mysnmp.c 
Executing the following snmpget localhost -v2c -c public 
1.3.6.1.4.1.40463.1.1.0 
And it output a test string I hard coded into mysnmp MIB module. Worked fine. 



snmpget localhost -v2c -c public 1.3.6.1.4.1.40463.1.1.0 
SNMPv2-SMI::enterprises.40463.1.1.0 = STRING: mysnmp 


I have baked Net-SNMP into my C++ program (trying to make my C++ program an 
AgentX subagent). To check if it worked like an AgentX, I just used the same 
MIB module from my mysnmp I made following the tutorial. Move the code from 
mysnmp.c into myclient.cpp. Compiled fine, ran fine, but did not get any result 
back. 

snmpget localhost -v2c -c public 1.3.6.1.4.1.40463.1.1.0 
SNMPv2-SMI::enterprises.40463.1.1.0 = No Such Object available on this agent at 
this OID 

I have put the following Net-SNMP initialization code in my main: 
main.cpp 
int background = 0; // change this if you want to run in the background. 
int syslog = 0; // change this if you want to use syslog. 

// print log errors to syslog or stderr. 
if (syslog) 
snmp_enable_calllog(); 
else 
snmp_enable_stderrlog(); 

// make us a agentx client. 
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); 

// run in background, if requested. 
if (background  netsnmp_daemonize(1, !syslog)) { exit(1); } 

// initialize tcpip, if necessary. 
SOCK_STARTUP; 

// initialize the agent library. 
init_agent(my-snmp-deamon); 

myclient client; 
client.run(); 

myclient.cpp 
extern C { 
#include net-snmp/net-snmp-config.h 
#include net-snmp/net-snmp-includes.h 
#include net-snmp/agent/net-snmp-agent-includes.h 

void init_vacm_vars(); 
void init_usmUser(); 

Netsnmp_Node_Handler handle_snmp; 
} 

const oid mysnmp_oid[] = { 1,3,6,1,4,1,40463,1 }; 
const oid mysnmpInfo_oid[] = { 1,3,6,1,4,1,40463,1,1 }; 
const oid mysnmpPlacementCountry_oid[] = { 1,3,6,1,4,1,40463,1,2 }; 
con st oid mysnmpCounter_oid[] = { 1,3,6,1,4,1,40463,1,3 }; 



myclient::myclient() : 
_mainloop(Glib::MainLoop::create()) 

{ 

netsnmp_register_scalar_group( 
netsnmp_create_handler_registration(mysnmp, 
handle_snmp, 
group_oid, 
OID_LENGTH(group_oid), 
HANDLER_CAN_RONLY 
), 1, 3); 



//Runs the Main Event Loop 
Glib::signal_idle().connect( 
sigc::bind_return(sigc::mem_fun(*this, myclient::mainloop), true) 
); 
} 

void myclient::run() { 
_mainloop-run(); //Running Main Event Loop 
} 


myclient::mainloop() { 
if (_snmp_ready) { 
agent_check_and_process(1); /* 0 == don't block */ 
} 
} 

int 
handle_snmp(netsnmp_mib_handler *handler, 
netsnmp_handler_registration *reginfo, 
netsnmp_agent_request_info *reqinfo, 
netsnmp_request_info *requests) { 
void* datapointer; 
char buffer[200]; 
int dataint; 
int length = 0; 
u_char type; 

const oid* request_oid = (*reginfo).rootoid; 
if (netsnmp_oid_equals(request_oid, 9, mysnmpInfo_oid, 9) == 0) { //OID_LENGTH( 
mysnmpInfo_oid ) 
strcpy(buffer, mysnmp); 
datapointer = buffer; 
length = strlen(buffer); 
type = ASN_OCTET_STR; 
} else if (netsnmp_oid_equals(request_oid, 9, mysnmpPlacementCountry_oid, 9) == 
0) { 
strcpy(buffer, mysnmp2); 
datapointer = buffer; 
length = strlen(buffer); 
type = ASN_OCTET_STR; 
} else if (netsnmp_oid_equals(request_oid, 9, mysnmpCounter_oid, 9) == 0) { 
dataint = 1234; 
datapointer = dataint; 
length = sizeof(dataint); 
type = ASN_INTEGER; 
} else { 
strcpy(buffer, UNKNOWN_OID); 
datapointer = buffer; 
length = strlen(buffer); 
type = ASN_OCTET_STR; 
} 

switch(reqinfo-mode) { 
case MODE_GET: 
snmp_set_var_typed_value(requests-requestvb, 
type, 
datapointer, 
length); 
break; 

default: 
/* we should never get here, so this is a really bad error */ 
snmp_log(LOG_ERR, unknown mode (%d) in handle_snmp\n, reqinfo-mode ); 
return SNMP_ERR_GENERR; 
} 

return SNMP_ERR_NOERROR; 
} 

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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: website is down?

2012-10-25 Thread Stuart Henderson
On 2012-10-23, Allen Chan allen.c...@five9.com wrote:
 I am unable to reach http://www.net-snmp.org/ in the browser. Ping and nmap=
  shows 80 is open.

This isn't uncommon for sourceforge vhosts from time to time.



--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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


troubleshooting pass-persist feature of SNMP

2012-10-25 Thread Allen Chan
Hi all,

We are trying to figure out how to troubleshoot the pass-persist feature of 
SNMP.
Our NMS is monitoring a bunch of OIDs that goes through pass-persist and perl 
scripts. On the NMS side we continually see network errors, and we see that it 
is all related to OIDs offered by pass-persist.

Is there a way to see throughput, errors, or other troubleshooting information 
on the pass-persist feature?

Thanks,
Allen Chan



CONFIDENTIALITY NOTICE: This e-mail and any files attached may contain 
confidential information of Five9 and/or its affiliated entities. Access by the 
intended recipient only is authorized. Any liability arising from any party 
acting, or refraining from acting, on any information contained in this e-mail 
is hereby excluded. If you are not the intended recipient, please notify the 
sender immediately, destroy the original transmission and its attachments and 
do not disclose the contents to any other person, use it for any purpose, or 
store or copy the information in any medium. Copyright in this e-mail and any 
attachments belongs to Five9 and/or its affiliated entities.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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


PASS OID and C++ SCRIPT

2012-10-25 Thread Hernán Romano
Hello Guys!

 

 I have a problem, It’s a new issue that I cannot figure it out and I
couldn’t find any documentation about this.

 

The situation is this,

   In my snmpd.conf file i have this line:  pass .1.3.6.1.4.1.6147.2.1
/usr/share/cacti/scripts/TDP/binarios/ClearCodeGroup2 

 

Note: ClearCodeGroup2 is a simple C++ script that have been compiled and
its code is this:

 

 #include cstdio

 #include cstdlib

 #include iostream

 #include sstream

 #include string

 #include vector

 #include set

 #include map

 #include fstream

 

   using namespace std;

 

  int main(int argc, char *argv[])

{;

   

cout.1.3.6.1.4.1.6147.2.1\n;

 coutInteger32\n;

cout321224;

 return 0;

   }

 

This little program works EXCELLENT! As you can see:

 

root@cacti:/usr/share/cacti/scripts/TDP/binarios# snmpget -m TDP-MIB -v
2c -c TM_Com_Pub localhost .1.3.6.1.4.1.6147.2.1

TDP-MIB::ClearCodeGroup1 = INTEGER: 321224

 

...but when i try to read the value for the OID from a …/anyfile.txt, 

 

int main(int argc, char *argv[])

{

string comando;

   char valor;

comando=cat …/anyfile.txt | grep \ALL GTP PDP context\ | awk
'{pr$

 

cout.1.3.6.1.4.1.6147.2.1\n;

 coutInteger32\n;

coutcomando;

 return 0;

   }

 

 

 

…the snmpgetnext doesnt work anymore and gives me this error.

 

root@cacti:/usr/share/cacti/scripts/TDP/binarios# snmpget -m TDP-MIB -v
2c -c TM_Com_Pub localhost .1.3.6.1.4.1.6147.2.1

TDP-MIB::PDPContextsNumber = No Such Instance currently exists at this
OID

 

I have test my C++ Script, and it works like i want and return me this:

   root@cacti:/usr/share/cacti/scripts/TDP/binarios# ./ClearCodeGroup2

.1.3.6.1.4.1.6147.2.1

Integer32

321224

 

It's seems that I’m forgetting something!! but i don’t know what. I hope you
can help me out with this.

 

 

Hernán Romano Curo

Network Operation Center (NOC)

Phone: +51 1 6001818 (Opción 4)

Descripción: Descripción: global

 

image001.gif--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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