Example #1
0
import matplotlib.pyplot as plt
from hist import Histogram


h = Histogram()
most_used_servers = ["Apache", "nginx", "Oracle", "lighttpd", "Microsoft-IIS"]
with open("stripped_servers.txt", 'r') as f:
    data = f.read().split("\n")
for serv in data:
    for server in ["Apache", "nginx", "Oracle", "lighttpd", "Microsoft-IIS"]:
        if server in serv:
            h.add(server)

keys = list(h.get_dict().keys())
X = list(range(len(keys)))
values = list(h.get_dict().values())

plt.bar(X, list(values), width=1)
plt.xticks(X, keys)
plt.xlabel("Server")
plt.ylabel("Count")
ax = plt.subplot(111)
plt.title("Most used servers for BG sites")
plt.savefig("histogram.png")
Example #2
0
}
h = Histogram()

with open("result.txt", "r") as f:
    lines = f.read().split("\n")

    for line in lines:
        for server in servers:
            if server in line.lower():
                count = line.split(":")[1]
                count = int(count)

                for _ in range(count):
                    h.add(servers[server])

h = h.get_dict()
print(h)
keys = list(h.keys())
values = list(h.values())

X = list(range(len(keys)))

plt.bar(X, list(h.values()), align="center")
plt.xticks(X, keys)

plt.title(".bg servers")
plt.xlabel("Server")
plt.ylabel("Count")

plt.savefig("histogram.png")
Example #3
0
}
h = Histogram()

with open("result.txt", "r") as f:
    lines = f.read().split("\n")

    for line in lines:
        for server in servers:
            if server in line.lower():
                count = line.split(":")[1]
                count = int(count)

                for _ in range(count):
                    h.add(servers[server])

h = h.get_dict()
print(h)
keys = list(h.keys())
values = list(h.values())

X = list(range(len(keys))) 

plt.bar(X, list(h.values()), align="center")
plt.xticks(X, keys)

plt.title(".bg servers")
plt.xlabel("Server")
plt.ylabel("Count")

plt.savefig("histogram.png")