You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

/*
*
@author: sre
@date: 2023/11/19 0019
@desc: todo
*
*/
package main
import (
"fmt"
"testing"
)
func TestGetHostListFromCSV(t *testing.T) {
hosts, err := GetHostListFromCSV()
if err != nil {
fmt.Println(err)
}
for _, host := range hosts {
fmt.Println(host)
}
}
func TestStrclean(t *testing.T) {
s1 := "\"30.1 30.251.46,\","
fmt.Println(strClean(s1))
}
//free
//total used free shared buffers cached
//Mem: 8061204 7876624 184580 708 151620 4761748
//-/+ buffers/cache: 2963256 5097948
//Swap: 8388604 147000 8241604
func TestMemCounts(t *testing.T) {
node_memory_MemFree_bytes := "1.94097152e+08"
node_memory_MemTotal_bytes := "8.254672896e+09"
node_memory_Buffers_bytes := "1.5525888e+08"
node_memory_Cached_bytes := "4.873633792e+09"
free, _ := extractMetricValue(node_memory_MemFree_bytes)
total, _ := extractMetricValue(node_memory_MemTotal_bytes)
buffers, _ := extractMetricValue(node_memory_Buffers_bytes)
cached, _ := extractMetricValue(node_memory_Cached_bytes)
fmt.Println(total)
fmt.Println(free + cached - buffers)
fmt.Println(free + cached + buffers)
//
//fmt.Println(extractMetricValue(node_memory_MemFree_bytes))
//fmt.Println(extractMetricValue(node_memory_MemTotal_bytes))
//fmt.Println(extractMetricValue(node_memory_Buffers_bytes))
//fmt.Println(extractMetricValue(node_memory_Cached_bytes))
}