Cleanup monitor.py

parent bb51f5da
......@@ -28,15 +28,12 @@
import datetime
import os
import time
import resource
from time import strftime
import logging
import sys
from lxml import etree as ElementTree
import platform
import psutil
from optparse import OptionParser
import tempfile
import sqlite3.dbapi2 as sqlite3
#define global variable for log file
......@@ -59,7 +56,6 @@ class GenerateXML(object):
self.element_tree = element_tree
self.path_database = path_database
self.path_xml = path_xml
#self.log_file = log_file
def dump_xml(self):
"""This func read data from database and through
......@@ -286,7 +282,7 @@ class SlapReport(object):
cursor.execute("UPDATE data set reported='1' WHERE time=?", (row[5],))
conn.commit()
except Exception, e:
except Exception:
if log_file:
logging.info("ERROR : Unable to connect to % at %s"
% (self.ssh_parameters['ip'], strftime("%Y-%m-%d at %H:%m")))
......@@ -383,7 +379,7 @@ def run_slapreport():
except IOError:
if log_file:
logging.info("ERROR : process with pid : %s watched by slap monitor exited too quickly at %s"
% (self.proc.pid, strftime("%Y-%m-%d at %H:%m")))
% (proc.pid, strftime("%Y-%m-%d at %H:%m")))
sys.exit(1)
if log_file:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment