Commit c986ac0d authored by Claes Sjofors's avatar Claes Sjofors Committed by Claes Sjöfors

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

parent 0efb3818
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <vector> #include <vector>
#include "rt_que.h" #include "rt_que.h"
#include "rt_mh_net.h"
#include "rt_sev_net.h" #include "rt_sev_net.h"
class sev_import; class sev_import;
......
...@@ -1363,6 +1363,7 @@ void* sev_server::send_events_thread(void* arg) ...@@ -1363,6 +1363,7 @@ void* sev_server::send_events_thread(void* arg)
strncpy(mp->EventText, list[i].eventtext, sizeof(mp->EventText)); strncpy(mp->EventText, list[i].eventtext, sizeof(mp->EventText));
strncpy(mp->EventName, list[i].eventname, sizeof(mp->EventName)); strncpy(mp->EventName, list[i].eventname, sizeof(mp->EventName));
mp->EventId = list[i].eventid; mp->EventId = list[i].eventid;
mp->EventStatus = list[i].eventstatus;
mp++; mp++;
} }
} }
...@@ -1427,6 +1428,7 @@ int sev_server::receive_events( ...@@ -1427,6 +1428,7 @@ int sev_server::receive_events(
ev.supobject.Objid.oix = ep->sup_aref_oix; ev.supobject.Objid.oix = ep->sup_aref_oix;
ev.supobject.Offset = ep->sup_aref_offset; ev.supobject.Offset = ep->sup_aref_offset;
ev.supobject.Size = ep->sup_aref_size; ev.supobject.Size = ep->sup_aref_size;
ev.eventstatus = ep->eventstatus;
m_db->store_event(&m_sts, 0, idx, &ev); m_db->store_event(&m_sts, 0, idx, &ev);
ep++; ep++;
} }
...@@ -1755,6 +1757,11 @@ void* sev_server::receive_histdata_thread(void* arg) ...@@ -1755,6 +1757,11 @@ void* sev_server::receive_histdata_thread(void* arg)
ev.supobject.Objid.oix = ep->sup_aref_oix; ev.supobject.Objid.oix = ep->sup_aref_oix;
ev.supobject.Offset = ep->sup_aref_offset; ev.supobject.Offset = ep->sup_aref_offset;
ev.supobject.Size = ep->sup_aref_size; 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); sev->m_db->store_event(&sev->m_sts, th->db_ctx, msg->item_idx, &ev);
ep++; ep++;
} }
...@@ -1777,6 +1784,7 @@ void* sev_server::receive_histdata_thread(void* arg) ...@@ -1777,6 +1784,7 @@ void* sev_server::receive_histdata_thread(void* arg)
ev.supobject.Objid.oix = 0; ev.supobject.Objid.oix = 0;
ev.supobject.Offset = 0; ev.supobject.Offset = 0;
ev.supobject.Size = 0; ev.supobject.Size = 0;
ev.eventstatus = 0;
sev->m_db->store_event(&sev->m_sts, th->db_ctx, msg->item_idx, &ev); sev->m_db->store_event(&sev->m_sts, th->db_ctx, msg->item_idx, &ev);
epV0++; epV0++;
} }
......
...@@ -82,6 +82,7 @@ class ValueDialog: ...@@ -82,6 +82,7 @@ class ValueDialog:
self.entry = Entry(top, width=15) self.entry = Entry(top, width=15)
self.entry.grid(column=1, row=0, padx=10, pady=5, sticky=W) self.entry.grid(column=1, row=0, padx=10, pady=5, sticky=W)
self.entry.focus()
self.rename_ok_cb = rename_ok_cb self.rename_ok_cb = rename_ok_cb
button = Button(top, text="Ok", command=self.ok_cb, width=10) button = Button(top, text="Ok", command=self.ok_cb, width=10)
...@@ -90,11 +91,13 @@ class ValueDialog: ...@@ -90,11 +91,13 @@ class ValueDialog:
button = Button(top, text="Cancel", command=self.cancel_cb, width=10) button = Button(top, text="Cancel", command=self.cancel_cb, width=10)
button.grid(column=1, row=1, padx=10, pady=5, sticky=W) button.grid(column=1, row=1, padx=10, pady=5, sticky=W)
self.top.bind('<Return>', self.ok_cb)
def cancel_cb(self): def cancel_cb(self):
self.top.destroy() self.top.destroy()
def ok_cb(self): def ok_cb(self, arg=0):
value = self.entry.get() value = self.entry.get()
self.rename_ok_cb(value) self.rename_ok_cb(value)
self.top.destroy() self.top.destroy()
...@@ -1801,7 +1804,8 @@ class FetchSev: ...@@ -1801,7 +1804,8 @@ class FetchSev:
self.wdata = wdata self.wdata = wdata
self.fswindow = Toplevel(window, bg=bgcolor) 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) main.set_icon(self.fswindow)
self.create_filterframe() self.create_filterframe()
...@@ -1816,11 +1820,19 @@ class FetchSev: ...@@ -1816,11 +1820,19 @@ class FetchSev:
defaultserver = StringVar() defaultserver = StringVar()
# Server entry # 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 = Label(self.filterframe, text='Sev server')
serverlabel.grid(column=0, row=0, padx=20, pady=5, sticky=W) serverlabel.grid(column=0, row=0, padx=20, pady=5, sticky=W)
serverlabel.config(bg=bgcolor) serverlabel.config(bg=bgcolor)
self.serverentry = Entry(self.filterframe, textvariable=defaultserver) 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.grid(column=1, row=0, padx=20, pady=5, sticky=W)
self.serverentry.config(bg=bgcolor) self.serverentry.config(bg=bgcolor)
...@@ -1834,16 +1846,25 @@ class FetchSev: ...@@ -1834,16 +1846,25 @@ class FetchSev:
# Fetch items button # Fetch items button
filterbutton = Button(self.filterframe, text='Fetch Items', command=self.fetchitems_cb, bg=buttoncolor) 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) self.filterframe.pack(side=LEFT, fill=X)
# Create frame to show and select sev items # Create frame to show and select sev items
def fetchitems_cb(self): def fetchitems_cb(self):
self.fswindow.geometry("650x700")
filtervalue = self.filterentry.get() filtervalue = self.filterentry.get()
self.server = self.serverentry.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.items = pwrrt.getSevItemList(self.server, filtervalue)
self.itemframe = Frame(self.fswindow, bg=bgcolor) self.itemframe = Frame(self.fswindow, bg=bgcolor)
...@@ -2005,6 +2026,7 @@ for opt, arg in opts: ...@@ -2005,6 +2026,7 @@ for opt, arg in opts:
formula = arg formula = arg
pwr_exe = os.environ.get('pwr_exe') pwr_exe = os.environ.get('pwr_exe')
pwrp_tmp = os.environ.get('pwrp_tmp')
bgcolor = 'white' bgcolor = 'white'
buttoncolor = '#F0F0F0' buttoncolor = '#F0F0F0'
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "rt_sev_net.h" #include "rt_sev_net.h"
#include "sev_valuecache.h" #include "sev_valuecache.h"
#define sev_cVersion 4 #define sev_cVersion 5
typedef enum { typedef enum {
sev_eDbType_, sev_eDbType_,
...@@ -121,6 +121,7 @@ public: ...@@ -121,6 +121,7 @@ public:
char eventtext[80]; char eventtext[80];
char eventname[80]; char eventname[80];
pwr_tAttrRef supobject; pwr_tAttrRef supobject;
unsigned int eventstatus;
}; };
class sev_item { class sev_item {
......
...@@ -384,6 +384,11 @@ int sev_dbms_env::checkAndUpdateVersion(unsigned int version) ...@@ -384,6 +384,11 @@ int sev_dbms_env::checkAndUpdateVersion(unsigned int version)
updateDBToSevVersion4(); updateDBToSevVersion4();
} }
if (old_version < 5) {
printf("Updating database tables to sev version 5\n");
updateDBToSevVersion5();
}
if (old_version != version) { if (old_version != version) {
char query[100]; char query[100];
sprintf(query, "update sev_version set version = %d", version); sprintf(query, "update sev_version set version = %d", version);
...@@ -601,6 +606,57 @@ int sev_dbms_env::updateDBToSevVersion4(void) ...@@ -601,6 +606,57 @@ int sev_dbms_env::updateDBToSevVersion4(void)
return 1; 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) MYSQL* sev_dbms_env::openDb(unsigned int* sts)
{ {
*sts = 0; *sts = 0;
...@@ -991,7 +1047,7 @@ int sev_dbms::create_event_table( ...@@ -991,7 +1047,7 @@ int sev_dbms::create_event_table(
"supobject_vid int unsigned, supobject_oix int unsigned, " "supobject_vid int unsigned, supobject_oix int unsigned, "
"supobject_offset int unsigned," "supobject_offset int unsigned,"
"supobject_size 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); tablename, readoptstr, timeformatstr, enginestr);
int rc = mysql_query(m_env->con(), query); int rc = mysql_query(m_env->con(), query);
...@@ -2523,6 +2579,8 @@ int sev_dbms::store_event( ...@@ -2523,6 +2579,8 @@ int sev_dbms::store_event(
else else
con = m_env->con(); con = m_env->con();
printf("Store event:eventstatus %u\n", ep->eventstatus);
*sts = time_AtoAscii( *sts = time_AtoAscii(
&ep->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr)); &ep->time, time_eFormat_NumDateAndTime, timstr, sizeof(timstr));
if (EVEN(*sts)) if (EVEN(*sts))
...@@ -2599,25 +2657,27 @@ int sev_dbms::store_event( ...@@ -2599,25 +2657,27 @@ int sev_dbms::store_event(
"eventid_nix, eventid_birthtime," "eventid_nix, eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, " "eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size," "supobject_offset, supobject_size,"
"eventtext, eventname) values " "eventtext, eventname, eventstatus) values "
"(%ld,%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')", "(%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, m_items[item_idx].tablename, (long int)ep->time.tv_sec,
(long int)ep->time.tv_nsec, ep->type, ep->eventprio, ep->eventid.Nix, (long int)ep->time.tv_nsec, ep->type, ep->eventprio, ep->eventid.Nix,
ep->eventid.BirthTime.tv_sec, ep->eventid.Idx, ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix, 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 { } else {
// Posix time, low resolution // Posix time, low resolution
sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, " sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, "
"eventid_birthtime," "eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, " "eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size, " "supobject_offset, supobject_size, "
"eventtext, eventname) values " "eventtext, eventname, eventstatus) values "
"(%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')", "(%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, m_items[item_idx].tablename, (long int)ep->time.tv_sec, ep->type,
ep->eventprio, ep->eventid.Nix, ep->eventid.BirthTime.tv_sec, ep->eventprio, ep->eventid.Nix, ep->eventid.BirthTime.tv_sec,
ep->eventid.Idx, ep->supobject.Objid.vid, ep->supobject.Objid.oix, 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 { } else {
if (m_items[item_idx].options & pwr_mSevOptionsMask_HighTimeResolution) { if (m_items[item_idx].options & pwr_mSevOptionsMask_HighTimeResolution) {
...@@ -2626,25 +2686,27 @@ int sev_dbms::store_event( ...@@ -2626,25 +2686,27 @@ int sev_dbms::store_event(
"eventid_nix, eventid_birthtime," "eventid_nix, eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, " "eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size," "supobject_offset, supobject_size,"
"eventtext, eventname) values " "eventtext, eventname, eventstatus) values "
"('%s',%ld,%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')", "('%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, m_items[item_idx].tablename, timstr, (long int)ep->time.tv_nsec,
ep->type, ep->eventprio, ep->eventid.Nix, ep->type, ep->eventprio, ep->eventid.Nix,
ep->eventid.BirthTime.tv_sec, ep->eventid.Idx, ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix, 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 { } else {
// Sql time, low resolution // Sql time, low resolution
sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, " sprintf(query, "insert into %s (time, eventtype, eventprio, eventid_nix, "
"eventid_birthtime," "eventid_birthtime,"
"eventid_idx, supobject_vid, supobject_oix, " "eventid_idx, supobject_vid, supobject_oix, "
"supobject_offset, supobject_size," "supobject_offset, supobject_size,"
"eventtext, eventname) values " "eventtext, eventname, eventstatus) values "
"('%s',%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s')", "('%s',%d,%d,%d,%d,%d,%u,%u,%u,%u,'%s','%s',%u)",
m_items[item_idx].tablename, timstr, ep->type, ep->eventprio, m_items[item_idx].tablename, timstr, ep->type, ep->eventprio,
ep->eventid.Nix, ep->eventid.BirthTime.tv_sec, ep->eventid.Idx, ep->eventid.Nix, ep->eventid.BirthTime.tv_sec, ep->eventid.Idx,
ep->supobject.Objid.vid, ep->supobject.Objid.oix, 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); rc = mysql_query(con, query);
...@@ -4803,11 +4865,11 @@ int sev_dbms::get_events(pwr_tStatus *sts, void *thread, pwr_tOid oid, ...@@ -4803,11 +4865,11 @@ int sev_dbms::get_events(pwr_tStatus *sts, void *thread, pwr_tOid oid,
if (options & pwr_mSevOptionsMask_HighTimeResolution) if (options & pwr_mSevOptionsMask_HighTimeResolution)
strcpy(column_part, "time,ntime,eventtype,eventprio,eventid_nix,eventid_birthtime," strcpy(column_part, "time,ntime,eventtype,eventprio,eventid_nix,eventid_birthtime,"
"eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext," "eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext,"
"eventname"); "eventname,eventstatus");
else else
strcpy(column_part, "time,eventtype,eventprio,eventid_nix,eventid_birthtime," strcpy(column_part, "time,eventtype,eventprio,eventid_nix,eventid_birthtime,"
"eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext," "eventid_idx,supobject_vid,supobject_oix,supobject_offset,supobject_size,eventtext,"
"eventname"); "eventname,eventstatus");
// 'order by' part // 'order by' part
if (options & pwr_mSevOptionsMask_HighTimeResolution) if (options & pwr_mSevOptionsMask_HighTimeResolution)
...@@ -5043,6 +5105,7 @@ int sev_dbms::get_events(pwr_tStatus *sts, void *thread, pwr_tOid oid, ...@@ -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); e.supobject.Size = strtoul(row[j++], 0, 10);
strncpy(e.eventtext, row[j++], sizeof(e.eventtext)); strncpy(e.eventtext, row[j++], sizeof(e.eventtext));
strncpy(e.eventname, row[j++], sizeof(e.eventname)); strncpy(e.eventname, row[j++], sizeof(e.eventname));
e.eventstatus = strtoul(row[j++], 0, 10);
list.push_back(e); list.push_back(e);
} }
printf("ecnt %ld\n", list.size()); printf("ecnt %ld\n", list.size());
......
...@@ -81,6 +81,7 @@ public: ...@@ -81,6 +81,7 @@ public:
int checkAndUpdateVersion(unsigned int version); int checkAndUpdateVersion(unsigned int version);
int updateDBToSevVersion2(void); int updateDBToSevVersion2(void);
int updateDBToSevVersion4(void); int updateDBToSevVersion4(void);
int updateDBToSevVersion5(void);
int createSevVersion2Tables(void); int createSevVersion2Tables(void);
int createSevVersion3Tables(void); int createSevVersion3Tables(void);
MYSQL* createDb(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> ...@@ -60,7 +60,7 @@ Index <index>
<topic> mva_introduction <topic> mva_introduction
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. ProviewR system.
</topic> </topic>
......
...@@ -240,6 +240,8 @@ copy : \ ...@@ -240,6 +240,8 @@ copy : \
$(doc_dir)/en_us/man_exlib.pdf \ $(doc_dir)/en_us/man_exlib.pdf \
$(doc_dir)/en_us/man_exlib.ps \ $(doc_dir)/en_us/man_exlib.ps \
$(web_dir)/pwr_logga.png \ $(web_dir)/pwr_logga.png \
$(exe_dir)/en_us/man_mva.dat \
$(exe_dir)/en_us/man_eva.dat \
$(mediatargets) $(csstargets) \ $(mediatargets) $(csstargets) \
$(export_html) $(export_html_en_us) $(export_html_sv_se) \ $(export_html) $(export_html_en_us) $(export_html_sv_se) \
$(doc_dir)/en_us/changelog.html | silent $(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 ...@@ -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" @ echo "Generating pdf for en_us/man_exlib"
@ $(co_convert) -f -d $(doc_dir)/en_us $(source) @ $(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 \ $(doc_dir)/en_us/changelog.html : $(pwre_croot)/src/changelog.txt \
$(pwre_croot)/xtt/changelog.txt \ $(pwre_croot)/xtt/changelog.txt \
$(pwre_croot)/wb/changelog.txt \ $(pwre_croot)/wb/changelog.txt \
......
...@@ -874,7 +874,10 @@ int rt_sevhistmon::send_data() ...@@ -874,7 +874,10 @@ int rt_sevhistmon::send_data()
if (!qcom_Put(&sts, &tgt, &put)) { if (!qcom_Put(&sts, &tgt, &put)) {
m_hs[i].threadp->ErrorCount++; 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; conf_sts = sts;
qcom_Free(&sts, put.data); qcom_Free(&sts, put.data);
continue; continue;
...@@ -967,7 +970,10 @@ int rt_sevhistmon::send_exportdata() ...@@ -967,7 +970,10 @@ int rt_sevhistmon::send_exportdata()
if (!qcom_Put(&sts, &tgt, &put)) { if (!qcom_Put(&sts, &tgt, &put)) {
m_hs[i].threadp->ErrorCount++; 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; conf_sts = sts;
qcom_Free(&sts, put.data); qcom_Free(&sts, put.data);
continue; continue;
...@@ -1492,6 +1498,7 @@ pwr_tStatus rt_sevhistmon::mh_ack_bc(mh_sAck* msg) ...@@ -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_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset; ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size; ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1514,6 +1521,7 @@ pwr_tStatus rt_sevhistmon::mh_return_bc(mh_sReturn* msg) ...@@ -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_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset; ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size; ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1537,7 +1545,9 @@ pwr_tStatus rt_sevhistmon::mh_alarm_bc(mh_sMessage* msg) ...@@ -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_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset; ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size; ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = msg->Status;
printf("alarm_bc, %u\n", msg->Status);
if (shm->m_sevhistevents) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1560,6 +1570,7 @@ pwr_tStatus rt_sevhistmon::mh_block_bc(mh_sBlock* msg) ...@@ -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_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset; ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size; ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1583,6 +1594,7 @@ pwr_tStatus rt_sevhistmon::mh_cancel_bc(mh_sReturn* msg) ...@@ -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_oix = msg->SupObject.Objid.oix;
ed.sup_aref_offset = msg->SupObject.Offset; ed.sup_aref_offset = msg->SupObject.Offset;
ed.sup_aref_size = msg->SupObject.Size; ed.sup_aref_size = msg->SupObject.Size;
ed.eventstatus = 0;
if (shm->m_sevhistevents) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1602,6 +1614,11 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg) ...@@ -1602,6 +1614,11 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg)
ed.eventid_idx = msg->Info.Id.Idx; ed.eventid_idx = msg->Info.Id.Idx;
ed.eventid_nix = msg->Info.Id.Nix; ed.eventid_nix = msg->Info.Id.Nix;
ed.eventid_birthtime = msg->Info.Id.BirthTime.tv_sec; 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) if (shm->m_sevhistevents)
shm->m_sevhistevents->evbuf_insert(&ed); shm->m_sevhistevents->evbuf_insert(&ed);
...@@ -1611,6 +1628,22 @@ pwr_tStatus rt_sevhistmon::mh_info_bc(mh_sMessage* msg) ...@@ -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 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; return 1;
} }
...@@ -1694,6 +1727,7 @@ void sev_sevhistevents::evbuf_send() ...@@ -1694,6 +1727,7 @@ void sev_sevhistevents::evbuf_send()
unsigned int ev_cnt = 0; unsigned int ev_cnt = 0;
if (evbuf_sent == ev_cInit) { if (evbuf_sent == ev_cInit) {
for (unsigned int idx = evbuf_oldest;;) { for (unsigned int idx = evbuf_oldest;;) {
printf("evbuf_send, %u\n", event_buffer[idx].eventstatus);
memcpy(&((sev_sMsgEventsStore*)put.data)->Events[ev_cnt], memcpy(&((sev_sMsgEventsStore*)put.data)->Events[ev_cnt],
&event_buffer[idx], sizeof(sev_sEvent)); &event_buffer[idx], sizeof(sev_sEvent));
ev_cnt++; ev_cnt++;
...@@ -1727,7 +1761,10 @@ void sev_sevhistevents::evbuf_send() ...@@ -1727,7 +1761,10 @@ void sev_sevhistevents::evbuf_send()
if (!qcom_Put(&sts, &tgt, &put)) { if (!qcom_Put(&sts, &tgt, &put)) {
monitor->m_hs[event_thread_idx].threadp->ErrorCount++; 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); qcom_Free(&sts, put.data);
} }
monitor->m_hs[event_thread_idx].threadp->SendCount++; monitor->m_hs[event_thread_idx].threadp->SendCount++;
......
...@@ -4271,7 +4271,7 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args) ...@@ -4271,7 +4271,7 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args)
result = PyTuple_New(listcnt); result = PyTuple_New(listcnt);
for ( i = 0; i < listcnt; i++) { for ( i = 0; i < listcnt; i++) {
item_tuple = PyTuple_New(7); item_tuple = PyTuple_New(8);
eventid_tuple = PyTuple_New(2); eventid_tuple = PyTuple_New(2);
if ( time_string) { if ( time_string) {
/* Time string */ /* Time string */
...@@ -4293,11 +4293,12 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args) ...@@ -4293,11 +4293,12 @@ static PyObject *pwrrt_getSevEvents(PyObject *self, PyObject *args)
PyTuple_SetItem(item_tuple, 4, PyString_FromString(list[i].EventName)); PyTuple_SetItem(item_tuple, 4, PyString_FromString(list[i].EventName));
strcpy(supobject, cdh_ObjidToString(list[i].SupObjectOid, 1)); strcpy(supobject, cdh_ObjidToString(list[i].SupObjectOid, 1));
if (list[i].SupObjectOffset > 0) 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(item_tuple, 5, PyString_FromString(supobject));
PyTuple_SetItem(eventid_tuple, 0, PyInt_FromLong((long)list[i].EventId.Nix)); 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(eventid_tuple, 1, PyInt_FromLong((long)list[i].EventId.Idx));
PyTuple_SetItem(item_tuple, 6, eventid_tuple); PyTuple_SetItem(item_tuple, 6, eventid_tuple);
PyTuple_SetItem(item_tuple, 7, PyInt_FromLong((long)list[i].EventStatus));
PyTuple_SetItem(result, i, item_tuple); PyTuple_SetItem(result, i, item_tuple);
} }
...@@ -4386,7 +4387,7 @@ static PyObject *pwrrt_getSevEventsDataFrame(PyObject *self, PyObject *args) ...@@ -4386,7 +4387,7 @@ static PyObject *pwrrt_getSevEventsDataFrame(PyObject *self, PyObject *args)
result = PyList_New(listcnt); result = PyList_New(listcnt);
for ( i = 0; i < listcnt; i++) { for ( i = 0; i < listcnt; i++) {
item_tuple = PyTuple_New(7); item_tuple = PyTuple_New(8);
eventid_tuple = PyTuple_New(2); eventid_tuple = PyTuple_New(2);
if ( time_string) { if ( time_string) {
/* Time string */ /* Time string */
...@@ -4413,6 +4414,7 @@ static PyObject *pwrrt_getSevEventsDataFrame(PyObject *self, PyObject *args) ...@@ -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, 0, PyInt_FromLong((long)list[i].EventId.Nix));
PyTuple_SetItem(eventid_tuple, 1, PyInt_FromLong((long)list[i].EventId.Idx)); PyTuple_SetItem(eventid_tuple, 1, PyInt_FromLong((long)list[i].EventId.Idx));
PyTuple_SetItem(item_tuple, 6, eventid_tuple); PyTuple_SetItem(item_tuple, 6, eventid_tuple);
PyTuple_SetItem(item_tuple, 7, PyInt_FromLong((long)list[i].EventStatus));
PyList_SetItem(result, i, item_tuple); PyList_SetItem(result, i, item_tuple);
} }
......
...@@ -48,7 +48,9 @@ extern "C" { ...@@ -48,7 +48,9 @@ extern "C" {
#define sev_eProcSevServer 122 #define sev_eProcSevServer 122
#define sev_eProcSevImport 123 #define sev_eProcSevImport 123
#define sev_cMsgClass 202 #define sev_cMsgClass 202
#define sev_cNetVersion 1 #define sev_cNetVersion 2
#define sev_eEvent_ClearAlarmList 2147483647
typedef enum { typedef enum {
sev_eMsgType_NodeUp, sev_eMsgType_NodeUp,
...@@ -123,6 +125,7 @@ typedef struct { ...@@ -123,6 +125,7 @@ typedef struct {
unsigned int sup_aref_oix; unsigned int sup_aref_oix;
unsigned int sup_aref_offset; unsigned int sup_aref_offset;
unsigned int sup_aref_size; unsigned int sup_aref_size;
unsigned int eventstatus;
} sev_sEvent; } sev_sEvent;
typedef struct { typedef struct {
...@@ -344,6 +347,7 @@ typedef struct { ...@@ -344,6 +347,7 @@ typedef struct {
pwr_tString80 EventText; pwr_tString80 EventText;
pwr_tOName EventName; pwr_tOName EventName;
mh_sEventId EventId; mh_sEventId EventId;
pwr_tUInt32 EventStatus;
} sev_sEvents; } sev_sEvents;
typedef struct { typedef struct {
......
...@@ -846,10 +846,12 @@ int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid, ...@@ -846,10 +846,12 @@ int sevcli_get_events(pwr_tStatus* sts, sevcli_tCtx ctx, pwr_tOid oid,
lp->EventType = ip->EventType; lp->EventType = ip->EventType;
lp->EventPrio = ip->EventPrio; lp->EventPrio = ip->EventPrio;
lp->SupObjectOid = ip->SupObjectOid; lp->SupObjectOid = ip->SupObjectOid;
lp->SupObjectOffset = ip->SupObjectOffset;
lp->SupObjectSize = ip->SupObjectSize; lp->SupObjectSize = ip->SupObjectSize;
strncpy(lp->EventText, ip->EventText, sizeof(lp->EventText)); strncpy(lp->EventText, ip->EventText, sizeof(lp->EventText));
strncpy(lp->EventName, ip->EventName, sizeof(lp->EventName)); strncpy(lp->EventName, ip->EventName, sizeof(lp->EventName));
lp->EventId = ip->EventId; lp->EventId = ip->EventId;
lp->EventStatus = ip->EventStatus;
lp++; lp++;
ip++; ip++;
} }
......
...@@ -105,6 +105,7 @@ typedef struct { ...@@ -105,6 +105,7 @@ typedef struct {
pwr_tString80 EventText; pwr_tString80 EventText;
pwr_tOName EventName; pwr_tOName EventName;
mh_sEventId EventId; mh_sEventId EventId;
pwr_tUInt32 EventStatus;
} sevcli_sEvents; } sevcli_sEvents;
int sevcli_init(pwr_tStatus* sts, sevcli_tCtx* ctx); int sevcli_init(pwr_tStatus* sts, sevcli_tCtx* ctx);
......
...@@ -57,6 +57,9 @@ nosuchtable <Table doesn't exist> /error ...@@ -57,6 +57,9 @@ nosuchtable <Table doesn't exist> /error
norows <No rows found> /error norows <No rows found> /error
nowrite <Nothings written> /info nowrite <Nothings written> /info
noconnection <Connection has gone> /error 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 .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