mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 15:09:05 +01:00
Merge branch 'develop' of github.com:ClusterCockpit/cc-metric-collector into develop
This commit is contained in:
commit
bb87046501
@ -54,8 +54,6 @@ Usage of metric-collector:
|
||||
Path for logfile (default "stderr")
|
||||
-once
|
||||
Run all collectors only once
|
||||
-pidfile string
|
||||
Path for PID file (default "/var/run/cc-metric-collector.pid")
|
||||
```
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
},
|
||||
"loadavg": {
|
||||
"exclude_metrics": [ "proc_total" ]
|
||||
}
|
||||
},
|
||||
"tempstat": {
|
||||
"tag_override": {
|
||||
"hwmon0" : {
|
||||
@ -18,4 +18,5 @@
|
||||
"type-id" : "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import (
|
||||
type CentralConfigFile struct {
|
||||
Interval int `json:"interval"`
|
||||
Duration int `json:"duration"`
|
||||
Pidfile string `json:"pidfile,omitempty"`
|
||||
CollectorConfigFile string `json:"collectors"`
|
||||
RouterConfigFile string `json:"router"`
|
||||
SinkConfigFile string `json:"sinks"`
|
||||
@ -87,14 +86,12 @@ func ReadCli() map[string]string {
|
||||
var m map[string]string
|
||||
cfg := flag.String("config", "./config.json", "Path to configuration file")
|
||||
logfile := flag.String("log", "stderr", "Path for logfile")
|
||||
pidfile := flag.String("pidfile", "/var/run/cc-metric-collector.pid", "Path for PID file")
|
||||
once := flag.Bool("once", false, "Run all collectors only once")
|
||||
debug := flag.Bool("debug", false, "Activate debug output")
|
||||
flag.Parse()
|
||||
m = make(map[string]string)
|
||||
m["configfile"] = *cfg
|
||||
m["logfile"] = *logfile
|
||||
m["pidfile"] = *pidfile
|
||||
if *once {
|
||||
m["once"] = "true"
|
||||
} else {
|
||||
@ -125,25 +122,6 @@ func ReadCli() map[string]string {
|
||||
// return nil
|
||||
//}
|
||||
|
||||
//func CreatePidfile(pidfile string) error {
|
||||
// file, err := os.OpenFile(pidfile, os.O_CREATE|os.O_RDWR, 0600)
|
||||
// if err != nil {
|
||||
// log.Print(err)
|
||||
// return err
|
||||
// }
|
||||
// file.Write([]byte(fmt.Sprintf("%d", os.Getpid())))
|
||||
// file.Close()
|
||||
// return nil
|
||||
//}
|
||||
|
||||
//func RemovePidfile(pidfile string) error {
|
||||
// info, err := os.Stat(pidfile)
|
||||
// if !os.IsNotExist(err) && !info.IsDir() {
|
||||
// os.Remove(pidfile)
|
||||
// }
|
||||
// return nil
|
||||
//}
|
||||
|
||||
// General shutdownHandler function that gets executed in case of interrupt or graceful shutdownHandler
|
||||
func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
|
||||
defer config.Sync.Done()
|
||||
@ -174,11 +152,6 @@ func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
|
||||
cclog.Debug("Shutdown SinkManager...")
|
||||
config.SinkManager.Close()
|
||||
}
|
||||
|
||||
// pidfile := config.ConfigFile.Pidfile
|
||||
// RemovePidfile(pidfile)
|
||||
// pidfile = config.CliArgs["pidfile"]
|
||||
// RemovePidfile(pidfile)
|
||||
}
|
||||
|
||||
func mainFunc() int {
|
||||
@ -226,8 +199,6 @@ func mainFunc() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
// err = CreatePidfile(rcfg.CliArgs["pidfile"])
|
||||
|
||||
// Set log file
|
||||
if logfile := rcfg.CliArgs["logfile"]; logfile != "stderr" {
|
||||
cclog.SetOutput(logfile)
|
||||
|
@ -15,6 +15,3 @@ CONF_DIR=/etc/cc-metric-collector
|
||||
CONF_FILE=/etc/cc-metric-collector/cc-metric-collector.json
|
||||
|
||||
RESTART_ON_UPGRADE=true
|
||||
|
||||
# Only used on systemd systems
|
||||
PID_FILE_DIR=/var/run
|
||||
|
@ -14,11 +14,7 @@ Restart=on-failure
|
||||
WorkingDirectory=/tmp
|
||||
RuntimeDirectory=cc-metric-collector
|
||||
RuntimeDirectoryMode=0750
|
||||
ExecStart=/usr/sbin/cc-metric-collector \
|
||||
--config=${CONF_FILE} \
|
||||
--pidfile=${PID_FILE_DIR}/cc-metric-collector.pid
|
||||
|
||||
|
||||
ExecStart=/usr/sbin/cc-metric-collector --config=${CONF_FILE}
|
||||
LimitNOFILE=10000
|
||||
TimeoutStopSec=20
|
||||
UMask=0027
|
||||
|
Loading…
Reference in New Issue
Block a user