code refactor

This commit is contained in:
Ulric Qin 2022-04-17 11:05:12 +08:00
parent 6c14694ad1
commit 087c581393
4 changed files with 19 additions and 4 deletions

View File

@ -15,3 +15,17 @@ go build
```shell
tar zcvf categraf.tar.gz categraf conf
```
## todo
[]ntp
[]exec
[]ping
[]net_response
[]http_response
[]scrape
[]procstat
[]oracle
[]mysql
[]redis
[]...

View File

@ -12,6 +12,7 @@ import (
"strconv"
"flashcat.cloud/categraf/inputs"
"flashcat.cloud/categraf/pkg/osx"
"flashcat.cloud/categraf/types"
)
@ -27,7 +28,7 @@ type SysctlFS struct {
func init() {
inputs.Add(inputName, func() inputs.Input {
return &SysctlFS{
path: path.Join(GetHostProc(), "/sys/fs"),
path: path.Join(osx.GetHostProc(), "/sys/fs"),
}
})
}

View File

@ -15,7 +15,7 @@ import (
"syscall"
"flashcat.cloud/categraf/inputs"
"flashcat.cloud/categraf/inputs/linux_sysctl_fs"
"flashcat.cloud/categraf/pkg/osx"
"flashcat.cloud/categraf/types"
)
@ -145,7 +145,7 @@ func (p *Processes) gatherFromPS(fields map[string]interface{}) error {
// get process states from /proc/(pid)/stat files
func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
filenames, err := filepath.Glob(linux_sysctl_fs.GetHostProc() + "/[0-9]*/stat")
filenames, err := filepath.Glob(osx.GetHostProc() + "/[0-9]*/stat")
if err != nil {
return err
}

View File

@ -1,4 +1,4 @@
package linux_sysctl_fs
package osx
import "os"