diff options
author | Aleksejs Sestakovs <aleksejs.sestakovs@zabbix.com> | 2022-01-20 13:05:09 +0300 |
---|---|---|
committer | Aleksejs Sestakovs <aleksejs.sestakovs@zabbix.com> | 2022-01-20 13:05:09 +0300 |
commit | 8196c506afa88515b0967a696eb7a0a37ffd4602 (patch) | |
tree | bd8a29715651ff2ea84ca8426775cf969caf4f30 /src/go/plugins | |
parent | be7df5a2f64dee43fcf8c9898d9c4d331f807575 (diff) | |
parent | 0003190e9e52906588db1cf648a0f177e650af12 (diff) |
.......... [ZBX-20416] upgraded to master (without conflicts)
Diffstat (limited to 'src/go/plugins')
-rw-r--r-- | src/go/plugins/windows/perfmon/perfmon.go | 2 | ||||
-rw-r--r-- | src/go/plugins/windows/services/services_windows.go | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/go/plugins/windows/perfmon/perfmon.go b/src/go/plugins/windows/perfmon/perfmon.go index 9831c628384..5a8b8a0b4f0 100644 --- a/src/go/plugins/windows/perfmon/perfmon.go +++ b/src/go/plugins/windows/perfmon/perfmon.go @@ -226,7 +226,7 @@ func (p *Plugin) Export(key string, params []string, ctx plugin.ContextProvider) if interval, err = strconv.ParseInt(params[1], 10, 32); err != nil { return nil, errors.New("Invalid second parameter.") } - if interval < 1 || interval >= maxInterval { + if interval < 1 || interval > maxInterval { return nil, errors.New("Interval out of range.") } } diff --git a/src/go/plugins/windows/services/services_windows.go b/src/go/plugins/windows/services/services_windows.go index 49b72bd3572..5d1e04200f6 100644 --- a/src/go/plugins/windows/services/services_windows.go +++ b/src/go/plugins/windows/services/services_windows.go @@ -62,6 +62,10 @@ const ( startupTypeTrigger ) +const ( + ZBX_NON_EXISTING_SRV = 255 +) + func startupName(startup int) string { switch startup { case startupTypeAuto: @@ -159,9 +163,7 @@ func openServiceEx(m *mgr.Mgr, name string) (s *mgr.Service, err error) { if err == nil { return } - if err.(syscall.Errno) != windows.ERROR_SERVICE_DOES_NOT_EXIST { - return - } + wname, err := win32.GetServiceKeyName(syscall.Handle(m.Handle), name) if err != nil { return @@ -278,7 +280,11 @@ func (p *Plugin) exportServiceInfo(params []string) (result interface{}, err err defer m.Disconnect() service, err := openServiceEx(m, params[0]) + if err != nil { + if err.(syscall.Errno) == windows.ERROR_SERVICE_DOES_NOT_EXIST { + return ZBX_NON_EXISTING_SRV, nil + } return } defer service.Close() |