Fr More » History » Version 2

« Previous - Version 2/7 (diff) - Next » - Current version
vinc, 08/05/2010 05:06 PM


install wmi-client

winexe -U DOMAIN/user //MACHINE "cmd /C psloglist" | iconv -t UTF-8 -f ISO_8859-1 > test

  1. Python script
  2. Specification draft
  1. MySQL Tables

CREATE TABLE eventlogs_config (
server varchar(255),
eventlog varchar(255),
type varchar(255)
)

CREATE TABLE eventlogs_list (
unique_id int(16) NOT NULL auto_increment,
server varchar(255),
eventlog varchar(255),
type varchar(255),
time date,
event_id int(16),
desc varchar(255)
)

#Algorithm

eventlogs_config = db.exec("SELECT * FROM eventlogs_config;")

for eventlog_config in eventlogs_config:
today = date.date()
yesterday = date.date() - 24*3600
res = system.exec("psloglist.exe \\\\%s -a %s -b %s -s \"%s\"" % (eventlog_config["server"], yesterday, today, eventlog_config["eventlog"]))
events = parse(res, eventlog_config["type"])
for event in events:
db.exec("INSERT INTO eventlogs_list (server, eventlog, type, time, event_id, desc) VALUES (%s, %s, %s, %s, %s, %s);", (event["server"], event["eventlog"], event["type"], event["time"], event["event_id"], event["desc"]))

python-glpi-eventlog.tar.bz2 - Python prototype (12 KB) vinc, 08/06/2010 05:09 PM