mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 10:45:06 +01:00 
			
		
		
		
	Format fixes
This commit is contained in:
		@@ -1,15 +1,15 @@
 | 
				
			|||||||
package collectors
 | 
					package collectors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"encoding/json"
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	lp "github.com/influxdata/line-protocol"
 | 
						lp "github.com/influxdata/line-protocol"
 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
						"os/exec"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
	"os"
 | 
					 | 
				
			||||||
	"os/exec"
 | 
					 | 
				
			||||||
	"encoding/json"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const IPMITOOL_PATH = `/usr/bin/ipmitool`
 | 
					const IPMITOOL_PATH = `/usr/bin/ipmitool`
 | 
				
			||||||
@@ -82,7 +82,7 @@ func ReadIpmiTool(cmd string, out *[]lp.MutableMetric) {
 | 
				
			|||||||
				unit = "W"
 | 
									unit = "W"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			y, err := lp.New(name, map[string]string{"unit": unit, "type" : "node"}, map[string]interface{}{"value": v}, time.Now())
 | 
								y, err := lp.New(name, map[string]string{"unit": unit, "type": "node"}, map[string]interface{}{"value": v}, time.Now())
 | 
				
			||||||
			if err == nil {
 | 
								if err == nil {
 | 
				
			||||||
				*out = append(*out, y)
 | 
									*out = append(*out, y)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -108,7 +108,7 @@ func ReadIpmiSensors(cmd string, out *[]lp.MutableMetric) {
 | 
				
			|||||||
			v, err := strconv.ParseFloat(lv[3], 64)
 | 
								v, err := strconv.ParseFloat(lv[3], 64)
 | 
				
			||||||
			if err == nil {
 | 
								if err == nil {
 | 
				
			||||||
				name := strings.ToLower(strings.Replace(lv[1], " ", "_", -1))
 | 
									name := strings.ToLower(strings.Replace(lv[1], " ", "_", -1))
 | 
				
			||||||
			    y, err := lp.New(name, map[string]string{"unit": lv[4], "type" : "node"}, map[string]interface{}{"value": v}, time.Now())
 | 
									y, err := lp.New(name, map[string]string{"unit": lv[4], "type": "node"}, map[string]interface{}{"value": v}, time.Now())
 | 
				
			||||||
				if err == nil {
 | 
									if err == nil {
 | 
				
			||||||
					*out = append(*out, y)
 | 
										*out = append(*out, y)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
package collectors
 | 
					package collectors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	lp "github.com/influxdata/line-protocol"
 | 
						lp "github.com/influxdata/line-protocol"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
@@ -9,12 +10,10 @@ import (
 | 
				
			|||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
	"encoding/json"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const HWMON_PATH = `/sys/class/hwmon`
 | 
					const HWMON_PATH = `/sys/class/hwmon`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
type TempCollectorConfig struct {
 | 
					type TempCollectorConfig struct {
 | 
				
			||||||
	ExcludeMetrics []string                     `json:"exclude_metrics"`
 | 
						ExcludeMetrics []string                     `json:"exclude_metrics"`
 | 
				
			||||||
	TagOverride    map[string]map[string]string `json:"tag_override"`
 | 
						TagOverride    map[string]map[string]string `json:"tag_override"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ var Collectors = map[string]collectors.MetricGetter{
 | 
				
			|||||||
	"customcmd":  &collectors.CustomCmdCollector{},
 | 
						"customcmd":  &collectors.CustomCmdCollector{},
 | 
				
			||||||
	"diskstat":   &collectors.DiskstatCollector{},
 | 
						"diskstat":   &collectors.DiskstatCollector{},
 | 
				
			||||||
	"tempstat":   &collectors.TempCollector{},
 | 
						"tempstat":   &collectors.TempCollector{},
 | 
				
			||||||
	"ipmistat" :  &collectors.IpmiCollector{},
 | 
						"ipmistat":   &collectors.IpmiCollector{},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var Sinks = map[string]sinks.SinkFuncs{
 | 
					var Sinks = map[string]sinks.SinkFuncs{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user