Update process-exporter methods
This commit is contained in:
parent
2fa55eabf6
commit
1fed943b3d
3 changed files with 25 additions and 20 deletions
|
|
@ -24,9 +24,9 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
ps "github.com/mitchellh/go-ps"
|
||||
"github.com/ncabatoff/process-exporter/proc"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// IsRespawnIfRequired checks if error type is exec.ExitError or not
|
||||
|
|
@ -37,7 +37,7 @@ func IsRespawnIfRequired(err error) bool {
|
|||
}
|
||||
|
||||
waitStatus := exitError.Sys().(syscall.WaitStatus)
|
||||
glog.Warningf(`
|
||||
klog.Warningf(`
|
||||
-------------------------------------------------------------------------------
|
||||
NGINX master process died (%v): %v
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
@ -56,9 +56,9 @@ func WaitUntilPortIsAvailable(port int) {
|
|||
}
|
||||
conn.Close()
|
||||
// kill nginx worker processes
|
||||
fs, err := proc.NewFS("/proc")
|
||||
fs, err := proc.NewFS("/proc", false)
|
||||
if err != nil {
|
||||
glog.Errorf("unexpected error reading /proc information: %v", err)
|
||||
klog.Errorf("unexpected error reading /proc information: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
@ -66,14 +66,14 @@ func WaitUntilPortIsAvailable(port int) {
|
|||
for _, p := range procs {
|
||||
pn, err := p.Comm()
|
||||
if err != nil {
|
||||
glog.Errorf("unexpected error obtaining process information: %v", err)
|
||||
klog.Errorf("unexpected error obtaining process information: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if pn == "nginx" {
|
||||
osp, err := os.FindProcess(p.PID)
|
||||
if err != nil {
|
||||
glog.Errorf("unexpected error obtaining process information: %v", err)
|
||||
klog.Errorf("unexpected error obtaining process information: %v", err)
|
||||
continue
|
||||
}
|
||||
osp.Signal(syscall.SIGQUIT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue