Home Directory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory

aradovits

Reviews(1)
byaradovits, July 8, 2016
Optimization: No tmp file needed
In retrieve_status_page() function change this: retrPage = urllib.urlretrieve(statusPage, '/tmp/server-status.log')
to this one: return urllib.urlopen(statusPage)

and modidy parse_status_page() function to parse_status_page(data):
# file = open('/tmp/server-status.log', 'r')
line = data.readline()
...
line = data.readline()

and finally in the main function add this line:
resParse = parse_status_page(retrieve_status_page())
so comment this lines:
#retrieve_status_page()
#resParse = parse_status_page()

Or you can see it:
https://gist.github.com/kajla/bf94e9c520f5cc706eb2e831af17129c