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 g...
Haarith_Devaraj
Nimbostratus
Feb 27, 2009Thanks.
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)
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