Forum Discussion
Haarith_Devaraj
Nimbostratus
Feb 25, 2009LDNS Stats Retrieval
Hi All,
We are trying to retrieve all the records that show up on
Overview -> Statistics -> Local DNS.
The SDK points us at this
GtmLdnsStatistics get_gtm_ldns_statistics(
in String [] ldns_ips
);
This returns only the IP's specified.
Is there a way to retrieve it all at one time ( via icontrol ) or is there some wildcard character we can use in this api call itself to generate the full list.
Thanks,
Haarith
12 Replies
- The parameter allows you to specify which LDN's you want to retrieve the stats for. If you want all the stats, then you'll want to pass the list of LDNS servers you want to query then you'll get back them all. Make sense?
- Haarith_Devaraj
Nimbostratus
Hi Joe,
Thanks for the reply. The problem we face is that we dont know what our top LDNS ip is going to be. It keeps changing every day. If we look at the GUI, we can see this clearly.
It shows all existing ips without us having to request anything specific. We want something like that.
Is there get list() command or something that we can use to populate this same list from icontrol. - I actually don't know which method is used to return that list of IPs. I'll have to check it out and get back to you.
-Joe - Haarith_Devaraj
Nimbostratus
Hi,
we passed this and it seems to have worked. Not sure how this translated to a '*'. Just curios if this is the right way to do it.
>>> b.System_Statistics.get_gtm_ldns_statistics(
... ldns_ips = ['0.0.0.0']
... ); - Haarith_Devaraj
Nimbostratus
Hi Joe,
When we try to get multiple iP's, we end up with a result like the one attached below. It falls into a single row. For our tracking we just need the hitcount and ip. Is there a way to format the message to show the vlaue after 'low' and the value after 'ldns_ip'. Just curios , thanks
{'return': {'time_stamp': {'hour': 21, 'month': 2, 'second': 29, 'year': 2009, '
day': 27, 'minute': 38}, 'statistics': [{'city': 'Unknown', 'statistics': [{'tim
e_stamp': 0, 'type': 'STATISTIC_GTM_LDNS_REQUESTS', 'value': {'high': 0, 'low':
718}}], 'ldns_ip': '64.212.90.163', 'country': 'UNITED STATES', 'last_accessed':
1235770459, 'state': 'Unknown', 'continent': 'North America'}, {'city': 'Unknow
n', 'statistics': [{'time_stamp': 0, 'type': 'STATISTIC_GTM_LDNS_REQUESTS', 'val
ue': {'high': 0, 'low': 718}}], 'ldns_ip': '64.212.90.163', 'country': 'UNITED S
TATES', 'last_accessed': 1235770459, 'state': 'Unknown', 'continent': 'North Ame
rica'}]}} - Haarith_Devaraj
Nimbostratus
Something like this seems to work.
for index in range( len(tokens) ):
if keyword.match( tokens[index] ):
start = max(0, index-window)
finish = min(len(tokens), index+window+1)
lhs = string.join( tokens[start:index] )
rhs = string.join( tokens[index+1:finish] )
print "%s [%s] %s" % (lhs, tokens[index], rhs) - Could you post your code and I'll see what I can do. I'm not sure what the output you are referring to is coming from. It looks like a default formatting in perl without accessing the returned array elements.
-Joe - Haarith_Devaraj
Nimbostratus
Thanks.
If we send this string:
>>> b.System_Statistics.get_gtm_ldns_statistics(
... ldns_ips = ['0.0.0.0']
... );
We get data like this
{'return': {'time_stamp': {'hour': 21, 'month': 2, 'second': 29, 'year': 2009, '
day': 27, 'minute': 38}, 'statistics': [{'city': 'Unknown', 'statistics': [{'tim
e_stamp': 0, 'type': 'STATISTIC_GTM_LDNS_REQUESTS', 'value': {'high': 0, 'low':
718}}], 'ldns_ip': '64.212.90.163', 'country': 'UNITED STATES', 'last_accessed':
1235770459, 'state': 'Unknown', 'continent': 'North America'}, {'city': 'Unknow
n', 'statistics': [{'time_stamp': 0, 'type': 'STATISTIC_GTM_LDNS_REQUESTS', 'val
ue': {'high': 0, 'low': 718}}], 'ldns_ip': '64.212.90.163', 'country': 'UNITED S
TATES', 'last_accessed': 1235770459, 'state': 'Unknown', 'continent': 'North Ame
rica'}]}}
this appears as a single row, so couldnt format it to display only hit count and Ip address.
Searched online and came up with something like this that works. It needs excel to clean up though.
a = open(file)
text = a.read()
a.close()
tokens = text.split() split on whitespace
keyword = re.compile(target, re.IGNORECASE)
for index in range( len(tokens) ):
if keyword.match( tokens[index] ):
start = max(0, index-window)
finish = min(len(tokens), index+window+1)
lhs = string.join( tokens[start:index] )
rhs = string.join( tokens[index+1:finish] )
print "%s [%s] %s" % (lhs, tokens[index], rhs) - Maybe I should have clarified my question. How exactly are you sending the "b.System_Statistics...." string? What does that mean? It looks like perl code using the SOAP::Lite library but I'm not sure. Are you ssh'ing the string? And then you said you "get data". How exactly are you getting the data?
If you are using Perl and SOAP::Lite, you can use the response object and then cast it to an array and iterate through the elements directly.
You never mentioned your programming language or how you are sending/receiving this data so I just need some clarification.
-Joe - Haarith_Devaraj
Nimbostratus
I am using python to get this..
import pycontrol.pyControl as pyControl
b = pyControl.BIGIP(hostname = 'x', username = 'username', password = 'password',
wsdl_files = ['System.Statistics']
)
d = b.System_Statistics
try:
s = d.get_gtm_ldns_statistics(
ldns_ips = ['0.0.0.0']
);
print s
except: print "No LDNS ip found"
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
