Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

creating persistent directory

417 views
Skip to first unread message

Harish Jadhav

unread,
Jan 12, 2012, 1:01:20 AM1/12/12
to
Hi,

I have compiled netsnmp 5.7.1 for windows version and I am using
netsnmp.dll for client side programming.(netsnmp.dll placed in my
application directory)

I am loading mibs from my application directory in the code using
setenv(mibdirs,path, 0) but it is creating the index files in
c:\\usr\snmp\persist directory.
In ealier version, it is used to create the index in folders where mibs
are present( which is my appliation dir) but now it is creating a new
directory c:\\usr\snmp\persist.
How can I override this, please suggest.

--
Thanks& Regards,
Harish

harish.vcf

Bart Van Assche

unread,
Jan 12, 2012, 2:10:26 AM1/12/12
to
Have you already tried to set the environment variable SNMP_PERSISTENT_DIR ?

Bart.

------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Net-snmp-users mailing list
Net-snm...@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Harish Jadhav

unread,
Jan 12, 2012, 2:38:50 AM1/12/12
to

No, I have not set the environment variable SNMP_PERSISTENT_DIR. In earlier version also ,
I never used to. Only difference I noticed is in old version, it creates .index file in same directory where my mibs are present
but in newer version it creates by name 0, 1 in c:\usr\snmp\persist and some times if these files are empty
( dont know the reason), my executables are crashing.


On 1/12/2012 12:40 PM, Bart Van Assche wrote:
> On Thu, Jan 12, 2012 at 7:01 AM, Harish Jadhav<har...@tecknodreams.com> wrote:
>> I have compiled netsnmp 5.7.1 for windows version and I am using netsnmp.dll
>> for client side programming.(netsnmp.dll placed in my application directory)
>>
>> I am loading mibs from my application directory in the code using
>> setenv(mibdirs,path, 0) but it is creating the index files in
>> c:\\usr\snmp\persist directory.
>> In ealier version, it is used to create the index in folders where mibs are
>> present( which is my appliation dir) but now it is creating a new directory
>> c:\\usr\snmp\persist.
>> How can I override this, please suggest.
> Have you already tried to set the environment variable SNMP_PERSISTENT_DIR ?
>
> Bart.
>
>
>

--
Thanks& Regards,
Harish

harish.vcf

Dave Shield

unread,
Jan 12, 2012, 3:26:43 AM1/12/12
to
On 12 January 2012 06:01, Harish Jadhav <har...@tecknodreams.com> wrote:
> I have compiled netsnmp 5.7.1 for windows version

> I am loading mibs from my application directory in the code using
> setenv(mibdirs,path, 0) but it is creating the index files in
> c:\\usr\snmp\persist directory.

Yes - that is correct.

> In ealier version, it is used to create the index in folders where mibs are
> present( which is my appliation dir) but now it is creating a new directory
> c:\\usr\snmp\persist.

This change was introduced about five years ago (see SVN revision 15693)
although the first release that used this approach was 5.5, which came out
in mid 2009.

The relevant log message is:
"Maintain MIB directory index files under /var/net-snmp
(in line with File Hierarchy Standard specifications)
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=389434
and discussion "MIBs in net-snmp" on coders list (Oct 2006)"


The problem was that under Unix-style systems (which is the traditional
focus of this problem), the MIB files could easily be present on a read-only
partition, so it might not be possible to create the .index files there.

Given that these files are only ever used by the library, which doesn't
actually care where they reside - the cleanest solution was to move
them to the persistent directory (which is necessarily writable).


> How can I override this, please suggest.

There's not really an easy way to change this.
The simplest would probably be to set the persistent directory
(either globally as Bart suggests, or within the application).
If this is being done in a client application which has no real
use for the persistent directory at all, then it *might* work to
set the persistent directory to be on a non-existent drive, in
which case it would simply fail to create the .index files at all.
I haven't tested this, but it ought to work.


Alternatively - what is the problem about leaving the index
files in their new location? I know it's a change from the old
(5.[0-4].x) behaviour, but does it really matter?

Dave

Harish Jadhav

unread,
Jan 12, 2012, 4:09:55 AM1/12/12
to
Thanks Dave.

The thing is, due to some files under c:\usr\snmp\persist\mib_indexes,
it was causing my application to crash at snmp_init("myapps"). I am
loading mibs from
two directories. In persistent folder I found 4 index files which
suppose to be 2 as I am loading only two directories.

So, I deleted the folder c:\usr and restarted the application. It
created the c:\usr\snmp\persist\mib_indexes folder again with 2 files.
Then application seems to work fine.
I am wondering what could be the reason for crash and why it created 4
files at the first instance.

Please help me to understand.

Thanks
Harish
Thanks& Regards,
Harish

harish.vcf

Dave Shield

unread,
Jan 12, 2012, 4:16:23 AM1/12/12
to
On 12 January 2012 09:09, Harish Jadhav <har...@tecknodreams.com> wrote:
> In persistent folder I found 4 index files which suppose to be 2
> as I am loading only two directories.

> I am wondering .... why it created 4 files at the first instance.

Pass.
If you look at these index files (which are simply text files),
then the first line will tell you which MIB directory it refers to.
Maybe the list of these folders will give some indication as to
where these extra entries come from.


> I am wondering what could be the reason for crash

It's a bit difficult to answer that, without knowing something about
the contents of the erroneous index files.

Harish Jadhav

unread,
Jan 12, 2012, 4:22:41 AM1/12/12
to
Thank you Dave. Unfortunately I deleted the folder without taking back
up. I will try reproduce the behavior and share the
analysis with you.

On 1/12/2012 2:46 PM, Dave Shield wrote:
> On 12 January 2012 09:09, Harish Jadhav<har...@tecknodreams.com> wrote:
>> In persistent folder I found 4 index files which suppose to be 2
>> as I am loading only two directories.
>> I am wondering .... why it created 4 files at the first instance.
> Pass.
> If you look at these index files (which are simply text files),
> then the first line will tell you which MIB directory it refers to.
> Maybe the list of these folders will give some indication as to
> where these extra entries come from.
>
>
>> I am wondering what could be the reason for crash
> It's a bit difficult to answer that, without knowing something about
> the contents of the erroneous index files.
>
> Dave
>
>
>

--
Thanks& Regards,
Harish

harish.vcf

Harish Jadhav

unread,
Jun 28, 2012, 2:07:17 AM6/28/12
to
Hello All,

Using SNMP_PERSISTENT_DIR variable, I am setting the directory path of
my wish for 2 MIB directories. The variable is set in multiple processes
and all processes will start almost at the same time.

Most of the time everything works fine as it creates the mib files under
the directory which
I specified by 0 and 1. But sometimes it tries to create in
c:\usr\snmp\persist\mib_indexes and during this it creates with indexes
0,1, 2, 3 (May be as multiple processes started at same time,
it is creating multiple directories where 0 &2 are having same content,
1&3 are having same content) and it leads to crash(segmentation
violation) one of the process.

Please let me know if any clue on this, as I have set this variable for
all the processes.

Thanks
Harish



On 1/12/2012 2:39 PM, Harish Jadhav wrote:
> Thanks Dave.
>
> The thing is, due to some files under c:\usr\snmp\persist\mib_indexes,
> it was causing my application to crash at snmp_init("myapps"). I am
> loading mibs from
> two directories. In persistent folder I found 4 index files which
> suppose to be 2 as I am loading only two directories.
>
> So, I deleted the folder c:\usr and restarted the application. It
> created the c:\usr\snmp\persist\mib_indexes folder again with 2
> files. Then application seems to work fine.
> I am wondering what could be the reason for crash and why it created 4
> files at the first instance.
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
0 new messages