Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 883 Bytes

readme.md

File metadata and controls

40 lines (27 loc) · 883 Bytes

Prometheus Exporter for Rancher

Current Metrics Scraped:

  • Rancher Major/Minor/Patch versions
  • Total number of Managed clusters
  • Number of RKE/RKE2/K3s/EKS/AKS/GKE clusters

Prereqs

  • Decide how to auth with the local cluster:

In-cluster config

Uncomment the following from main.go

// Use this for in-cluster config 
//config, err := rest.InClusterConfig()

External cluster config

(default) and is handled by the following code in main.go

// Use this for out of cluster config
currentUser, err := user.Current()
if err != nil {
	log.Fatal(err.Error())
}

kubeconfig := flag.String("kubeconfig", fmt.Sprintf("/home/%s/.kube/config", currentUser.Username), "absolute path to the kubeconfig file")
flag.Parse()
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)

Testing

go run main.go and access http://localhost:8080