mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-11-10 04:27:25 +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")
|
Path for logfile (default "stderr")
|
||||||
-once
|
-once
|
||||||
Run all collectors only once
|
Run all collectors only once
|
||||||
-pidfile string
|
|
||||||
Path for PID file (default "/var/run/cc-metric-collector.pid")
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"loadavg": {
|
"loadavg": {
|
||||||
"exclude_metrics": [ "proc_total" ]
|
"exclude_metrics": [ "proc_total" ]
|
||||||
}
|
},
|
||||||
"tempstat": {
|
"tempstat": {
|
||||||
"tag_override": {
|
"tag_override": {
|
||||||
"hwmon0" : {
|
"hwmon0" : {
|
||||||
@ -19,3 +19,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
type CentralConfigFile struct {
|
type CentralConfigFile struct {
|
||||||
Interval int `json:"interval"`
|
Interval int `json:"interval"`
|
||||||
Duration int `json:"duration"`
|
Duration int `json:"duration"`
|
||||||
Pidfile string `json:"pidfile,omitempty"`
|
|
||||||
CollectorConfigFile string `json:"collectors"`
|
CollectorConfigFile string `json:"collectors"`
|
||||||
RouterConfigFile string `json:"router"`
|
RouterConfigFile string `json:"router"`
|
||||||
SinkConfigFile string `json:"sinks"`
|
SinkConfigFile string `json:"sinks"`
|
||||||
@ -87,14 +86,12 @@ func ReadCli() map[string]string {
|
|||||||
var m map[string]string
|
var m map[string]string
|
||||||
cfg := flag.String("config", "./config.json", "Path to configuration file")
|
cfg := flag.String("config", "./config.json", "Path to configuration file")
|
||||||
logfile := flag.String("log", "stderr", "Path for logfile")
|
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")
|
once := flag.Bool("once", false, "Run all collectors only once")
|
||||||
debug := flag.Bool("debug", false, "Activate debug output")
|
debug := flag.Bool("debug", false, "Activate debug output")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
m = make(map[string]string)
|
m = make(map[string]string)
|
||||||
m["configfile"] = *cfg
|
m["configfile"] = *cfg
|
||||||
m["logfile"] = *logfile
|
m["logfile"] = *logfile
|
||||||
m["pidfile"] = *pidfile
|
|
||||||
if *once {
|
if *once {
|
||||||
m["once"] = "true"
|
m["once"] = "true"
|
||||||
} else {
|
} else {
|
||||||
@ -125,25 +122,6 @@ func ReadCli() map[string]string {
|
|||||||
// return nil
|
// 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
|
// General shutdownHandler function that gets executed in case of interrupt or graceful shutdownHandler
|
||||||
func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
|
func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
|
||||||
defer config.Sync.Done()
|
defer config.Sync.Done()
|
||||||
@ -174,11 +152,6 @@ func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
|
|||||||
cclog.Debug("Shutdown SinkManager...")
|
cclog.Debug("Shutdown SinkManager...")
|
||||||
config.SinkManager.Close()
|
config.SinkManager.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// pidfile := config.ConfigFile.Pidfile
|
|
||||||
// RemovePidfile(pidfile)
|
|
||||||
// pidfile = config.CliArgs["pidfile"]
|
|
||||||
// RemovePidfile(pidfile)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func mainFunc() int {
|
func mainFunc() int {
|
||||||
@ -226,8 +199,6 @@ func mainFunc() int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// err = CreatePidfile(rcfg.CliArgs["pidfile"])
|
|
||||||
|
|
||||||
// Set log file
|
// Set log file
|
||||||
if logfile := rcfg.CliArgs["logfile"]; logfile != "stderr" {
|
if logfile := rcfg.CliArgs["logfile"]; logfile != "stderr" {
|
||||||
cclog.SetOutput(logfile)
|
cclog.SetOutput(logfile)
|
||||||
|
@ -15,6 +15,3 @@ CONF_DIR=/etc/cc-metric-collector
|
|||||||
CONF_FILE=/etc/cc-metric-collector/cc-metric-collector.json
|
CONF_FILE=/etc/cc-metric-collector/cc-metric-collector.json
|
||||||
|
|
||||||
RESTART_ON_UPGRADE=true
|
RESTART_ON_UPGRADE=true
|
||||||
|
|
||||||
# Only used on systemd systems
|
|
||||||
PID_FILE_DIR=/var/run
|
|
||||||
|
@ -14,11 +14,7 @@ Restart=on-failure
|
|||||||
WorkingDirectory=/tmp
|
WorkingDirectory=/tmp
|
||||||
RuntimeDirectory=cc-metric-collector
|
RuntimeDirectory=cc-metric-collector
|
||||||
RuntimeDirectoryMode=0750
|
RuntimeDirectoryMode=0750
|
||||||
ExecStart=/usr/sbin/cc-metric-collector \
|
ExecStart=/usr/sbin/cc-metric-collector --config=${CONF_FILE}
|
||||||
--config=${CONF_FILE} \
|
|
||||||
--pidfile=${PID_FILE_DIR}/cc-metric-collector.pid
|
|
||||||
|
|
||||||
|
|
||||||
LimitNOFILE=10000
|
LimitNOFILE=10000
|
||||||
TimeoutStopSec=20
|
TimeoutStopSec=20
|
||||||
UMask=0027
|
UMask=0027
|
||||||
|
Loading…
Reference in New Issue
Block a user