from utilities import *
from extractor import *
import time
import os
print 'Running AgentPing at '+time.asctime( )
confFile = '../conf/AgentPing/AgentPing.conf'
ex = extractor(confF ile)
names = ex.array('name' )
comments = ex.array('comme nt')
ips = ex.array('ip')
counts = ex.array('count ')
thresholds = ex.array('thres hold')
alarms = ex.array('alarm ')
levels = ex.array('level ')
records = ex.array('recor d')
plogger = Logger('../logs/AgentPing.log')
for name,comment,co unt,ip,threshol d,alarm,level,r ecord in
zip(names,comme nts,counts,ips, thresholds,alar ms,levels,recor ds):
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(nam e, 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 1 1364
Harlin Seritt wrote: from utilities import * from extractor import * import time
.... data = os.popen(line). readlines() time = data[-1].split()[-1][:-2]
This seems an unfortunate choice of names. except: ...
--Scott David Daniels sc***********@a cm.org This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lawrence |
last post by:
I've been bad about documentation so far but I'm going to try to be
better. I've mostly worked alone so I'm the only one, so far, who's
suffered from my bad habits. But I'd like other programmers to have an
easier time understanding what I do. Therefore this weekend I'm going
to spend 3 days just writing comments. Before I do it, I thought I'd
ask other programmers what information they find useful.
Below is a typical class I've...
|
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334, column 13: there is no attribute "SRC"
<bgsound src="C:\My Documents\zingwent.mids">
You have used the attribute named above in your document, but the document
type you are using does not support that attribute for this element. This
error is...
|
by: Flzw |
last post by:
Is there a standard library (C or C++) to convert a time in seconds since
Jan, 1st 1970 into a formatted datetime string ?
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with a device.
The definition of the table is as follows:
CREATE TABLE devicedata
(
device_id int NOT NULL REFERENCES devices(id), -- id in the device
|
by: nephish |
last post by:
Hey there,
i have tried about every graphing package for python i can get to work
on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get
matplot to work)
so far, they all are working ok. I need to make an x y chart for some
data that comes in from sensors at different times durring the day. i
need it to show the value in the y and the time in the x . no problem
so far. But what i cannot get to happen is to scale x (time of the...
| |
by: Razzel |
last post by:
I created this as a test:
#include <time.h>
main(){
printf(X1: %s\n", putim());
printf(X2: %s\n", putim());
}
putim() {
time_t t;
time(&t);
return(ctime(&t));
|
by: yezi |
last post by:
Hi: I am coding to output the result to the tmp file in order to send
to the client. The following is the code I write to output the system
call to a tmp file "tmp.txt". However, when running it, it generate the
message like " Segmentation fault (core dumped)"
Really confused by that . Any comments is welcomed.
tmpfile = fopen("tmp.txt","a+");
if(tmpfile == NULL) {
perror("Error: can't open file.\n");
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need Inbox
Reply
from Craig Somerford <uscos@2barter.net>
hide details 10:25 pm
(3 minutes ago)
|
by: Anders B |
last post by:
I want to make a program that reads the content of a LUA array save file..
More precicely a save file from a World of Warcraft plugin called
CharacterProfiler, which dumps alot of information about your characters
into that save file.
Anyhow, I want to extract a couple of lines of it and save it into a
database and I need help on figuring out a good way of reading the file.
The problem is that the file can look pretty different depending...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |