LDNS 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

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?

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

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’]

… );

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’}]}}

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

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

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”

Ok, now I know why I’m confused - I no absolutely nothing about python. Any python devs out there want to help out here?

-Joe

Second part of the code (print “%s [%s] %s” % (lhs, tokens[index], rhs) ) works if we just use LHS instead of the full list.

I think we are good. Thanks a bunch for active response =)