| Server IP : 104.21.58.74 / Your IP : 216.73.216.213 Web Server : LiteSpeed System : Linux s12482.usc1.stableserver.net 5.14.0-570.32.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 6 11:30:41 EDT 2025 x86_64 User : snownico ( 1231) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/sp_scripts/ |
Upload File : |
#!/usr/bin/env python3
# Fetching Apache workers per domain utilizing curl and mod_status
# Based on lstop.py by Tsvetan Gerov
# aptop.py by Nikolay Ilchev
#
import requests
import re
from collections import defaultdict
def main():
response = requests.get(
'http://127.0.0.1/whm-server-status',
headers={'User-Agent': 'A2 User Agent OPS TEAM/4147 Gecko/20190813'}
)
content = response.text
response.raise_for_status()
content = response.text
domain_counts = defaultdict(int)
for match in re.finditer(r'<td nowrap>([^<:]+)(?::\d+)?</td><td nowrap>', content):
vhost = match.group(1).strip()
domain_counts[vhost] += 1
sorted_domains = sorted(domain_counts.items(), key=lambda x: x[1])
print("| {:<70s} | {:>8s} |".format("Domain", "Workers"))
print("|" + "-" * 72 + "|" + "-" * 10 + "|")
for domain, count in sorted_domains:
print("| {:<70} | {:8d} |".format(domain, count))
print("|" + "-" * 72 + "|" + "-" * 10 + "|")
print("| {:<70s} | {:>8s} |".format("Domain", "Workers"))
if __name__ == '__main__':
main()