k-sone / snmpgo

snmpgo is a golang implementation for SNMP
MIT License
133 stars 48 forks source link

Read/Write Community Can't Configure Configured to be different? #26

Open ZaneXo opened 4 years ago

ZaneXo commented 4 years ago

When I read and write nodes, I need to configure the read and write communities to different values, but in this package, only the read-write communities can be set to the same value. Is there a solution?

k-sone commented 4 years ago

How about creating multiple instances in different communities (but same agent address) and using them?

ro, err := snmpgo.NewSNMP(snmpgo.SNMPArguments{
                Version:   snmpgo.V2c,
                Address:   "192.168.1.1:161",
                Community: "public",
})

...

rw, err := snmpgo.NewSNMP(snmpgo.SNMPArguments{
                Version:   snmpgo.V2c,
                Address:   "192.168.1.1:161",
                Community: "private",
})
ZaneXo commented 4 years ago

First,Thanks!But Sorry, there is a problem with my statement. What I want to say is that when I create a V2C server, I want the read-write community to be different. And when clinet comes to visit me, the community is different. For example,now I'm Snmp Server,When Client GetRequest will use the community is public, and SetRequest will use the community is private!