Count Items

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
dmeiser
Posts: 3
Joined: Mon Jan 30, 2012 10:46 am

Count Items

Post by dmeiser »

On my network, I have several wireless access points deployed that will expose the IP address of any connected clients, but not the number of active clients. I can query a single OID and get all the IP addresses back, each with a unique OID. For example, I query <my OID> and get back <my OID>.###.###.### and the data field will contain the IP address.

I have tried to follow the "Script Data Query Walkthrough" from the documentation wiki, but have been utterly unsuccessful. I can query and get back a result like 1!10 (index!active_clients), but I can't get this to graph successfully.

Is there a simple way to do this - to count the number of rows returned by the SNMP query?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Count Items

Post by gandalf »

dmeiser
Posts: 3
Joined: Mon Jan 30, 2012 10:46 am

Re: Count Items

Post by dmeiser »

gandalf wrote:Please see http://forums.cacti.net/viewtopic.php?f=12&t=30182; does this help?
R.
I looked at this and followed it pretty closely. It did not really help much.

I went back through the original walk through and followed it much more closely. I started from scratch and was able to get this working. I did, however, need to copy and modify the cacti_snmp_walk function because - while I prefer to use PHP's built in SNMP function - the OIDs the device use are non-ascending.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Count Items

Post by gandalf »

Asked our php-snmp guru to have a look
R.
BorisL
Cacti User
Posts: 131
Joined: Sat Mar 31, 2007 9:21 am
Contact:

Re: Count Items

Post by BorisL »

dmeiser wrote:the OIDs the device use are non-ascending.
Do you mean you need to set -Cc for snmpwalk command in order to get all results from subtree?

As for "number of rows returned".
Basically Cacti poller currently has no ability to count OID number in some subtree: this may be rather expensive for poller. Besides, how do you expect poller to count rows when your OID subtree has more than one indexed leaf:

Code: Select all

.1.1 = Name1
.2.1 = value1
.1.2 = Name2
.2.2 = value2
...
?
If digging further, I would like to have poller to retrieve count of OID with matching value and so on and so on.

All this math is a complex pile of logic and I am not sure it should be in poller.
dmeiser
Posts: 3
Joined: Mon Jan 30, 2012 10:46 am

Re: Count Items

Post by dmeiser »

BorisL wrote:Do you mean you need to set -Cc for snmpwalk command in order to get all results from subtree?
That is exactly what I am saying.
BorisL wrote:Basically Cacti poller currently has no ability to count OID number in some subtree: this may be rather expensive for poller. Besides, how do you expect poller to count rows when your OID subtree has more than one indexed leaf:

All this math is a complex pile of logic and I am not sure it should be in poller.
I tend to agree... for complex OIDs that would be problematic. This would never work, for example, for counting the interfaces of a 48 port switch because those would have sub-IDs. I only asked because it seemed like something that might be there.

Is there a way to call cacti-snmp-walk to force cacti-snmp-walk to use NET-SNMP or UCD-SNMP?
BorisL
Cacti User
Posts: 131
Joined: Sat Mar 31, 2007 9:21 am
Contact:

Re: Count Items

Post by BorisL »

dmeiser wrote:Is there a way to call cacti-snmp-walk to force cacti-snmp-walk to use NET-SNMP or UCD-SNMP?
There is a better way I think. You can compile php-snmp code from php svn trunk (php-snmp in trunk is backwards compatible downto php5.2), install my cummulative patch and add one line to cacti_snmp_session() function setting oid_increasing_check property to false.
This will leave Cacti with php-snmp module (trunk one is much faster :) and will fix your problem with -Cc option.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest