Login  
Search All Forums
Dart Home | PowerSNMP for .NET | Custom Development Reply | PowerSNMP for .NET Topics | Forums   
AuthorForum: PowerSNMP for .NET
Topic: Increment Agent Counters
neutroz

From: Roseville, MN USA
Posts: 7
Member Since: 02/09/06
posted May 14, 2009 2:21 PM

Do you have a sample of how to increment a SimpleType counter?

Dart.PowerSNMP.SimpleType.Counter myAgentPollingErrors = new Dart.PowerSNMP.SimpleType.Counter(0);
Variable varAgentPollingErrors = new Variable("1.3.6.1.4.1.1977.4", myAgentPollingErrors);
Dart.PowerSNMP.Agent myAgent = new Dart.PowerSNMP.Agent();
myAgent.Variables.Add(varAgentPollingErrors);
Jason Farrar (Admin)

From: Oneida, NY USA
Posts: 223
Member Since: 07/24/07

Extra Support Options
Custom Application Development

posted May 18, 2009 3:43 PM

You just need to set the variable, so something along the lines of:
      myAgent.Variables["1.3.6.1.4.1.1977.4"].Value = new Dart.PowerSNMP.SimpleType.Counter((long.Parse(myAgent.Variables["1.3.6.1.4.1.1977.4"].Value.ToString())+1).ToString())

[Edit]

Or this:

myAgent.Variables["1.3.6.1.4.1.1977.4"].SetValue(long.Parse(myAgent.Variables["1.3.6.1.4.1.1977.4"].Value.ToString())+1)

If you look at the agent settings class in the agent sample you can see how we set the variables in that sample.

Hope this helps!
neutroz

From: Roseville, MN USA
Posts: 7
Member Since: 02/09/06
posted May 22, 2009 10:28 AM

Thank you - I think I can work it out using these examples!
Reply | PowerSNMP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX