Skip to content

Commit

Permalink
Check as raw string
Browse files Browse the repository at this point in the history
  • Loading branch information
deven96 committed Nov 8, 2022
1 parent 78ff292 commit b764d11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 8 additions & 3 deletions inspector/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

// CustomMetrics : Metrics used by Custom
type CustomMetrics struct {
Output string
Output string
Command string
}

// Custom : Parsing the custom command output for disk monitoring
Expand All @@ -29,7 +30,8 @@ func (i *Custom) Parse(output string) {

func (i Custom) createMetric(output string) CustomMetrics {
return CustomMetrics{
Output: output,
Output: output,
Command: i.Command,
}
}

Expand Down Expand Up @@ -61,8 +63,11 @@ func NewCustom(driver *driver.Driver, custom ...string) (Inspector, error) {
if details.IsWeb {
return nil, errors.New(fmt.Sprintf("Cannot use Custom(%s) on web", custom))
}
if len(custom) < 1 {
return nil, errors.New("Must specify command for custom")
}
customInspector = &Custom{
Command: custom[0],
Command: fmt.Sprintf(`%s`, custom[0]),
}
customInspector.SetDriver(driver)
return customInspector, nil
Expand Down
2 changes: 0 additions & 2 deletions inspector/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package inspector
import (
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"

Expand Down Expand Up @@ -151,7 +150,6 @@ smss.exe 604 Services 0 1,080 K
csrss.exe 968 Services 0 4,916 K
*/
func (i *ProcessWin) Parse(output string) {
fmt.Print(output)
var values []ProcessMetricsWin
lines := strings.Split(output, "\r\n")
for index, line := range lines {
Expand Down

0 comments on commit b764d11

Please sign in to comment.