question on mib2c, tables, etc.

2012-05-17 Thread Michael Dorin
I am trying to make a subagent for the UPS-MIB.
I generate the code with  mib2c -c mib2c.conf upsMIB
I select 1) ucd-snmp style code


I get upsMIB.c

I am trying to fill in var_upsAlarmTable, but am running into lots of
little errors.  Does anybody havae
any example code I might be able to review?

basically, how might I fill in:
  switch(vp->magic) {
case UPSALARMID:
VAR = VALUE;/* XXX */
return (u_char*) &VAR;
case UPSALARMDESCR:
VAR = VALUE;/* XXX */
return (u_char*) &VAR;
case UPSALARMTIME:
VAR = VALUE;/* XXX */
return (u_char*) &VAR;
default:
  ERROR_MSG("");

Thank you!  Any advice would be appreciated.
-Mike

--
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/
___
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: SNMP Agent V2C community string problem

2012-05-17 Thread Dave Shield
On 17 May 2012 13:58, George Rubin  wrote:
> ./configure ... --with-out-mib-modules=" mibII/vacm ..."

That's the module that is concerned with access control - it's
really an essential part of the agent.
  I'd need to check the code in detail, but I suspect that
omitting this will allow access to everything.

> I want it to be as light as possible so I've included my own MIB only.

If you want to configure the agent to be as small as possible,
try starting with

configure --enable-mini-agent

and then use '--with-mib-modules' to add your new MIB.
That way you should remove all the non-essential bits,
but not the vital elements.

Dave

--
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/
___
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


SNMP Agent V2C community string problem

2012-05-17 Thread George Rubin
Hello,

I've built net-snmp 5.7.1 for powerpc linux (eldk 5.1).
I've configured it with the following line:


./configure --host=powerpc-linux --build=i686-pc-linux-gnu
--target=ppc-denx-linux --program-prefix= --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include/net-snmp --libdir=/usr/lib
--libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com
--mandir=/usr/share/man --infodir=/usr/share/info --with-endianness=big
--disable-privacy --disable-des --disable-md5 --disable-debugging
--disable-snmpv1 --without-openssl --without-rpm --disable-embedded-perl
--with-perl-modules=no --disable-manuals --disable-scripts --disable-mibs
--disable-mib-loading --disable-applications --disable-deprecated
--enable-mini-agent --with-out-transports="TCP Callback Unix Alias"
--with-default-snmp-version="2c" --enable-shared --with-cflags="-O2
-fsigned-char" --with-ldflags= --with-logfile=/var/log/snmpd.log
--with-persistent-directory=/var/net-snmp
--with-out-mib-modules="examples/ucdDemoPublic snmpv3mibs mibII/vacm
mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars
mibII/vacm_conf" --with-pic --with-mib-modules="shaon_amid"
--with-sys-location="x" --with-sys-contact=a...@a.com

I want it to be as light as possible so I've included my own MIB only.

The problem is, that the agent answers to all requests regardless of the
community string, whether it is right or wrong.
this is my snmpd.conf

#
# snmpd.conf
#

agentaddress udp:161

com2sec wsReadOnlyUser  default public
com2sec wsReadWriteUser default private

group   wsReadOnlyGroup  v2c wsReadOnlyUser
group   wsReadWriteGroup v2c wsReadWriteUser

viewall included .1

access  wsReadOnlyGroup""  any   noauthexact  all
none   none
access  wsReadWriteGroup   ""  any   noauthexact  all
allnone

trap2sink 10.0.0.1
trap2sink 10.0.0.2

sysDesc xxx
sysLocation xxx
sysContact xxx



Best Regards,
George Rubin
--
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/___
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: Problem on return value of netsnmp python bindings

2012-05-17 Thread Dave Shield
On 17 May 2012 03:16, 胡小根  wrote:
> I am now using net-snmp python bindings. There comes a problem that the
> function netsnmp.snmpwalk() returns only oid values, but do not return index.

No - the function snmpwalk returns a set of 4-tuples:
   var.tag  (the object OID)
   var.iid   (the index)
   var.val  (the value)
   var.type (the type)

Have a look at 'python/netsnmp/tests/test.py' for examples.


> For example, if I want to poll ifDescr(1.3.6.1.2.1.2.2.1.2),
> netsnmp.snmpwalk() only return a tuple containing values but not ifIndex.

Try the following:

import netsnmp

vars =  netsnmp.VarList( netsnmp.Varbind('ifDescr'))
res  = netsnmp.snmpwalk( vars, Version = 1, DestHost =
'localhost', Community = 'public' )
for var in vars:
print "ifIndex value = ", var.iid, "\tifDescr value =", var.val


> I'm wondering whether I didn't get netsnmp work well or it's the bindings' 
> problem.

It's not the bindings' problem.

Dave

--
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/
___
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: Problem installing a MIB

2012-05-17 Thread Dave Shield
On 16 May 2012 10:05, Jérôme BELLEGARDE
 wrote:
> And when I try : /usr/local/sbin/snmpd -f -L -d -p 
>
> I got :
>
> Warning: no access control information configured.
>  (Config search path: 
> /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/dialog/.snmp)


How have you configured the access control for this agent?
What is in your snmpd.conf file?

More particularly, *where* is your snmpd.conf file?

Note the list of locations that the agent is looking in.
Do you have a suitable snmpd.conf file in any of these places?
  (Hint: the answer is almost certainly "no")

Remember that you are now running a self-compiled version of
the agent, and not a vendor-supplied one.   So the agent will be
looking in a different set of locations for the config files.
It won't automatically pick up the original snmpd.conf files.

This is covered in the FAQ

Dave

--
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/
___
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: EBU Tech 3323: SNMP for broadcasting transmitters

2012-05-17 Thread Dave Shield
On 17 May 2012 08:03, Giuseppe Modugno  wrote:
> I found a technical document (EBU Tech 3323) that talks about SNMP
> implementation on broadcasting transmitters:
>
> http://www.ebu.ch/CMSimages/fr/tec_doc_t3323-2008_tcm7-58188.pdf
>
> One request appears strange:
>
> "Time stamps in TRAPS must be synchronisable with a reference time (e.g.
> NTP)."
>
>  From what I know, there isn't a real timestamp in TRAPS, but only the
> sysUpTime (number of seconds from the last start up of the agent). In
> other words, in TRAPS we found only a relative time and not absolute time.
>
> So my question is: what is the reason to syncronize the clock of the
> system running the agent if it will not be used in SNMP?

I would agree - that requirement sounds strange.
I suggest you ask the people responsible for this document
about the thinking behind it.

This mailing list is specifically for support of the Net-SNMP suite.
Individual members may have some knowledge of the development
of the SNMP protocol over the years,  but we don't have any special
information about other groups' use of SNMP, or their design processes.

If you have a question about an EBU document, try asking the EBU!

Dave

PS: If push came to shove, you could always include the hrSystemDate.0
  varbind as part of the notification payload.  That would link the trap
  with an absolute time, as required.

--
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/
___
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


Problem on return value of netsnmp python bindings

2012-05-17 Thread 胡小根
Hi net-snmp developers:
I am now using net-snmp python bindings. There comes a problem that the 
function netsnmp.snmpwalk() returns only oid values, but do not return index. 
For example, if I want to poll ifDescr(1.3.6.1.2.1.2.2.1.2), netsnmp.snmpwalk() 
only return a tuple containing values but not ifIndex. 
I'm wondering whether I didn't get netsnmp work well or it's the bindings' 
problem.
Regards,
Xiaogen Hu

--
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/___
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


EBU Tech 3323: SNMP for broadcasting transmitters

2012-05-17 Thread Giuseppe Modugno
I found a technical document (EBU Tech 3323) that talks about SNMP 
implementation on broadcasting transmitters:

http://www.ebu.ch/CMSimages/fr/tec_doc_t3323-2008_tcm7-58188.pdf

One request appears strange:

"Time stamps in TRAPS must be synchronisable with a reference time (e.g. 
NTP)."

 From what I know, there isn't a real timestamp in TRAPS, but only the 
sysUpTime (number of seconds from the last start up of the agent). In 
other words, in TRAPS we found only a relative time and not absolute time.

So my question is: what is the reason to syncronize the clock of the 
system running the agent if it will not be used in SNMP?


--
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/
___
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