H
Harlin Seritt
from utilities import *
from extractor import *
import time
import os
print 'Running AgentPing at '+time.asctime()
confFile = '../conf/AgentPing/AgentPing.conf'
ex = extractor(confFile)
names = ex.array('name')
comments = ex.array('comment')
ips = ex.array('ip')
counts = ex.array('count')
thresholds = ex.array('threshold')
alarms = ex.array('alarm')
levels = ex.array('level')
records = ex.array('record')
plogger = Logger('../logs/AgentPing.log')
for name,comment,count,ip,threshold,alarm,level,record in
zip(names,comments,counts,ips,thresholds,alarms,levels,records):
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
print msg
plogger.loggit(msg)
line = 'ping -n '+count+' '+ip
try:
data = os.popen(line).readlines()
time = data[-1].split()[-1][:-2]
except:
msg = 'AGENT FAILURE: Unable to run ping on '+ip+' for unknown
reason.'
print msg
msg += 'Error created at '+time.asctime()
time = float(threshold)*2
plogger.loggit(msg)
createAlarm(name, comment, ip, threshold, level, msg)
Whenever I run this I get:
Traceback (most recent call last):
File "agentPing.py", line 23, in ?
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
AttributeError: 'str' object has no attribute 'asctime'
Press any key to exit
I'm sure this is something simple but for this I am having trouble
figuring it out.
Thanks,
Harlin Seritt
from extractor import *
import time
import os
print 'Running AgentPing at '+time.asctime()
confFile = '../conf/AgentPing/AgentPing.conf'
ex = extractor(confFile)
names = ex.array('name')
comments = ex.array('comment')
ips = ex.array('ip')
counts = ex.array('count')
thresholds = ex.array('threshold')
alarms = ex.array('alarm')
levels = ex.array('level')
records = ex.array('record')
plogger = Logger('../logs/AgentPing.log')
for name,comment,count,ip,threshold,alarm,level,record in
zip(names,comments,counts,ips,thresholds,alarms,levels,records):
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
print msg
plogger.loggit(msg)
line = 'ping -n '+count+' '+ip
try:
data = os.popen(line).readlines()
time = data[-1].split()[-1][:-2]
except:
msg = 'AGENT FAILURE: Unable to run ping on '+ip+' for unknown
reason.'
print msg
msg += 'Error created at '+time.asctime()
time = float(threshold)*2
plogger.loggit(msg)
createAlarm(name, comment, ip, threshold, level, msg)
Whenever I run this I get:
Traceback (most recent call last):
File "agentPing.py", line 23, in ?
msg = 'AGENT INFORMATION: Pinging '+ip+' at '+time.asctime()
AttributeError: 'str' object has no attribute 'asctime'
Press any key to exit
I'm sure this is something simple but for this I am having trouble
figuring it out.
Thanks,
Harlin Seritt