Pergunta

I would like to define usernames (or uids) of users currently logged into the remote hosts with static IP addresses. Of course there's a lot of ways to work it out (for instance - using PKI and sshd), but i prefer SNMP service.

I have seen some examples of this problem, something like this (from here, for ArubaOS):

snmpbulkwalk -v 2c -c secure 10.1.30.9 .1.3.6.1.4.1.14823.2.2.1.4.1.2.1.3

I am trying to implement this approach on Python and getting an error:

In [33]: import netsnmp

In [34]: oid = netsnmp.Varbind("nUserName")

In [35]: result = netsnmp.snmpget(oid, Version = 2, DestHost="localhost", Community="public")
error: get: unknown object ID (nUserName)

What am I doing wrong? Using RHEL 6.4, Python 2.6.

Thank you.

Foi útil?

Solução

That SNMP variable is enterprise-specific (.1.3.6.1.4.1) and specifically for an Aruba SNMP agent (hence the OID 14823).

To do this for your particular scenario you'd need your Linux SNMP agent to return the same type of data, and you should inspect the corresponding MIB.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top