@cryptotaxi247 / netdata-1 / commits / 25e45b6a7

add go.d samba (#18418)

Ilya Mashchenko committed Aug 26, 2024 at 20:50 UTC 25e45b6a717782af6180b83eb3c7cb7942fe4c07
16 files changed +1358 -1
src/collectors/python.d.plugin/python.d.conf
+1 -1
@@ -34,7 +34,6 @@ go_expvar: no
34 # oracledb: yes
35 # pandas: yes
36 # retroshare: yes
37 -# samba: yes
37 # smartd_log: yes
38 # spigotmc: yes
39 # traefik: yes
@@ -73,6 +72,7 @@ proxysql: no # Removed (replaced with go.d/proxysql).
72 redis: no # Removed (replaced with go.d/redis).
73 rethinkdbs: no # Removed (replaced with go.d/rethinkdb).
74 riakkv: no # Removed (replaced with go.d/riak).
75 +samba: no # Removed (replaced with go.d/samba).
76 sensors: no # Removed (replaced with go.d/sensors).
77 squid: no # Removed (replaced with go.d/squid).
78 tomcat: no # Removed (replaced with go.d/tomcat)
src/go/plugin/go.d/README.md
+1
@@ -132,6 +132,7 @@ see the appropriate collector readme.
132 | [rethinkdb](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/rethinkdb) | RethinkDB |
133 | [riakkv](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/riakkv) | Riak KV |
134 | [rspamd](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/rspamd) | Rspamd |
135 +| [samba](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/samba) | Samba |
136 | [scaleio](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/scaleio) | Dell EMC ScaleIO |
137 | [sensors](https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/sensors) | Hardware Sensors |
138 | [SNMP](https://github.com/netdata/netdata/blob/master/src/go/plugin/go.d/modules/snmp) | SNMP |
src/go/plugin/go.d/config/go.d.conf
+1
@@ -96,6 +96,7 @@ modules:
96 # rethinkdb: yes
97 # riakkv: yes
98 # rspamd: yes
99 +# samba: yes
100 # scaleio: yes
101 # sensors: yes
102 # snmp: yes
src/go/plugin/go.d/config/go.d/samba.conf new
+5
@@ -0,0 +1,5 @@
1 +## All available configuration options, their descriptions and default values:
2 +## https://github.com/netdata/netdata/tree/master/src/go/plugin/go.d/modules/samba#readme
3 +
4 +jobs:
5 + - name: samba
src/go/plugin/go.d/modules/init.go
+1
@@ -88,6 +88,7 @@ import (
88 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/rethinkdb"
89 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/riakkv"
90 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/rspamd"
91 + _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/samba"
92 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/scaleio"
93 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/sensors"
94 _ "github.com/netdata/netdata/go/plugins/plugin/go.d/modules/smartctl"
src/go/plugin/go.d/modules/samba/charts.go new
+124
@@ -0,0 +1,124 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + "fmt"
7 + "strings"
8 +
9 + "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
10 +)
11 +
12 +const (
13 + prioSyscallCalls = module.Priority + iota
14 + prioSyscallTransferredData
15 +
16 + prioSmb2CallCalls
17 + prioSmb2CallTransferredData
18 +)
19 +
20 +var (
21 + syscallCallsChartTmpl = module.Chart{
22 + ID: "syscall_%s_calls",
23 + Title: "Syscalls Count",
24 + Units: "calls/s",
25 + Fam: "syscalls",
26 + Ctx: "samba.syscall_calls",
27 + Priority: prioSyscallCalls,
28 + Type: module.Line,
29 + Dims: module.Dims{
30 + {ID: "syscall_%s_count", Name: "syscalls", Algo: module.Incremental},
31 + },
32 + }
33 + syscallTransferredDataChartTmpl = module.Chart{
34 + ID: "syscall_%s_transferred_data",
35 + Title: "Syscall Transferred Data",
36 + Units: "bytes/s",
37 + Fam: "syscalls",
38 + Ctx: "samba.syscall_transferred_data",
39 + Priority: prioSyscallTransferredData,
40 + Type: module.Area,
41 + Dims: module.Dims{
42 + {ID: "syscall_%s_bytes", Name: "transferred", Algo: module.Incremental},
43 + },
44 + }
45 +
46 + smb2CallCallsChartTmpl = module.Chart{
47 + ID: "smb2_call_%s_calls",
48 + Title: "SMB2 Calls Count",
49 + Units: "calls/s",
50 + Fam: "smb2 calls",
51 + Ctx: "samba.smb2_call_calls",
52 + Priority: prioSmb2CallCalls,
53 + Type: module.Line,
54 + Dims: module.Dims{
55 + {ID: "smb2_%s_count", Name: "smb2", Algo: module.Incremental},
56 + },
57 + }
58 + smb2CallTransferredDataChartTmpl = module.Chart{
59 + ID: "smb2_call_%s_transferred_data",
60 + Title: "SMB2 Call Transferred Data",
61 + Units: "bytes/s",
62 + Fam: "smb2 calls",
63 + Ctx: "samba.smb2_call_transferred_data",
64 + Priority: prioSmb2CallTransferredData,
65 + Type: module.Area,
66 + Dims: module.Dims{
67 + {ID: "smb2_%s_inbytes", Name: "in", Algo: module.Incremental},
68 + {ID: "smb2_%s_outbytes", Name: "out", Algo: module.Incremental, Mul: -1},
69 + },
70 + }
71 +)
72 +
73 +func (s *Samba) addCharts(mx map[string]int64) {
74 + for k := range mx {
75 + if name, ok := extractCallName(k, "syscall_", "_count"); ok {
76 + s.addSysCallChart(name, syscallCallsChartTmpl.Copy())
77 + } else if name, ok := extractCallName(k, "syscall_", "_bytes"); ok {
78 + s.addSysCallChart(name, syscallTransferredDataChartTmpl.Copy())
79 + } else if name, ok := extractCallName(k, "smb2_", "_count"); ok {
80 + s.addSmb2CallChart(name, smb2CallCallsChartTmpl.Copy())
81 + // all smb2* metrics have inbytes and outbytes
82 + s.addSmb2CallChart(name, smb2CallTransferredDataChartTmpl.Copy())
83 + }
84 + }
85 +}
86 +
87 +func (s *Samba) addSysCallChart(syscall string, chart *module.Chart) {
88 + chart = chart.Copy()
89 + chart.ID = fmt.Sprintf(chart.ID, syscall)
90 + chart.Labels = []module.Label{
91 + {Key: "syscall", Value: syscall},
92 + }
93 + for _, dim := range chart.Dims {
94 + dim.ID = fmt.Sprintf(dim.ID, syscall)
95 + }
96 +
97 + if err := s.Charts().Add(chart); err != nil {
98 + s.Warning(err)
99 + }
100 +}
101 +
102 +func (s *Samba) addSmb2CallChart(smb2Call string, chart *module.Chart) {
103 + chart = chart.Copy()
104 + chart.ID = fmt.Sprintf(chart.ID, smb2Call)
105 + chart.Labels = []module.Label{
106 + {Key: "smb2call", Value: smb2Call},
107 + }
108 + for _, dim := range chart.Dims {
109 + dim.ID = fmt.Sprintf(dim.ID, smb2Call)
110 + }
111 +
112 + if err := s.Charts().Add(chart); err != nil {
113 + s.Warning(err)
114 + }
115 +}
116 +
117 +func extractCallName(s, prefix, suffix string) (string, bool) {
118 + if !(strings.HasPrefix(s, prefix) && strings.HasSuffix(s, suffix)) {
119 + return "", false
120 + }
121 + name := strings.TrimPrefix(s, prefix)
122 + name = strings.TrimSuffix(name, suffix)
123 + return name, true
124 +}
src/go/plugin/go.d/modules/samba/collect.go new
+71
@@ -0,0 +1,71 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + "bufio"
7 + "bytes"
8 + "errors"
9 + "strconv"
10 + "strings"
11 +)
12 +
13 +func (s *Samba) collect() (map[string]int64, error) {
14 + bs, err := s.exec.profile()
15 + if err != nil {
16 + return nil, err
17 + }
18 +
19 + mx := make(map[string]int64)
20 +
21 + if err := s.collectSmbStatusProfile(mx, bs); err != nil {
22 + return nil, err
23 + }
24 +
25 + s.once.Do(func() {
26 + s.addCharts(mx)
27 + })
28 +
29 + return mx, nil
30 +}
31 +
32 +func (s *Samba) collectSmbStatusProfile(mx map[string]int64, profileData []byte) error {
33 + sc := bufio.NewScanner(bytes.NewReader(profileData))
34 +
35 + for sc.Scan() {
36 + line := strings.TrimSpace(sc.Text())
37 +
38 + switch {
39 + case strings.HasPrefix(line, "syscall_"):
40 + case strings.HasPrefix(line, "smb2_"):
41 + default:
42 + continue
43 + }
44 +
45 + key, value, ok := strings.Cut(line, ":")
46 + if !ok {
47 + s.Debugf("failed to parse line: '%s'", line)
48 + continue
49 + }
50 +
51 + key, value = strings.TrimSpace(key), strings.TrimSpace(value)
52 +
53 + if !(strings.HasSuffix(key, "count") || strings.HasSuffix(key, "bytes")) {
54 + continue
55 + }
56 +
57 + v, err := strconv.ParseInt(value, 10, 64)
58 + if err != nil {
59 + s.Debugf("failed to parse value in '%s': %v", line, err)
60 + continue
61 + }
62 +
63 + mx[key] = v
64 + }
65 +
66 + if len(mx) == 0 {
67 + return errors.New("unexpected smbstatus profile response: no metrics found")
68 + }
69 +
70 + return nil
71 +}
src/go/plugin/go.d/modules/samba/config_schema.json new
+35
@@ -0,0 +1,35 @@
1 +{
2 + "jsonSchema": {
3 + "$schema": "http://json-schema.org/draft-07/schema#",
4 + "title": "Samba collector configuration.",
5 + "type": "object",
6 + "properties": {
7 + "update_every": {
8 + "title": "Update every",
9 + "description": "Data collection interval, measured in seconds.",
10 + "type": "integer",
11 + "minimum": 1,
12 + "default": 10
13 + },
14 + "timeout": {
15 + "title": "Timeout",
16 + "description": "Timeout for executing the binary, specified in seconds.",
17 + "type": "number",
18 + "minimum": 0.5,
19 + "default": 2
20 + }
21 + },
22 + "additionalProperties": false,
23 + "patternProperties": {
24 + "^name$": {}
25 + }
26 + },
27 + "uiSchema": {
28 + "uiOptions": {
29 + "fullPage": true
30 + },
31 + "timeout": {
32 + "ui:help": "Accepts decimals for precise control (e.g., type 1.5 for 1.5 seconds)."
33 + }
34 + }
35 +}
src/go/plugin/go.d/modules/samba/exec.go new
+47
@@ -0,0 +1,47 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + "context"
7 + "fmt"
8 + "os/exec"
9 + "time"
10 +
11 + "github.com/netdata/netdata/go/plugins/logger"
12 +)
13 +
14 +type smbStatusBinary interface {
15 + profile() ([]byte, error)
16 +}
17 +
18 +func newSmbStatusBinary(ndsudoPath string, timeout time.Duration, log *logger.Logger) smbStatusBinary {
19 + return &smbStatusExec{
20 + Logger: log,
21 + ndsudoPath: ndsudoPath,
22 + timeout: timeout,
23 + }
24 +}
25 +
26 +type smbStatusExec struct {
27 + *logger.Logger
28 +
29 + ndsudoPath string
30 + timeout time.Duration
31 +}
32 +
33 +func (e *smbStatusExec) profile() ([]byte, error) {
34 + ctx, cancel := context.WithTimeout(context.Background(), e.timeout)
35 + defer cancel()
36 +
37 + cmd := exec.CommandContext(ctx, e.ndsudoPath, "smbstatus-profile")
38 +
39 + e.Debugf("executing '%s'", cmd)
40 +
41 + bs, err := cmd.Output()
42 + if err != nil {
43 + return nil, fmt.Errorf("error on '%s': %v", cmd, err)
44 + }
45 +
46 + return bs, nil
47 +}
src/go/plugin/go.d/modules/samba/init.go new
+23
@@ -0,0 +1,23 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + "fmt"
7 + "os"
8 + "path/filepath"
9 +
10 + "github.com/netdata/netdata/go/plugins/pkg/executable"
11 +)
12 +
13 +func (s *Samba) initSmbStatusBinary() (smbStatusBinary, error) {
14 + ndsudoPath := filepath.Join(executable.Directory, "ndsudo")
15 + if _, err := os.Stat(ndsudoPath); err != nil {
16 + return nil, fmt.Errorf("ndsudo executable not found: %v", err)
17 +
18 + }
19 +
20 + smbStatus := newSmbStatusBinary(ndsudoPath, s.Timeout.Duration(), s.Logger)
21 +
22 + return smbStatus, nil
23 +}
src/go/plugin/go.d/modules/samba/metadata.yaml new
+153
@@ -0,0 +1,153 @@
1 +plugin_name: go.d.plugin
2 +modules:
3 + - meta:
4 + id: collector-go.d.plugin-samba
5 + plugin_name: go.d.plugin
6 + module_name: samba
7 + monitored_instance:
8 + name: Samba
9 + link: "https://www.samba.org/samba/"
10 + icon_filename: 'samba.svg'
11 + categories:
12 + - data-collection.storage-mount-points-and-filesystems
13 + keywords:
14 + - samba
15 + - smb
16 + - file sharing
17 + related_resources:
18 + integrations:
19 + list: []
20 + info_provided_to_referring_integrations:
21 + description: ""
22 + most_popular: false
23 + overview:
24 + data_collection:
25 + metrics_description: >
26 + This collector monitors Samba syscalls and SMB2 calls.
27 + It relies on the [`smbstatus`](https://www.samba.org/samba/docs/current/man-html/smbstatus.1.html CLI tool but avoids directly executing the binary.
28 + Instead, it utilizes `ndsudo`, a Netdata helper specifically designed to run privileged commands securely within the Netdata environment.
29 + This approach eliminates the need to use `sudo`, improving security and potentially simplifying permission management.
30 +
31 + Executed commands:
32 +
33 + - `smbstatus -P`
34 + method_description: ""
35 + supported_platforms:
36 + include: []
37 + exclude: []
38 + multi_instance: false
39 + additional_permissions:
40 + description: ""
41 + default_behavior:
42 + auto_detection:
43 + description: ""
44 + limits:
45 + description: ""
46 + performance_impact:
47 + description: ""
48 + setup:
49 + prerequisites:
50 + list:
51 + - title: "Verifying and Enabling Profiling for SMBd"
52 + description: |
53 + 1. **Check for Profiling Support**
54 +
55 + Before enabling profiling, it's important to verify if `smbd` was compiled with profiling capabilities. Run the following command as root user (using `sudo`) to check:
56 +
57 + ```bash
58 + $ sudo smbd --build-options | grep WITH_PROFILE
59 + WITH_PROFILE
60 + ```
61 +
62 + If the command outputs `WITH_PROFILE`, profiling is supported. If not, you'll need to recompile `smbd` with profiling enabled (refer to Samba documentation for specific instructions).
63 +
64 + 2. **Enable Profiling**
65 +
66 + Once you've confirmed profiling support, you can enable it using one of the following methods:
67 +
68 + - **Command-Line Option**
69 + Start smbd with the `-P 1` option when invoking it directly from the command line.
70 + - **Configuration File**
71 + Modify the `smb.conf` configuration file located at `/etc/samba/smb.conf` (the path might vary slightly depending on your system). Add the following line to the `[global]` section:
72 +
73 + ```bash
74 + smbd profiling level = count
75 + ```
76 + 3. **Restart the Samba service**
77 + configuration:
78 + file:
79 + name: go.d/samba.conf
80 + options:
81 + description: |
82 + The following options can be defined globally: update_every.
83 + folding:
84 + title: Config options
85 + enabled: true
86 + list:
87 + - name: update_every
88 + description: Data collection frequency.
89 + default_value: 10
90 + required: false
91 + - name: timeout
92 + description: smbstatus binary execution timeout.
93 + default_value: 2
94 + required: false
95 + examples:
96 + folding:
97 + title: Config
98 + enabled: true
99 + list:
100 + - name: Custom update_every
101 + description: Allows you to override the default data collection interval.
102 + config: |
103 + jobs:
104 + - name: samba
105 + update_every: 5 # Collect statistics every 5 seconds
106 + troubleshooting:
107 + problems:
108 + list: []
109 + alerts: []
110 + metrics:
111 + folding:
112 + title: Metrics
113 + enabled: false
114 + description: ""
115 + availability: []
116 + scopes:
117 + - name: syscall
118 + description: These metrics refer to the the Syscall.
119 + labels:
120 + - name: syscall
121 + description: Syscall name
122 + metrics:
123 + - name: samba.syscall_calls
124 + description: Syscalls Count
125 + unit: calls/s
126 + chart_type: line
127 + dimensions:
128 + - name: syscalls
129 + - name: samba.syscall_transferred_data
130 + description: Syscalls Transferred Data
131 + unit: bytes/s
132 + chart_type: area
133 + dimensions:
134 + - name: transferred
135 + - name: smb2call
136 + description: These metrics refer to the the SMB2 Call.
137 + labels:
138 + - name: smb2call
139 + description: SMB2 call name
140 + metrics:
141 + - name: samba.smb2_call_calls
142 + description: SMB2 Calls Count
143 + unit: calls/s
144 + chart_type: line
145 + dimensions:
146 + - name: smb2
147 + - name: samba.smb2_call_transferred_data
148 + description: SMB2 Call Transferred Data
149 + unit: bytes/s
150 + chart_type: area
151 + dimensions:
152 + - name: in
153 + - name: out
src/go/plugin/go.d/modules/samba/samba.go new
+100
@@ -0,0 +1,100 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + _ "embed"
7 + "errors"
8 + "sync"
9 + "time"
10 +
11 + "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
12 + "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/web"
13 +)
14 +
15 +//go:embed "config_schema.json"
16 +var configSchema string
17 +
18 +func init() {
19 + module.Register("samba", module.Creator{
20 + JobConfigSchema: configSchema,
21 + Defaults: module.Defaults{
22 + UpdateEvery: 10,
23 + },
24 + Create: func() module.Module { return New() },
25 + Config: func() any { return &Config{} },
26 + })
27 +}
28 +
29 +func New() *Samba {
30 + return &Samba{
31 + Config: Config{
32 + Timeout: web.Duration(time.Second * 2),
33 + },
34 + charts: &module.Charts{},
35 + once: &sync.Once{},
36 + }
37 +}
38 +
39 +type Config struct {
40 + UpdateEvery int `yaml:"update_every,omitempty" json:"update_every"`
41 + Timeout web.Duration `yaml:"timeout,omitempty" json:"timeout"`
42 +}
43 +
44 +type Samba struct {
45 + module.Base
46 + Config `yaml:",inline" json:""`
47 +
48 + charts *module.Charts
49 + once *sync.Once
50 +
51 + exec smbStatusBinary
52 +}
53 +
54 +func (s *Samba) Configuration() any {
55 + return s.Config
56 +}
57 +
58 +func (s *Samba) Init() error {
59 + smbStatus, err := s.initSmbStatusBinary()
60 + if err != nil {
61 + s.Errorf("smbstatus exec initialization: %v", err)
62 + return err
63 + }
64 + s.exec = smbStatus
65 +
66 + return nil
67 +}
68 +
69 +func (s *Samba) Check() error {
70 + mx, err := s.collect()
71 + if err != nil {
72 + s.Error(err)
73 + return err
74 + }
75 +
76 + if len(mx) == 0 {
77 + return errors.New("no metrics collected")
78 + }
79 +
80 + return nil
81 +}
82 +
83 +func (s *Samba) Charts() *module.Charts {
84 + return s.charts
85 +}
86 +
87 +func (s *Samba) Collect() map[string]int64 {
88 + mx, err := s.collect()
89 + if err != nil {
90 + s.Error(err)
91 + }
92 +
93 + if len(mx) == 0 {
94 + return nil
95 + }
96 +
97 + return mx
98 +}
99 +
100 +func (s *Samba) Cleanup() {}
src/go/plugin/go.d/modules/samba/samba_test.go new
+339
@@ -0,0 +1,339 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +package samba
4 +
5 +import (
6 + "errors"
7 + "os"
8 + "testing"
9 +
10 + "github.com/netdata/netdata/go/plugins/plugin/go.d/agent/module"
11 +
12 + "github.com/stretchr/testify/assert"
13 + "github.com/stretchr/testify/require"
14 +)
15 +
16 +var (
17 + dataConfigJSON, _ = os.ReadFile("testdata/config.json")
18 + dataConfigYAML, _ = os.ReadFile("testdata/config.yaml")
19 +
20 + dataSmbStatusProfile, _ = os.ReadFile("testdata/smbstatus-profile.txt")
21 +)
22 +
23 +func Test_testDataIsValid(t *testing.T) {
24 + for name, data := range map[string][]byte{
25 + "dataConfigJSON": dataConfigJSON,
26 + "dataConfigYAML": dataConfigYAML,
27 + "dataSmbStatusProfile": dataSmbStatusProfile,
28 + } {
29 + require.NotNil(t, data, name)
30 +
31 + }
32 +}
33 +
34 +func TestSamba_Configuration(t *testing.T) {
35 + module.TestConfigurationSerialize(t, &Samba{}, dataConfigJSON, dataConfigYAML)
36 +}
37 +
38 +func TestSamba_Init(t *testing.T) {
39 + tests := map[string]struct {
40 + config Config
41 + wantFail bool
42 + }{
43 + "fails if failed to locate ndsudo": {
44 + wantFail: true,
45 + config: New().Config,
46 + },
47 + }
48 +
49 + for name, test := range tests {
50 + t.Run(name, func(t *testing.T) {
51 + smb := New()
52 + smb.Config = test.config
53 +
54 + if test.wantFail {
55 + assert.Error(t, smb.Init())
56 + } else {
57 + assert.NoError(t, smb.Init())
58 + }
59 + })
60 + }
61 +}
62 +
63 +func TestSamba_Cleanup(t *testing.T) {
64 + tests := map[string]struct {
65 + prepare func() *Samba
66 + }{
67 + "not initialized exec": {
68 + prepare: func() *Samba {
69 + return New()
70 + },
71 + },
72 + "after check": {
73 + prepare: func() *Samba {
74 + smb := New()
75 + smb.exec = prepareMockOk()
76 + _ = smb.Check()
77 + return smb
78 + },
79 + },
80 + "after collect": {
81 + prepare: func() *Samba {
82 + smb := New()
83 + smb.exec = prepareMockOk()
84 + _ = smb.Collect()
85 + return smb
86 + },
87 + },
88 + }
89 +
90 + for name, test := range tests {
91 + t.Run(name, func(t *testing.T) {
92 + smb := test.prepare()
93 +
94 + assert.NotPanics(t, smb.Cleanup)
95 + })
96 + }
97 +}
98 +
99 +func TestSambaCharts(t *testing.T) {
100 + assert.NotNil(t, New().Charts())
101 +}
102 +
103 +func TestSamba_Check(t *testing.T) {
104 + tests := map[string]struct {
105 + prepareMock func() *mockSmbStatusBinary
106 + wantFail bool
107 + }{
108 + "success case": {
109 + prepareMock: prepareMockOk,
110 + wantFail: false,
111 + },
112 + "error on exec": {
113 + prepareMock: prepareMockErr,
114 + wantFail: true,
115 + },
116 + "empty response": {
117 + prepareMock: prepareMockEmptyResponse,
118 + wantFail: true,
119 + },
120 + "unexpected response": {
121 + prepareMock: prepareMockUnexpectedResponse,
122 + wantFail: true,
123 + },
124 + }
125 +
126 + for name, test := range tests {
127 + t.Run(name, func(t *testing.T) {
128 + smb := New()
129 + mock := test.prepareMock()
130 + smb.exec = mock
131 +
132 + if test.wantFail {
133 + assert.Error(t, smb.Check())
134 + } else {
135 + assert.NoError(t, smb.Check())
136 + }
137 + })
138 + }
139 +}
140 +
141 +func TestSamba_Collect(t *testing.T) {
142 + tests := map[string]struct {
143 + prepareMock func() *mockSmbStatusBinary
144 + wantMetrics map[string]int64
145 + wantCharts int
146 + }{
147 + "success case": {
148 + prepareMock: prepareMockOk,
149 + wantCharts: 53 /*syscall count*/ + 8 /*syscall bytes*/ + (19 * 2), /*smb2calls count and bytes*/
150 + wantMetrics: map[string]int64{
151 + "smb2_break_count": 0,
152 + "smb2_break_inbytes": 0,
153 + "smb2_break_outbytes": 0,
154 + "smb2_cancel_count": 0,
155 + "smb2_cancel_inbytes": 0,
156 + "smb2_cancel_outbytes": 0,
157 + "smb2_close_count": 0,
158 + "smb2_close_inbytes": 0,
159 + "smb2_close_outbytes": 0,
160 + "smb2_create_count": 0,
161 + "smb2_create_inbytes": 0,
162 + "smb2_create_outbytes": 0,
163 + "smb2_find_count": 0,
164 + "smb2_find_inbytes": 0,
165 + "smb2_find_outbytes": 0,
166 + "smb2_flush_count": 0,
167 + "smb2_flush_inbytes": 0,
168 + "smb2_flush_outbytes": 0,
169 + "smb2_getinfo_count": 0,
170 + "smb2_getinfo_inbytes": 0,
171 + "smb2_getinfo_outbytes": 0,
172 + "smb2_ioctl_count": 0,
173 + "smb2_ioctl_inbytes": 0,
174 + "smb2_ioctl_outbytes": 0,
175 + "smb2_keepalive_count": 0,
176 + "smb2_keepalive_inbytes": 0,
177 + "smb2_keepalive_outbytes": 0,
178 + "smb2_lock_count": 0,
179 + "smb2_lock_inbytes": 0,
180 + "smb2_lock_outbytes": 0,
181 + "smb2_logoff_count": 0,
182 + "smb2_logoff_inbytes": 0,
183 + "smb2_logoff_outbytes": 0,
184 + "smb2_negprot_count": 0,
185 + "smb2_negprot_inbytes": 0,
186 + "smb2_negprot_outbytes": 0,
187 + "smb2_notify_count": 0,
188 + "smb2_notify_inbytes": 0,
189 + "smb2_notify_outbytes": 0,
190 + "smb2_read_count": 0,
191 + "smb2_read_inbytes": 0,
192 + "smb2_read_outbytes": 0,
193 + "smb2_sesssetup_count": 0,
194 + "smb2_sesssetup_inbytes": 0,
195 + "smb2_sesssetup_outbytes": 0,
196 + "smb2_setinfo_count": 0,
197 + "smb2_setinfo_inbytes": 0,
198 + "smb2_setinfo_outbytes": 0,
199 + "smb2_tcon_count": 0,
200 + "smb2_tcon_inbytes": 0,
201 + "smb2_tcon_outbytes": 0,
202 + "smb2_tdis_count": 0,
203 + "smb2_tdis_inbytes": 0,
204 + "smb2_tdis_outbytes": 0,
205 + "smb2_write_count": 0,
206 + "smb2_write_inbytes": 0,
207 + "smb2_write_outbytes": 0,
208 + "syscall_asys_fsync_bytes": 0,
209 + "syscall_asys_fsync_count": 0,
210 + "syscall_asys_getxattrat_bytes": 0,
211 + "syscall_asys_getxattrat_count": 0,
212 + "syscall_asys_pread_bytes": 0,
213 + "syscall_asys_pread_count": 0,
214 + "syscall_asys_pwrite_bytes": 0,
215 + "syscall_asys_pwrite_count": 0,
216 + "syscall_brl_cancel_count": 0,
217 + "syscall_brl_lock_count": 0,
218 + "syscall_brl_unlock_count": 0,
219 + "syscall_chdir_count": 0,
220 + "syscall_chmod_count": 0,
221 + "syscall_close_count": 0,
222 + "syscall_closedir_count": 0,
223 + "syscall_createfile_count": 0,
224 + "syscall_fallocate_count": 0,
225 + "syscall_fchmod_count": 0,
226 + "syscall_fchown_count": 0,
227 + "syscall_fcntl_count": 0,
228 + "syscall_fcntl_getlock_count": 0,
229 + "syscall_fcntl_lock_count": 0,
230 + "syscall_fdopendir_count": 0,
231 + "syscall_fntimes_count": 0,
232 + "syscall_fstat_count": 0,
233 + "syscall_fstatat_count": 0,
234 + "syscall_ftruncate_count": 0,
235 + "syscall_get_alloc_size_count": 0,
236 + "syscall_get_quota_count": 0,
237 + "syscall_get_sd_count": 0,
238 + "syscall_getwd_count": 0,
239 + "syscall_lchown_count": 0,
240 + "syscall_linkat_count": 0,
241 + "syscall_linux_setlease_count": 0,
242 + "syscall_lseek_count": 0,
243 + "syscall_lstat_count": 0,
244 + "syscall_mkdirat_count": 0,
245 + "syscall_mknodat_count": 0,
246 + "syscall_open_count": 0,
247 + "syscall_openat_count": 0,
248 + "syscall_opendir_count": 0,
249 + "syscall_pread_bytes": 0,
250 + "syscall_pread_count": 0,
251 + "syscall_pwrite_bytes": 0,
252 + "syscall_pwrite_count": 0,
253 + "syscall_readdir_count": 0,
254 + "syscall_readlinkat_count": 0,
255 + "syscall_realpath_count": 0,
256 + "syscall_recvfile_bytes": 0,
257 + "syscall_recvfile_count": 0,
258 + "syscall_renameat_count": 0,
259 + "syscall_rewinddir_count": 0,
260 + "syscall_seekdir_count": 0,
261 + "syscall_sendfile_bytes": 0,
262 + "syscall_sendfile_count": 0,
263 + "syscall_set_quota_count": 0,
264 + "syscall_set_sd_count": 0,
265 + "syscall_stat_count": 0,
266 + "syscall_symlinkat_count": 0,
267 + "syscall_telldir_count": 0,
268 + "syscall_unlinkat_count": 0,
269 + },
270 + },
271 + "error on exec": {
272 + prepareMock: prepareMockErr,
273 + wantMetrics: nil,
274 + },
275 + "empty response": {
276 + prepareMock: prepareMockEmptyResponse,
277 + wantMetrics: nil,
278 + },
279 + "unexpected response": {
280 + prepareMock: prepareMockUnexpectedResponse,
281 + wantMetrics: nil,
282 + },
283 + }
284 +
285 + for name, test := range tests {
286 + t.Run(name, func(t *testing.T) {
287 + smb := New()
288 + mock := test.prepareMock()
289 + smb.exec = mock
290 +
291 + mx := smb.Collect()
292 +
293 + assert.Equal(t, test.wantMetrics, mx)
294 +
295 + if len(test.wantMetrics) > 0 {
296 + assert.Len(t, *smb.Charts(), test.wantCharts, "want charts")
297 + module.TestMetricsHasAllChartsDims(t, smb.Charts(), mx)
298 + }
299 + })
300 + }
301 +}
302 +
303 +func prepareMockOk() *mockSmbStatusBinary {
304 + return &mockSmbStatusBinary{
305 + data: dataSmbStatusProfile,
306 + }
307 +}
308 +
309 +func prepareMockErr() *mockSmbStatusBinary {
310 + return &mockSmbStatusBinary{
311 + err: true,
312 + }
313 +}
314 +
315 +func prepareMockEmptyResponse() *mockSmbStatusBinary {
316 + return &mockSmbStatusBinary{}
317 +}
318 +
319 +func prepareMockUnexpectedResponse() *mockSmbStatusBinary {
320 + return &mockSmbStatusBinary{
321 + data: []byte(`
322 +Lorem ipsum dolor sit amet, consectetur adipiscing elit.
323 +Nulla malesuada erat id magna mattis, eu viverra tellus rhoncus.
324 +Fusce et felis pulvinar, posuere sem non, porttitor eros.
325 +`),
326 + }
327 +}
328 +
329 +type mockSmbStatusBinary struct {
330 + err bool
331 + data []byte
332 +}
333 +
334 +func (m *mockSmbStatusBinary) profile() ([]byte, error) {
335 + if m.err {
336 + return nil, errors.New("mock.profile() error")
337 + }
338 + return m.data, nil
339 +}
src/go/plugin/go.d/modules/samba/testdata/config.json new
+4
@@ -0,0 +1,4 @@
1 +{
2 + "update_every": 123,
3 + "timeout": 123.123
4 +}
src/go/plugin/go.d/modules/samba/testdata/config.yaml new
+2
@@ -0,0 +1,2 @@
1 +update_every: 123
2 +timeout: 123.123
src/go/plugin/go.d/modules/samba/testdata/smbstatus-profile.txt new
+451
@@ -0,0 +1,451 @@
1 +**** SMBD loop ****************************************************************
2 +connect_count: 0
3 +disconnect_count: 0
4 +idle_count: 0
5 +idle_time: 0
6 +cpu_user_time: 0
7 +cpu_system_time: 0
8 +request_count: 0
9 +push_sec_ctx_count: 0
10 +push_sec_ctx_time: 0
11 +set_sec_ctx_count: 0
12 +set_sec_ctx_time: 0
13 +set_root_sec_ctx_count: 0
14 +set_root_sec_ctx_time: 0
15 +pop_sec_ctx_count: 0
16 +pop_sec_ctx_time: 0
17 +**** System Calls *************************************************************
18 +syscall_opendir_count: 0
19 +syscall_opendir_time: 0
20 +syscall_fdopendir_count: 0
21 +syscall_fdopendir_time: 0
22 +syscall_readdir_count: 0
23 +syscall_readdir_time: 0
24 +syscall_seekdir_count: 0
25 +syscall_seekdir_time: 0
26 +syscall_telldir_count: 0
27 +syscall_telldir_time: 0
28 +syscall_rewinddir_count: 0
29 +syscall_rewinddir_time: 0
30 +syscall_mkdirat_count: 0
31 +syscall_mkdirat_time: 0
32 +syscall_closedir_count: 0
33 +syscall_closedir_time: 0
34 +syscall_open_count: 0
35 +syscall_open_time: 0
36 +syscall_openat_count: 0
37 +syscall_openat_time: 0
38 +syscall_createfile_count: 0
39 +syscall_createfile_time: 0
40 +syscall_close_count: 0
41 +syscall_close_time: 0
42 +syscall_pread_count: 0
43 +syscall_pread_time: 0
44 +syscall_pread_idle: 0
45 +syscall_pread_bytes: 0
46 +syscall_asys_pread_count: 0
47 +syscall_asys_pread_time: 0
48 +syscall_asys_pread_idle: 0
49 +syscall_asys_pread_bytes: 0
50 +syscall_pwrite_count: 0
51 +syscall_pwrite_time: 0
52 +syscall_pwrite_idle: 0
53 +syscall_pwrite_bytes: 0
54 +syscall_asys_pwrite_count: 0
55 +syscall_asys_pwrite_time: 0
56 +syscall_asys_pwrite_idle: 0
57 +syscall_asys_pwrite_bytes: 0
58 +syscall_lseek_count: 0
59 +syscall_lseek_time: 0
60 +syscall_sendfile_count: 0
61 +syscall_sendfile_time: 0
62 +syscall_sendfile_idle: 0
63 +syscall_sendfile_bytes: 0
64 +syscall_recvfile_count: 0
65 +syscall_recvfile_time: 0
66 +syscall_recvfile_idle: 0
67 +syscall_recvfile_bytes: 0
68 +syscall_renameat_count: 0
69 +syscall_renameat_time: 0
70 +syscall_asys_fsync_count: 0
71 +syscall_asys_fsync_time: 0
72 +syscall_asys_fsync_idle: 0
73 +syscall_asys_fsync_bytes: 0
74 +syscall_stat_count: 0
75 +syscall_stat_time: 0
76 +syscall_fstat_count: 0
77 +syscall_fstat_time: 0
78 +syscall_lstat_count: 0
79 +syscall_lstat_time: 0
80 +syscall_fstatat_count: 0
81 +syscall_fstatat_time: 0
82 +syscall_get_alloc_size_count: 0
83 +syscall_get_alloc_size_time: 0
84 +syscall_unlinkat_count: 0
85 +syscall_unlinkat_time: 0
86 +syscall_chmod_count: 0
87 +syscall_chmod_time: 0
88 +syscall_fchmod_count: 0
89 +syscall_fchmod_time: 0
90 +syscall_fchown_count: 0
91 +syscall_fchown_time: 0
92 +syscall_lchown_count: 0
93 +syscall_lchown_time: 0
94 +syscall_chdir_count: 0
95 +syscall_chdir_time: 0
96 +syscall_getwd_count: 0
97 +syscall_getwd_time: 0
98 +syscall_fntimes_count: 0
99 +syscall_fntimes_time: 0
100 +syscall_ftruncate_count: 0
101 +syscall_ftruncate_time: 0
102 +syscall_fallocate_count: 0
103 +syscall_fallocate_time: 0
104 +syscall_fcntl_lock_count: 0
105 +syscall_fcntl_lock_time: 0
106 +syscall_fcntl_count: 0
107 +syscall_fcntl_time: 0
108 +syscall_linux_setlease_count: 0
109 +syscall_linux_setlease_time: 0
110 +syscall_fcntl_getlock_count: 0
111 +syscall_fcntl_getlock_time: 0
112 +syscall_readlinkat_count: 0
113 +syscall_readlinkat_time: 0
114 +syscall_symlinkat_count: 0
115 +syscall_symlinkat_time: 0
116 +syscall_linkat_count: 0
117 +syscall_linkat_time: 0
118 +syscall_mknodat_count: 0
119 +syscall_mknodat_time: 0
120 +syscall_realpath_count: 0
121 +syscall_realpath_time: 0
122 +syscall_get_quota_count: 0
123 +syscall_get_quota_time: 0
124 +syscall_set_quota_count: 0
125 +syscall_set_quota_time: 0
126 +syscall_get_sd_count: 0
127 +syscall_get_sd_time: 0
128 +syscall_set_sd_count: 0
129 +syscall_set_sd_time: 0
130 +syscall_brl_lock_count: 0
131 +syscall_brl_lock_time: 0
132 +syscall_brl_unlock_count: 0
133 +syscall_brl_unlock_time: 0
134 +syscall_brl_cancel_count: 0
135 +syscall_brl_cancel_time: 0
136 +syscall_asys_getxattrat_count: 0
137 +syscall_asys_getxattrat_time: 0
138 +syscall_asys_getxattrat_idle: 0
139 +syscall_asys_getxattrat_bytes: 0
140 +**** ACL Calls ****************************************************************
141 +get_nt_acl_count: 0
142 +get_nt_acl_time: 0
143 +get_nt_acl_at_count: 0
144 +get_nt_acl_at_time: 0
145 +fget_nt_acl_count: 0
146 +fget_nt_acl_time: 0
147 +fset_nt_acl_count: 0
148 +fset_nt_acl_time: 0
149 +**** Stat Cache ***************************************************************
150 +statcache_lookups_count: 0
151 +statcache_misses_count: 0
152 +statcache_hits_count: 0
153 +**** SMB Calls ****************************************************************
154 +SMBmkdir_count: 0
155 +SMBmkdir_time: 0
156 +SMBrmdir_count: 0
157 +SMBrmdir_time: 0
158 +SMBopen_count: 0
159 +SMBopen_time: 0
160 +SMBcreate_count: 0
161 +SMBcreate_time: 0
162 +SMBclose_count: 0
163 +SMBclose_time: 0
164 +SMBflush_count: 0
165 +SMBflush_time: 0
166 +SMBunlink_count: 0
167 +SMBunlink_time: 0
168 +SMBmv_count: 0
169 +SMBmv_time: 0
170 +SMBgetatr_count: 0
171 +SMBgetatr_time: 0
172 +SMBsetatr_count: 0
173 +SMBsetatr_time: 0
174 +SMBread_count: 0
175 +SMBread_time: 0
176 +SMBwrite_count: 0
177 +SMBwrite_time: 0
178 +SMBlock_count: 0
179 +SMBlock_time: 0
180 +SMBunlock_count: 0
181 +SMBunlock_time: 0
182 +SMBctemp_count: 0
183 +SMBctemp_time: 0
184 +SMBmknew_count: 0
185 +SMBmknew_time: 0
186 +SMBcheckpath_count: 0
187 +SMBcheckpath_time: 0
188 +SMBexit_count: 0
189 +SMBexit_time: 0
190 +SMBlseek_count: 0
191 +SMBlseek_time: 0
192 +SMBlockread_count: 0
193 +SMBlockread_time: 0
194 +SMBwriteunlock_count: 0
195 +SMBwriteunlock_time: 0
196 +SMBreadbraw_count: 0
197 +SMBreadbraw_time: 0
198 +SMBreadBmpx_count: 0
199 +SMBreadBmpx_time: 0
200 +SMBreadBs_count: 0
201 +SMBreadBs_time: 0
202 +SMBwritebraw_count: 0
203 +SMBwritebraw_time: 0
204 +SMBwriteBmpx_count: 0
205 +SMBwriteBmpx_time: 0
206 +SMBwriteBs_count: 0
207 +SMBwriteBs_time: 0
208 +SMBwritec_count: 0
209 +SMBwritec_time: 0
210 +SMBsetattrE_count: 0
211 +SMBsetattrE_time: 0
212 +SMBgetattrE_count: 0
213 +SMBgetattrE_time: 0
214 +SMBlockingX_count: 0
215 +SMBlockingX_time: 0
216 +SMBtrans_count: 0
217 +SMBtrans_time: 0
218 +SMBtranss_count: 0
219 +SMBtranss_time: 0
220 +SMBioctl_count: 0
221 +SMBioctl_time: 0
222 +SMBioctls_count: 0
223 +SMBioctls_time: 0
224 +SMBcopy_count: 0
225 +SMBcopy_time: 0
226 +SMBmove_count: 0
227 +SMBmove_time: 0
228 +SMBecho_count: 0
229 +SMBecho_time: 0
230 +SMBwriteclose_count: 0
231 +SMBwriteclose_time: 0
232 +SMBopenX_count: 0
233 +SMBopenX_time: 0
234 +SMBreadX_count: 0
235 +SMBreadX_time: 0
236 +SMBwriteX_count: 0
237 +SMBwriteX_time: 0
238 +SMBtrans2_count: 0
239 +SMBtrans2_time: 0
240 +SMBtranss2_count: 0
241 +SMBtranss2_time: 0
242 +SMBfindclose_count: 0
243 +SMBfindclose_time: 0
244 +SMBfindnclose_count: 0
245 +SMBfindnclose_time: 0
246 +SMBtcon_count: 0
247 +SMBtcon_time: 0
248 +SMBtdis_count: 0
249 +SMBtdis_time: 0
250 +SMBnegprot_count: 0
251 +SMBnegprot_time: 0
252 +SMBsesssetupX_count: 0
253 +SMBsesssetupX_time: 0
254 +SMBulogoffX_count: 0
255 +SMBulogoffX_time: 0
256 +SMBtconX_count: 0
257 +SMBtconX_time: 0
258 +SMBdskattr_count: 0
259 +SMBdskattr_time: 0
260 +SMBsearch_count: 0
261 +SMBsearch_time: 0
262 +SMBffirst_count: 0
263 +SMBffirst_time: 0
264 +SMBfunique_count: 0
265 +SMBfunique_time: 0
266 +SMBfclose_count: 0
267 +SMBfclose_time: 0
268 +SMBnttrans_count: 0
269 +SMBnttrans_time: 0
270 +SMBnttranss_count: 0
271 +SMBnttranss_time: 0
272 +SMBntcreateX_count: 0
273 +SMBntcreateX_time: 0
274 +SMBntcancel_count: 0
275 +SMBntcancel_time: 0
276 +SMBntrename_count: 0
277 +SMBntrename_time: 0
278 +SMBsplopen_count: 0
279 +SMBsplopen_time: 0
280 +SMBsplwr_count: 0
281 +SMBsplwr_time: 0
282 +SMBsplclose_count: 0
283 +SMBsplclose_time: 0
284 +SMBsplretq_count: 0
285 +SMBsplretq_time: 0
286 +SMBsends_count: 0
287 +SMBsends_time: 0
288 +SMBsendb_count: 0
289 +SMBsendb_time: 0
290 +SMBfwdname_count: 0
291 +SMBfwdname_time: 0
292 +SMBcancelf_count: 0
293 +SMBcancelf_time: 0
294 +SMBgetmac_count: 0
295 +SMBgetmac_time: 0
296 +SMBsendstrt_count: 0
297 +SMBsendstrt_time: 0
298 +SMBsendend_count: 0
299 +SMBsendend_time: 0
300 +SMBsendtxt_count: 0
301 +SMBsendtxt_time: 0
302 +SMBinvalid_count: 0
303 +SMBinvalid_time: 0
304 +**** Trans2 Calls *************************************************************
305 +Trans2_open_count: 0
306 +Trans2_open_time: 0
307 +Trans2_findfirst_count: 0
308 +Trans2_findfirst_time: 0
309 +Trans2_findnext_count: 0
310 +Trans2_findnext_time: 0
311 +Trans2_qfsinfo_count: 0
312 +Trans2_qfsinfo_time: 0
313 +Trans2_setfsinfo_count: 0
314 +Trans2_setfsinfo_time: 0
315 +Trans2_qpathinfo_count: 0
316 +Trans2_qpathinfo_time: 0
317 +Trans2_setpathinfo_count: 0
318 +Trans2_setpathinfo_time: 0
319 +Trans2_qfileinfo_count: 0
320 +Trans2_qfileinfo_time: 0
321 +Trans2_setfileinfo_count: 0
322 +Trans2_setfileinfo_time: 0
323 +Trans2_fsctl_count: 0
324 +Trans2_fsctl_time: 0
325 +Trans2_ioctl_count: 0
326 +Trans2_ioctl_time: 0
327 +Trans2_findnotifyfirst_count: 0
328 +Trans2_findnotifyfirst_time: 0
329 +Trans2_findnotifynext_count: 0
330 +Trans2_findnotifynext_time: 0
331 +Trans2_mkdir_count: 0
332 +Trans2_mkdir_time: 0
333 +Trans2_session_setup_count: 0
334 +Trans2_session_setup_time: 0
335 +Trans2_get_dfs_referral_count: 0
336 +Trans2_get_dfs_referral_time: 0
337 +Trans2_report_dfs_inconsistancy_count: 0
338 +Trans2_report_dfs_inconsistancy_time: 0
339 +**** NT Transact Calls ********************************************************
340 +NT_transact_create_count: 0
341 +NT_transact_create_time: 0
342 +NT_transact_ioctl_count: 0
343 +NT_transact_ioctl_time: 0
344 +NT_transact_set_security_desc_count: 0
345 +NT_transact_set_security_desc_time: 0
346 +NT_transact_notify_change_count: 0
347 +NT_transact_notify_change_time: 0
348 +NT_transact_rename_count: 0
349 +NT_transact_rename_time: 0
350 +NT_transact_query_security_desc_count: 0
351 +NT_transact_query_security_desc_time: 0
352 +NT_transact_get_user_quota_count: 0
353 +NT_transact_get_user_quota_time: 0
354 +NT_transact_set_user_quota_count: 0
355 +NT_transact_set_user_quota_time: 0
356 +**** SMB2 Calls ***************************************************************
357 +smb2_negprot_count: 0
358 +smb2_negprot_time: 0
359 +smb2_negprot_idle: 0
360 +smb2_negprot_inbytes: 0
361 +smb2_negprot_outbytes: 0
362 +smb2_sesssetup_count: 0
363 +smb2_sesssetup_time: 0
364 +smb2_sesssetup_idle: 0
365 +smb2_sesssetup_inbytes: 0
366 +smb2_sesssetup_outbytes: 0
367 +smb2_logoff_count: 0
368 +smb2_logoff_time: 0
369 +smb2_logoff_idle: 0
370 +smb2_logoff_inbytes: 0
371 +smb2_logoff_outbytes: 0
372 +smb2_tcon_count: 0
373 +smb2_tcon_time: 0
374 +smb2_tcon_idle: 0
375 +smb2_tcon_inbytes: 0
376 +smb2_tcon_outbytes: 0
377 +smb2_tdis_count: 0
378 +smb2_tdis_time: 0
379 +smb2_tdis_idle: 0
380 +smb2_tdis_inbytes: 0
381 +smb2_tdis_outbytes: 0
382 +smb2_create_count: 0
383 +smb2_create_time: 0
384 +smb2_create_idle: 0
385 +smb2_create_inbytes: 0
386 +smb2_create_outbytes: 0
387 +smb2_close_count: 0
388 +smb2_close_time: 0
389 +smb2_close_idle: 0
390 +smb2_close_inbytes: 0
391 +smb2_close_outbytes: 0
392 +smb2_flush_count: 0
393 +smb2_flush_time: 0
394 +smb2_flush_idle: 0
395 +smb2_flush_inbytes: 0
396 +smb2_flush_outbytes: 0
397 +smb2_read_count: 0
398 +smb2_read_time: 0
399 +smb2_read_idle: 0
400 +smb2_read_inbytes: 0
401 +smb2_read_outbytes: 0
402 +smb2_write_count: 0
403 +smb2_write_time: 0
404 +smb2_write_idle: 0
405 +smb2_write_inbytes: 0
406 +smb2_write_outbytes: 0
407 +smb2_lock_count: 0
408 +smb2_lock_time: 0
409 +smb2_lock_idle: 0
410 +smb2_lock_inbytes: 0
411 +smb2_lock_outbytes: 0
412 +smb2_ioctl_count: 0
413 +smb2_ioctl_time: 0
414 +smb2_ioctl_idle: 0
415 +smb2_ioctl_inbytes: 0
416 +smb2_ioctl_outbytes: 0
417 +smb2_cancel_count: 0
418 +smb2_cancel_time: 0
419 +smb2_cancel_idle: 0
420 +smb2_cancel_inbytes: 0
421 +smb2_cancel_outbytes: 0
422 +smb2_keepalive_count: 0
423 +smb2_keepalive_time: 0
424 +smb2_keepalive_idle: 0
425 +smb2_keepalive_inbytes: 0
426 +smb2_keepalive_outbytes: 0
427 +smb2_find_count: 0
428 +smb2_find_time: 0
429 +smb2_find_idle: 0
430 +smb2_find_inbytes: 0
431 +smb2_find_outbytes: 0
432 +smb2_notify_count: 0
433 +smb2_notify_time: 0
434 +smb2_notify_idle: 0
435 +smb2_notify_inbytes: 0
436 +smb2_notify_outbytes: 0
437 +smb2_getinfo_count: 0
438 +smb2_getinfo_time: 0
439 +smb2_getinfo_idle: 0
440 +smb2_getinfo_inbytes: 0
441 +smb2_getinfo_outbytes: 0
442 +smb2_setinfo_count: 0
443 +smb2_setinfo_time: 0
444 +smb2_setinfo_idle: 0
445 +smb2_setinfo_inbytes: 0
446 +smb2_setinfo_outbytes: 0
447 +smb2_break_count: 0
448 +smb2_break_time: 0
449 +smb2_break_idle: 0
450 +smb2_break_inbytes: 0
451 +smb2_break_outbytes: 0