code refactor
This commit is contained in:
parent
6c14694ad1
commit
087c581393
14
README.md
14
README.md
|
@ -15,3 +15,17 @@ go build
|
||||||
```shell
|
```shell
|
||||||
tar zcvf categraf.tar.gz categraf conf
|
tar zcvf categraf.tar.gz categraf conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## todo
|
||||||
|
|
||||||
|
[]ntp
|
||||||
|
[]exec
|
||||||
|
[]ping
|
||||||
|
[]net_response
|
||||||
|
[]http_response
|
||||||
|
[]scrape
|
||||||
|
[]procstat
|
||||||
|
[]oracle
|
||||||
|
[]mysql
|
||||||
|
[]redis
|
||||||
|
[]...
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"flashcat.cloud/categraf/inputs"
|
"flashcat.cloud/categraf/inputs"
|
||||||
|
"flashcat.cloud/categraf/pkg/osx"
|
||||||
"flashcat.cloud/categraf/types"
|
"flashcat.cloud/categraf/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ type SysctlFS struct {
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add(inputName, func() inputs.Input {
|
inputs.Add(inputName, func() inputs.Input {
|
||||||
return &SysctlFS{
|
return &SysctlFS{
|
||||||
path: path.Join(GetHostProc(), "/sys/fs"),
|
path: path.Join(osx.GetHostProc(), "/sys/fs"),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"flashcat.cloud/categraf/inputs"
|
"flashcat.cloud/categraf/inputs"
|
||||||
"flashcat.cloud/categraf/inputs/linux_sysctl_fs"
|
"flashcat.cloud/categraf/pkg/osx"
|
||||||
"flashcat.cloud/categraf/types"
|
"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
|
// get process states from /proc/(pid)/stat files
|
||||||
func (p *Processes) gatherFromProc(fields map[string]interface{}) error {
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package linux_sysctl_fs
|
package osx
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
Loading…
Reference in New Issue