Skip to content

Commit 88b636d

Browse files
committed
working on pipelines...
1 parent c7e9b13 commit 88b636d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func init() {
3232
prometheus.MustRegister(NewPartitionsCollector()) // from partitions.go
3333
prometheus.MustRegister(NewQueueCollector()) // from queue.go
3434
prometheus.MustRegister(NewSchedulerCollector()) // from scheduler.go
35+
prometheus.MustRegister(NewFairShareCollector()) // from sshare.go
3536
prometheus.MustRegister(NewUsersCollector()) // from users.go
3637
}
3738

sshare.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ import (
2222
"strings"
2323
"strconv"
2424
"github.com/prometheus/client_golang/prometheus"
25+
"fmt"
2526
)
2627

2728
func FairShareData() []byte {
28-
cmd := exec.Command("sshare", "-nPo account,fairshare", "|", "grep '^ [a-z]'", "|", "tr -d ' '" )
29+
cmd := exec.Command( "sshare", "-n", "-P", "-o", "account,fairshare", "|", "grep '^ [a-z]'" )
2930
stdout, err := cmd.StdoutPipe()
3031
if err != nil {
3132
log.Fatal(err)
@@ -48,6 +49,7 @@ func ParseFairShareMetrics() map[string]*FairShareMetrics {
4849
accounts := make(map[string]*FairShareMetrics)
4950
lines := strings.Split(string(FairShareData()), "\n")
5051
for _, line := range lines {
52+
fmt.Printf(line)
5153
if strings.Contains(line,"|") {
5254
account := strings.Split(line,"|")[0]
5355
_,key := accounts[account]

0 commit comments

Comments
 (0)