Commit 6ebf5071 authored by Claes Sjofors's avatar Claes Sjofors

Python interface to fetch events from sev, and alarm and event analyser added

parent 8ed5411c
......@@ -39,6 +39,7 @@
#include <vector>
#include "rt_que.h"
#include "rt_mh_net.h"
#include "rt_sev_net.h"
class sev_import;
......
......@@ -1363,6 +1363,7 @@ void* sev_server::send_events_thread(void* arg)
strncpy(mp->EventText, list[i].eventtext, sizeof(mp->EventText));
strncpy(mp->EventName, list[i].eventname, sizeof(mp->EventName));
mp->EventId = list[i].eventid;
mp->EventStatus = list[i].eventstatus;
mp++;
}
}
......@@ -1427,6 +1428,7 @@ int sev_server::receive_events(
ev.supobject.Objid.oix = ep->sup_aref_oix;
ev.supobject.Offset = ep->sup_aref_offset;
ev.supobject.Size = ep->sup_aref_size;
ev.eventstatus = ep->eventstatus;
m_db->store_event(&m_sts, 0, idx, &ev);
ep++;
}
......@@ -1755,6 +1757,11 @@ void* sev_server::receive_histdata_thread(void* arg)
ev.supobject.Objid.oix = ep->sup_aref_oix;
ev.supobject.Offset = ep->sup_aref_offset;
ev.supobject.Size = ep->sup_aref_size;
if (msg->h.version > 1)
// Eventstatus added in version 2
ev.eventstatus = ep->eventstatus;
else
ev.eventstatus = 0;
sev->m_db->store_event(&sev->m_sts, th->db_ctx, msg->item_idx, &ev);
ep++;
}
......@@ -1777,6 +1784,7 @@ void* sev_server::receive_histdata_thread(void* arg)
ev.supobject.Objid.oix = 0;
ev.supobject.Offset = 0;
ev.supobject.Size = 0;
ev.eventstatus = 0;
sev->m_db->store_event(&sev->m_sts, th->db_ctx, msg->item_idx, &ev);
epV0++;
}
......
......@@ -82,6 +82,7 @@ class ValueDialog:
self.entry = Entry(top, width=15)
self.entry.grid(column=1, row=0, padx=10, pady=5, sticky=W)
self.entry.focus()
self.rename_ok_cb = rename_ok_cb
button = Button(top, text="Ok", command=self.ok_cb, width=10)
......@@ -90,11 +91,13 @@ class ValueDialog:
button = Button(top, text="Cancel", command=self.cancel_cb, width=10)
button.grid(column=1, row=1, padx=10, pady=5, sticky=W)
self.top.bind('<Return>', self.ok_cb)
def cancel_cb(self):
self.top.destroy()
def ok_cb(self):
def ok_cb(self, arg=0):
value = self.entry.get()
self.rename_ok_cb(value)
self.top.destroy()
......@@ -1801,7 +1804,8 @@ class FetchSev:
self.wdata = wdata
self.fswindow = Toplevel(window, bg=bgcolor)
self.fswindow.title('Fetch from Sev Server')
self.fswindow.title('Import from Sev Server')
self.fswindow.geometry("350x200")
main.set_icon(self.fswindow)
self.create_filterframe()
......@@ -1816,11 +1820,19 @@ class FetchSev:
defaultserver = StringVar()
# Server entry
# Read last server from file
try:
fp = open(pwrp_tmp + "/sevserver.dat", "r")
srv = fp.read()
fp.close()
except IOError:
srv = ''
serverlabel = Label(self.filterframe, text='Sev server')
serverlabel.grid(column=0, row=0, padx=20, pady=5, sticky=W)
serverlabel.config(bg=bgcolor)
self.serverentry = Entry(self.filterframe, textvariable=defaultserver)
defaultserver.set('pwr56-build')
defaultserver.set(srv)
self.serverentry.grid(column=1, row=0, padx=20, pady=5, sticky=W)
self.serverentry.config(bg=bgcolor)
......@@ -1834,16 +1846,25 @@ class FetchSev:
# Fetch items button
filterbutton = Button(self.filterframe, text='Fetch Items', command=self.fetchitems_cb, bg=buttoncolor)
filterbutton.grid(column=2, row=1, padx=20, pady=5, sticky=W)
filterbutton.grid(column=1, row=2, padx=20, pady=5, sticky=W)
self.filterframe.pack(side=LEFT, fill=X)
# Create frame to show and select sev items
def fetchitems_cb(self):
self.fswindow.geometry("650x700")
filtervalue = self.filterentry.get()
self.server = self.serverentry.get()
# Store server to file
try:
fp = open(pwrp_tmp + "/sevserver.dat", "w")
fp.write(self.server)
fp.close()
except IOError:
pass
self.items = pwrrt.getSevItemList(self.server, filtervalue)
self.itemframe = Frame(self.fswindow, bg=bgcolor)
......@@ -2005,6 +2026,7 @@ for opt, arg in opts:
formula = arg
pwr_exe = os.environ.get('pwr_exe')
pwrp_tmp = os.environ.get('pwrp_tmp')
bgcolor = 'white'
buttoncolor = '#F0F0F0'
......
This diff is collapsed.
......@@ -47,7 +47,7 @@
#include "rt_sev_net.h"
#include "sev_valuecache.h"
#define sev_cVersion 4
#define sev_cVersion 5
typedef enum {
sev_eDbType_,
......@@ -121,6 +121,7 @@ public:
char eventtext[80];
char eventname[80];
pwr_tAttrRef supobject;
unsigned int eventstatus;
};
class sev_item {
......
......@@ -384,6 +384,11 @@ int sev_dbms_env::checkAndUpdateVersion(unsigned int version)
updateDBToSevVersion4();
}
if (old_version < 5) {
printf("Updating database tables to sev version 5\n");
updateDBToSevVersion5();
}
if (old_version != version) {
char query[100];
sprintf(query, "update sev_version set version = %d", version);
......@@ -601,6 +606,57 @@ int sev_dbms_env::updateDBToSevVersion4(void)
return 1;
}
int sev_dbms_env::updateDBToSevVersion5(void)
{
int rc;
char query[300];
sprintf(query,
"select id,tablename from items where aname = 'Events' order by id");
rc = mysql_query(con(), query);
if (rc) {
printf("In %s row %d:\n", __FILE__, __LINE__);
printf("%s: %s\n", __FUNCTION__, mysql_error(con()));
return 0;
}
MYSQL_ROW row;
MYSQL_RES* result = mysql_store_result(con());
if (!result) {
printf("In %s row %d:\n", __FILE__, __LINE__);
printf("GetValues Result Error\n");
return 0;
}
int rows = mysql_num_rows(result);
std::vector<sev_item> itemsVec;
for (int i = 0; i < rows; i++) {
char tablename[80];
int id;
row = mysql_fetch_row(result);
if (!row)
break;
id = atoi(row[0]);
strncpy(tablename, row[1], sizeof(tablename));
sprintf(query,
"alter table %s add eventstatus int unsigned after eventname",
tablename);
rc = mysql_query(con(), query);
if (rc) {
printf("In %s row %d:\n", __FILE__, __LINE__);
printf("%s: %s\n", __FUNCTION__, mysql_error(con()));
return 0;
}
}
mysql_free_result(result);
return 1;
}
MYSQL* sev_dbms_env::openDb(unsigned int* sts)
{
*sts = 0;
......@@ -991,7 +1047,7 @@ int sev_dbms::create_event_table(
"supobject_vid int unsigned, supobject_oix int unsigned, "
"supobject_offset int unsigned,"
"supobject_size int unsigned,"
"eventtext varchar(80), eventname varchar(80), index (time))%s;",
"eventtext varchar(80), eventname varchar(80), eventstatus int unsigned, index (time))%s;",
tablename, readoptstr, timeformatstr, enginestr);
int rc = mysql_query(m_env->con(), query);
......@@ -2523,6 +2579,8 @@ int sev_dbms::store_event(
else
con = m_env->con();
printf("Store event:eventstatus %u\n", ep->eventstatus);
*sts = time_AtoAscii(
&ep->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
if (EVEN(*sts))
......@@ -2599,25 +2657,27 @@ int sev_dbms::store_event(
"eventid_nix, eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size,"
"eventtext, eventname) values "
"(%ld,%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')",
"eventtext, eventname, eventstatus) values "
"(%ld,%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s',%u)",
m_items[item_idx].tablename, (long int)ep->time.tv_sec,
(long int)ep->time.tv_nsec, ep->type, ep->eventprio, ep->eventid.Nix,
ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix,
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname);
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname,
ep->eventstatus);
} else {
// Posix time, low resolution
sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, "
"eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size, "
"eventtext, eventname) values "
"(%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')",
m_items[item_idx].tablename, (long int)ep->time.tv_sec, ep->type,
ep->eventprio, ep->eventid.Nix, ep->eventid.BirthTime.tv_sec,
ep->eventid.Idx, ep->supobject.Objid.vid, ep->supobject.Objid.oix,
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname);
"eventtext, eventname, eventstatus) values "
"(%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s',%u)",
m_items[item_idx].tablename, (long int)ep->time.tv_sec, ep->type,
ep->eventprio, ep->eventid.Nix, ep->eventid.BirthTime.tv_sec,
ep->eventid.Idx, ep->supobject.Objid.vid, ep->supobject.Objid.oix,
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname,
ep->eventstatus);
}
} else {
if (m_items[item_idx].options & pwr_mSevOptionsMask_HighTimeResolution) {
......@@ -2626,25 +2686,27 @@ int sev_dbms::store_event(
"eventid_nix, eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size,"
"eventtext, eventname) values "
"('%s',%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')",
"eventtext, eventname, eventstatus) values "
"('%s',%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s',%u)",
m_items[item_idx].tablename, timstr, (long int)ep->time.tv_nsec,
ep->type, ep->eventprio, ep->eventid.Nix,
ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix,
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname);
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname,
ep->eventstatus);
} else {
// Sql time, low resolution
sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, "
"eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size,"
"eventtext, eventname) values "
"('%s',%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')",
"eventtext, eventname, eventstatus) values "
"('%s',%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s',%u)",
m_items[item_idx].tablename, timstr, ep->type, ep->eventprio,
ep->eventid.Nix, ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix,
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname);
ep->supobject.Offset, ep->supobject.Size, eventtext, ep->eventname,
ep->eventstatus);
}
}
rc = mysql_query(con, query);
......@@ -4803,11 +4865,11 @@ int sev_dbms::get_events(pwr_tStatus *sts, void *thread, pwr_tOid oid,
if (options & pwr_mSevOptionsMask_HighTimeResolution)
strcpy(column_part, "time,ntime,eventtype,eventprio,eventid_nix,eventid_birthtime,"
"eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext,"
"eventname");
"eventname,eventstatus");
else
strcpy(column_part, "time,eventtype,eventprio,eventid_nix,eventid_birthtime,"
"eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext,"
"eventname");
"eventname,eventstatus");
// 'order by' part
if (options & pwr_mSevOptionsMask_HighTimeResolution)
......@@ -5043,6 +5105,7 @@ int sev_dbms::get_events(pwr_tStatus *sts, void *thread, pwr_tOid oid,
e.supobject.Size = strtoul(row[j++], 0, 10);
strncpy(e.eventtext, row[j++], sizeof(e.eventtext));
strncpy(e.eventname, row[j++], sizeof(e.eventname));
e.eventstatus = strtoul(row[j++], 0, 10);
list.push_back(e);
}
printf("ecnt %d\n", list.size());
......
......@@ -81,6 +81,7 @@ public:
int checkAndUpdateVersion(unsigned int version);
int updateDBToSevVersion2(void);
int updateDBToSevVersion4(void);
int updateDBToSevVersion5(void);
int createSevVersion2Tables(void);
int createSevVersion3Tables(void);
MYSQL* createDb(void);
......
<topic> __DocumentTitlePage
<image> pwr_logga_doc.png
<h1> Event analysis
<hr>
2019-09-26
Version 5.7.0
<hr>
</topic>
<topic> __DocumentInfoPage
Copyright 2005-2019 SSAB EMEA AB
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts.
</topic>
<option> printdisable
<topic> index
Event Analysis
<image> pwr_logga.gif
<h1>Event Analysis
Introduction <link> eva_introduction
Fetch data <link> eva_get_data
Linear Regression Model <link> eva_linreg_model
Index <index>
</topic>
<option> printenable
<chapter>
<topic> eva_introduction
Introduction
ProviewR Event Analysis are utilities to analyse alarm and events stored by a
ProviewR system.
</topic>
</chapter>
<chapter>
<topic> eva_get_data
Get data
<h1>Get data
Data can be fetch from an Sev server or read from a csv file generated for example by
the Xtt logging function.
<option> printdisable
<b>Fetch from sev <link>eva_fetch_from_sev
<b>Xtt logging <link>eva_xtt_logging
<option> printenable
</topic>
<headerlevel>
<topic> eva_fetch_from_sev
Fetch data from Sev
...
</topic>
<topic> eva_xtt_logging
Xtt logging
...
</topic>
</headerlevel>
</chapter>
<chapter>
<topic> eva_linreg_model
Linear Regression Model
<h1>Create Model
<option> printdisable
<b>Create model <link>eva_create_model
<b>Apply model <link>eva_apply_model
<option> printenable
</topic>
<headerlevel>
<topic> eva_create_model
Create model
...
</topic>
<topic> eva_apply_model
Apply model
...
</topic>
</headerlevel>
</chapter>
......@@ -60,7 +60,7 @@ Index <index>
<topic> mva_introduction
Introduction
ProviewR Multivariate Analyses is utilities to analyse data stored or generated by a
ProviewR Multivariate Analysis are utilities to analyse data stored or generated by a
ProviewR system.
</topic>
......
......@@ -240,6 +240,8 @@ copy : \
$(doc_dir)/en_us/man_exlib.pdf \
$(doc_dir)/en_us/man_exlib.ps \
$(web_dir)/pwr_logga.png \
$(exe_dir)/en_us/man_mva.dat \
$(exe_dir)/en_us/man_eva.dat \
$(mediatargets) $(csstargets) \
$(export_html) $(export_html_en_us) $(export_html_sv_se) \
$(doc_dir)/en_us/changelog.html | silent
......@@ -435,6 +437,14 @@ $(doc_dir)/en_us/man_exlib.pdf : $(pwre_sroot)/doc/man/en_us/man_exlib.dat
@ echo "Generating pdf for en_us/man_exlib"
@ $(co_convert) -f -d $(doc_dir)/en_us $(source)
$(exe_dir)/en_us/man_mva.dat : $(pwre_sroot)/doc/man/en_us/man_mva.dat
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(exe_dir)/en_us/man_eva.dat : $(pwre_sroot)/doc/man/en_us/man_eva.dat
@ $(log_h_h)
@ $(cp) $(cpflags) $(source) $(target)
$(doc_dir)/en_us/changelog.html : $(pwre_croot)/src/changelog.txt \
$(pwre_croot)/xtt/changelog.txt \
$(pwre_croot)/wb/changelog.txt \
......
......@@ -874,7 +874,10 @@ int rt_sevhistmon::send_data()
if (!qcom_Put(&sts, &tgt, &put)) {
m_hs[i].threadp->ErrorCount++;
m_hs[i].threadp->Status = sts;
if (sts == QCOM__NOQ)
m_hs[i].threadp->Status = SEV__HISTDATAQ;
else
m_hs[i].threadp->Status = sts;
conf_sts = sts;
qcom_Free(&sts, put.data);
continue;
......@@ -967,7 +970,10 @@ int rt_sevhistmon::send_exportdata()
if (!qcom_Put(&sts, &tgt, &put)) {
m_hs[i].threadp->ErrorCount++;
m_hs[i].threadp->Status = sts;
if (sts == QCOM__NOQ)
m_hs[i].threadp->Status = SEV__EXPORTQ;
else
m_hs[i].threadp->Status = sts;
conf_sts = sts;
qcom_Free(&sts, put.data);
continue;
......@@ -1492,6 +1498,7 @@ pwr_tStatus rt_sevhistmon::mh_ack_bc(mh_sAck* msg)
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1514,6 +1521,7 @@ pwr_tStatus rt_sevhistmon::mh_return_bc(mh_sReturn* msg)
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1537,7 +1545,9 @@ pwr_tStatus rt_sevhistmon::mh_alarm_bc(mh_sMessage* msg)
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = msg->Status;
printf("alarm_bc, %u\n", msg->Status);
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1560,6 +1570,7 @@ pwr_tStatus rt_sevhistmon::mh_block_bc(mh_sBlock* msg)
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1583,6 +1594,7 @@ pwr_tStatus rt_sevhistmon::mh_cancel_bc(mh_sReturn* msg)
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1602,6 +1614,11 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg)
ed.eventid_idx = msg->Info.Id.Idx;
ed.eventid_nix = msg->Info.Id.Nix;
ed.eventid_birthtime = msg->Info.Id.BirthTime.tv_sec;
ed.sup_aref_vid = msg->SupObject.Objid.vid;
ed.sup_aref_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
......@@ -1611,6 +1628,22 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg)
pwr_tStatus rt_sevhistmon::mh_clear_alarmlist_bc(pwr_tNodeIndex nix)
{
pwr_tStatus sts;
sev_sEvent ed;
gdh_sNodeInfo info;
pwr_tTime current_time;
sts = gdh_GetNodeInfo(nix, &info);
time_GetTime(&current_time);
memset(&ed, 0, sizeof(ed));
ed.type = sev_eEvent_ClearAlarmList;
ed.time = net_TimeToNetTime(&current_time);
ed.sup_aref_vid = info.nix;
strncpy(ed.eventname, info.nodename, sizeof(ed.eventname));
if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed);
return 1;
}
......@@ -1694,6 +1727,7 @@ void sev_sevhistevents::evbuf_send()
unsigned int ev_cnt = 0;
if (evbuf_sent == ev_cInit) {
for (unsigned int idx = evbuf_oldest;;) {
printf("evbuf_send, %u\n", event_buffer[idx].eventstatus);
memcpy(&((sev_sMsgEventsStore*)put.data)->Events[ev_cnt],
&event_buffer[idx], sizeof(sev_sEvent));
ev_cnt++;
......@@ -1727,7 +1761,10 @@ void sev_sevhistevents::evbuf_send()
if (!qcom_Put(&sts, &tgt, &put)) {
monitor->m_hs[event_thread_idx].threadp->ErrorCount++;
monitor->m_hs[event_thread_idx].threadp->Status = sts;
if (sts == QCOM__NOQ)
monitor->m_hs[event_thread_idx].threadp->Status = SEV__EVENTSQ;
else
monitor->m_hs[event_thread_idx].threadp->Status = sts;
qcom_Free(&sts, put.data);
}
monitor->m_hs[event_thread_idx].threadp->SendCount++;
......
......@@ -4271,7 +4271,7 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args)
result = PyTuple_New(listcnt);
for ( i = 0; i < listcnt; i++) {
item_tuple = PyTuple_New(7);
item_tuple = PyTuple_New(8);
eventid_tuple = PyTuple_New(2);
if ( time_string) {
/* Time string */
......@@ -4293,11 +4293,12 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args)
PyTuple_SetItem(item_tuple, 4, PyString_FromString(list[i].EventName));
strcpy(supobject, cdh_ObjidToString(list[i].SupObjectOid, 1));
if (list[i].SupObjectOffset > 0)
sprintf(&supobject[strlen(supobject)], "#%d:%d", list[i].SupObjectOffset, list[i].SupObjectSize);
sprintf(&supobject[strlen(supobject)], "/%d:%d", list[i].SupObjectOffset, list[i].SupObjectSize);
PyTuple_SetItem(item_tuple, 5, PyString_FromString(supobject));
PyTuple_SetItem(eventid_tuple, 0, PyInt_FromLong((long)list[i].EventId.Nix));
PyTuple_SetItem(eventid_tuple, 1, PyInt_FromLong((long)list[i].EventId.Idx));
PyTuple_SetItem(item_tuple, 6, eventid_tuple);
PyTuple_SetItem(item_tuple, 7, PyInt_FromLong((long)list[i].EventStatus));
PyTuple_SetItem(result, i, item_tuple);
}
......@@ -4386,7 +4387,7 @@ static PyObject *pwrrt_getSevEventsDataFrame(PyObject *self, PyObject *args)
result = PyList_New(listcnt);
for ( i = 0; i < listcnt; i++) {
item_tuple = PyTuple_New(7);
item_tuple = PyTuple_New(8);
eventid_tuple = PyTuple_New(2);
if ( time_string) {
/* Time string */
......@@ -4413,6 +4414,7 @@ static PyObject *pwrrt_getSevEventsDataFrame(PyObject *self, PyObject *args)
PyTuple_SetItem(eventid_tuple, 0, PyInt_FromLong((long)list[i].EventId.Nix));
PyTuple_SetItem(eventid_tuple, 1, PyInt_FromLong((long)list[i].EventId.Idx));
PyTuple_SetItem(item_tuple, 6, eventid_tuple);
PyTuple_SetItem(item_tuple, 7, PyInt_FromLong((long)list[i].EventStatus));
PyList_SetItem(result, i, item_tuple);
}
......
......@@ -48,7 +48,9 @@ extern "C" {
#define sev_eProcSevServer 122
#define sev_eProcSevImport 123
#define sev_cMsgClass 202
#define sev_cNetVersion 1
#define sev_cNetVersion 2
#define sev_eEvent_ClearAlarmList 2147483647
typedef enum {
sev_eMsgType_NodeUp,
......@@ -123,6 +125,7 @@ typedef struct {
unsigned int sup_aref_oix;
unsigned int sup_aref_offset;
unsigned int sup_aref_size;
unsigned int eventstatus;
} sev_sEvent;
typedef struct {
......@@ -344,6 +347,7 @@ typedef struct {
pwr_tString80 EventText;
pwr_tOName EventName;
mh_sEventId EventId;
pwr_tUInt32 EventStatus;
} sev_sEvents;
typedef struct {
......
......@@ -846,10 +846,12 @@ int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
lp->EventType = ip->EventType;
lp->EventPrio = ip->EventPrio;
lp->SupObjectOid = ip->SupObjectOid;
lp->SupObjectOffset = ip->SupObjectOffset;
lp->SupObjectSize = ip->SupObjectSize;
strncpy(lp->EventText, ip->EventText, sizeof(lp->EventText));
strncpy(lp->EventName, ip->EventName, sizeof(lp->EventName));
lp->EventId = ip->EventId;
lp->EventStatus = ip->EventStatus;
lp++;
ip++;
}
......
......@@ -105,6 +105,7 @@ typedef struct {
pwr_tString80 EventText;
pwr_tOName EventName;
mh_sEventId EventId;
pwr_tUInt32 EventStatus;
} sevcli_sEvents;
int sevcli_init(pwr_tStatus* sts, sevcli_tCtx* ctx);
......
......@@ -57,6 +57,9 @@ nosuchtable <Table doesn't exist> /error
norows <No rows found> /error
nowrite <Nothings written> /info
noconnection <Connection has gone> /error
exportq <Export send, no server queue> /error
eventsq <Events send, no server queue> /error
histdataq <History data send, no server queue> /error
.end
......
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