"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/go/pkg/zbxlib/eventlog_windows.go" between
zabbix-5.4.0.tar.gz and zabbix-5.4.1.tar.gz

About: ZABBIX is an enterprise-class distributed monitoring solution for servers and applications.

eventlog_windows.go  (zabbix-5.4.0):eventlog_windows.go  (zabbix-5.4.1)
skipping to change at line 146 skipping to change at line 146
*/ */
import "C" import "C"
import ( import (
"errors" "errors"
"time" "time"
"unsafe" "unsafe"
) )
type EventLogItem struct { type EventLogItem struct {
LastTs time.Time // the last log value timestamp + 1ns
Results []*EventLogResult Results []*EventLogResult
Output ResultWriter Output ResultWriter
} }
type EventLogResult struct { type EventLogResult struct {
Value *string Value *string
EventSource *string EventSource *string
EventID *int EventID *int
EventTimestamp *int EventTimestamp *int
EventSeverity *int EventSeverity *int
skipping to change at line 181 skipping to change at line 182
var cerrmsg *C.char var cerrmsg *C.char
ret := C.process_eventlog_check(C.char_lp_t(unsafe.Pointer(result)), 0, C .zbx_vector_ptr_lp_t(cblob), ret := C.process_eventlog_check(C.char_lp_t(unsafe.Pointer(result)), 0, C .zbx_vector_ptr_lp_t(cblob),
C.ZBX_ACTIVE_METRIC_LP(data), C.zbx_process_value_func_t(C.proces s_eventlog_value_cb), &clastLogsizeSent, C.ZBX_ACTIVE_METRIC_LP(data), C.zbx_process_value_func_t(C.proces s_eventlog_value_cb), &clastLogsizeSent,
&cerrmsg) &cerrmsg)
// add cached results // add cached results
var cvalue, csource *C.char var cvalue, csource *C.char
var clogeventid, cseverity, ctimestamp C.int var clogeventid, cseverity, ctimestamp C.int
var clastlogsize C.zbx_uint64_t var clastlogsize C.zbx_uint64_t
logTs := time.Now()
if logTs.Before(item.LastTs) {
logTs = item.LastTs
}
for i := 0; C.get_eventlog_value(result, C.int(i), &cvalue, &csource, &cl ogeventid, &cseverity, &ctimestamp, &cstate, for i := 0; C.get_eventlog_value(result, C.int(i), &cvalue, &csource, &cl ogeventid, &cseverity, &ctimestamp, &cstate,
&clastlogsize) != C.FAIL; i++ { &clastlogsize) != C.FAIL; i++ {
var value, source string var value, source string
var logeventid, severity, timestamp int var logeventid, severity, timestamp int
var r EventLogResult var r EventLogResult
if cstate == C.ITEM_STATE_NORMAL { if cstate == C.ITEM_STATE_NORMAL {
value = C.GoString(cvalue) value = C.GoString(cvalue)
source = C.GoString(csource) source = C.GoString(csource)
logeventid = int(clogeventid) logeventid = int(clogeventid)
severity = int(cseverity) severity = int(cseverity)
timestamp = int(ctimestamp) timestamp = int(ctimestamp)
r = EventLogResult{ r = EventLogResult{
Value: &value, Value: &value,
EventSource: &source, EventSource: &source,
EventID: &logeventid, EventID: &logeventid,
EventSeverity: &severity, EventSeverity: &severity,
EventTimestamp: &timestamp, EventTimestamp: &timestamp,
Ts: time.Now(), Ts: logTs,
LastLogsize: uint64(clastlogsize), LastLogsize: uint64(clastlogsize),
} }
} else { } else {
r = EventLogResult{ r = EventLogResult{
Error: errors.New(C.GoString(cvalue)), Error: errors.New(C.GoString(cvalue)),
Ts: time.Now(), Ts: logTs,
LastLogsize: uint64(clastlogsize), LastLogsize: uint64(clastlogsize),
} }
} }
item.Results = append(item.Results, &r) item.Results = append(item.Results, &r)
logTs = logTs.Add(time.Nanosecond)
} }
C.free_eventlog_result(result) C.free_eventlog_result(result)
item.LastTs = logTs
if ret == C.FAIL { if ret == C.FAIL {
C.metric_set_unsupported(C.ZBX_ACTIVE_METRIC_LP(data)) C.metric_set_unsupported(C.ZBX_ACTIVE_METRIC_LP(data))
var err error var err error
if cerrmsg != nil { if cerrmsg != nil {
err = errors.New(C.GoString(cerrmsg)) err = errors.New(C.GoString(cerrmsg))
C.free(unsafe.Pointer(cerrmsg)) C.free(unsafe.Pointer(cerrmsg))
} else { } else {
err = errors.New("Unknown error.") err = errors.New("Unknown error.")
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)