File tree Expand file tree Collapse file tree 3 files changed +53
-3
lines changed
pkg/systemstatsmonitor/types Expand file tree Collapse file tree 3 files changed +53
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ package types
18
18
19
19
import (
20
20
"fmt"
21
- "os"
22
21
"regexp"
23
22
"time"
24
23
)
27
26
defaultInvokeIntervalString = (60 * time .Second ).String ()
28
27
defaultlsblkTimeoutString = (5 * time .Second ).String ()
29
28
defaultKnownModulesConfigPath = "guestosconfig/known-modules.json"
30
- defaultProcPath = "/proc"
31
29
)
32
30
33
31
type MetricConfig struct {
@@ -135,7 +133,7 @@ func (ssc *SystemStatsConfig) Validate() error {
135
133
if ssc .InvokeInterval <= time .Duration (0 ) {
136
134
return fmt .Errorf ("InvokeInterval %v must be above 0s" , ssc .InvokeInterval )
137
135
}
138
- if _ , err := os . Stat ( ssc .ProcPath ); err != nil {
136
+ if err := ssc .validateProcPath ( ); err != nil {
139
137
return fmt .Errorf ("ProcPath %v check failed: %s" , ssc .ProcPath , err )
140
138
}
141
139
if ssc .DiskConfig .LsblkTimeout <= time .Duration (0 ) {
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright 2019 The Kubernetes Authors All rights reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ package types
18
+
19
+ import (
20
+ "os"
21
+ )
22
+
23
+ const defaultProcPath = "/proc"
24
+
25
+ func (ssc * SystemStatsConfig ) validateProcPath () error {
26
+ _ , err := os .Stat (ssc .ProcPath )
27
+ return err
28
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright 2019 The Kubernetes Authors All rights reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ package types
18
+
19
+ const defaultProcPath = ""
20
+
21
+ func (ssc * SystemStatsConfig ) validateProcPath () error {
22
+ // not supported
23
+ return nil
24
+ }
You can’t perform that action at this time.
0 commit comments