/usr/share/gocode/src/github.com/cloudfoundry/gosigar/examples/uptime.go is in golang-github-cloudfoundry-gosigar-dev 0.0~git20150402.27.3ed7c74-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | // Copyright (c) 2012 VMware, Inc.
package main
import (
"fmt"
"github.com/cloudfoundry/gosigar"
"os"
"time"
)
func main() {
concreteSigar := sigar.ConcreteSigar{}
uptime := sigar.Uptime{}
uptime.Get()
avg, err := concreteSigar.GetLoadAverage()
if err != nil {
fmt.Printf("Failed to get load average")
return
}
fmt.Fprintf(os.Stdout, " %s up %s load average: %.2f, %.2f, %.2f\n",
time.Now().Format("15:04:05"),
uptime.Format(),
avg.One, avg.Five, avg.Fifteen)
}
|