Forum Discussion
DevBabu_124276
Nimbostratus
May 16, 2016Can someone from DEVCENTRAL fix this or point me to right direction
I am trying to see statistics type from page
https://devcentral.f5.com/wiki/iControl.Common__Statistic.ashx
that links to
https://devcentral.f5.com/wiki/iControl.Common__StatisticType...
DevBabu
Cirrus
May 17, 2016Thanks JOE. Indeed it was an effort, finally I found the SSL statistics in
LocalLB.ProfileClientSSL.get_statistics_by_virtual
I have written a script to get SSL traffic statistics. Hope this helps if they are considering to upgrade to 11.5.x or higher or find the clientssl profile being used in the virtual server.
def get_virtuals(obj):
try:
return obj.LocalLB.VirtualServer.get_list()
except Exception, e:
print e
def get_virtual_profiles(obj):
try:
virtual = get_virtuals(obj)
profiles = obj.LocalLB.VirtualServer.get_profile(virtual)
return virtual, profiles
except Exception, e:
print e
def get_virtual_client_ssl_statistics(obj, profile,virtual):
try:
statistics = obj.LocalLB.ProfileClientSSL.get_statistics_by_virtual([profile], [[virtual]])
return statistics
except Exception, e:
print e
def return_true_types(ssl_type):
allowed_types = ["STATISTIC_SSL_PROTOCOL_SSLV2", "STATISTIC_SSL_PROTOCOL_SSLV3", "STATISTIC_SSL_PROTOCOL_TLSV1", "STATISTIC_SSL_PROTOCOL_TLSV1_1", "STATISTIC_SSL_PROTOCOL_TLSV1_2"]
if ssl_type in allowed_types:
return True
if __name__ == "__main__":
import bigsuds
import getpass
import sys
import os
if len(sys.argv)< 3:
print ("Usage %s ip_address username" % sys.argv[0])
sys.exit()
a = sys.argv[1:]
print ("\nHey %s, please enter your password below.\n" %a[1])
upass = getpass.getpass()
try:
b = bigsuds.BIGIP(
hostname = a[0],
username = a[1],
password = upass,
)
except Exception, e:
print (e)
Files
file_name = a[0] +".csv"
path_to_folder= os.getcwd()
path_to_file = path_to_folder +"/"+ file_name
if (os.path.isdir(path_to_folder)):
if(os.path.exists(path_to_file)):
try:
os.remove(path_to_file)
data_file = open(path_to_file, 'a')
except Exception, e:
print (e)
else:
data_file = open(path_to_file, 'a')
virtual, profiles = get_virtual_profiles(b)
combined = zip(virtual, profiles)
for x in combined:
for y in x[1]:
if y["profile_type"] == "PROFILE_TYPE_CLIENT_SSL":
clientssl_profile = y["profile_name"]
print x[0] + " " + clientssl_profile
data_file.write(x[0] + ",")
data_file.write(clientssl_profile + ",")
print "============================="
statistics = get_virtual_client_ssl_statistics(b, clientssl_profile, x[0])
for iter in statistics["statistics"][0][0]:
if return_true_types(iter["type"]):
data_file.write(str(iter["value"]["high"]) + "," + str(iter["value"]["low"]) + ",")
print iter["type"] + " " + str(iter["value"]["high"]) + " " + str(iter["value"]["low"])
data_file.write("\n")
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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