import time, datetime from otomat.conf import conf from otomat.logs import log as logging from otomat.plugins import rrdtool_data_collector from otomat.plugins import rrdtool_drafting from otomat.plugins import shell_cmd as shell config = conf.otomat_conf('/etc/otomat/otomat.cnf') logfile = config.report_log() logdir = config.server_logdir() if not os.path.exists(logdir): os.makedirs(logdir, 0o755) os.chdir(logdir) logging.set_logger(filename=logfile, mode='a') def main(argv=sys.argv[1:]): t = rrdtool_data_collector.rrdtool_collector(argv) garph_day = rrdtool_drafting.graph_rrdtool(argv) garph_week = rrdtool_drafting.graph_rrdtool(argv) garph_month = rrdtool_drafting.graph_rrdtool(argv) logging.info( ("The otomat-report-server has been launched successfully !!!")) while True: t.rrdb() t.rrdb_update() # now is 0 n = time.localtime(time.time()) now = str(n.tm_hour) + str(n.tm_min)
from otomat.plugins import network from otomat.plugins import hostname from otomat.plugins import login_user from otomat.plugins import ip_address from otomat.logs import log as logging config = conf.otomat_conf('/etc/otomat/otomat.cnf') logfile = config.client_log() logdir = config.client_logdir() if not os.path.exists(logdir): os.makedirs(logdir,0o755) #print logfile #print logdir os.chdir(logdir) logging.set_logger(filename =logfile, mode = 'a') # def os_release(): s = [] f = open ('/etc/issue') s = f.read() return s.split()[0] ''' def os_release_centos(): s = [] f = open('/etc/redhat-release') s = f.read() return s.split()[0] ''' class active_agent: