Tied metric columns to values, next step will be determining how to store them and retrieve them
This commit is contained in:
parent
fa3a620fba
commit
1b57b6dec2
1 changed files with 11 additions and 6 deletions
17
pcp/pcp.go
17
pcp/pcp.go
|
@ -1,19 +1,19 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"bufio"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c config" // We always want the most granular
|
const pcpCommand string = "pmdumptext -m -l -f '' -t 1.0 -d , -c config" // We always want the most granular
|
||||||
cmd := exec.Command("sh", "-c", pcpCommand)
|
cmd := exec.Command("sh", "-c", pcpCommand)
|
||||||
// time := time.Now().Format("200601021504")
|
// time := time.Now().Format("200601021504")
|
||||||
|
|
||||||
// stdout, err := os.Create("./"+time+".txt")
|
// stdout, err := os.Create("./"+time+".txt")
|
||||||
pipe, err := cmd.StdoutPipe()
|
pipe, err := cmd.StdoutPipe()
|
||||||
|
|
||||||
//cmd.Stdout = stdout
|
//cmd.Stdout = stdout
|
||||||
|
@ -34,15 +34,20 @@ func main() {
|
||||||
// Throw away first set of results
|
// Throw away first set of results
|
||||||
scanner.Scan()
|
scanner.Scan()
|
||||||
|
|
||||||
|
|
||||||
seconds := 0
|
seconds := 0
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
fmt.Println("Second ", seconds , " val: ", strings.Split(scanner.Text(), ","))
|
fmt.Printf("Second: %d\n", seconds)
|
||||||
|
for i, val := range strings.Split(scanner.Text(), ",") {
|
||||||
|
fmt.Printf("host metric: %s val: %s\n", headers[i], val)
|
||||||
|
}
|
||||||
|
|
||||||
seconds++
|
seconds++
|
||||||
|
|
||||||
|
fmt.Println("--------------------------------")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
fmt.Println("PCP started: ")
|
fmt.Println("PCP started: ")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Reference in a new issue