telegraf/Godeps/_workspace/src/github.com/cloudfoundry/gosigar/psnotify
Cameron Sparr 9969c4e810 Add system uptime metric, string formatted AND in float64
closes #150
2015-08-31 14:43:34 -06:00
..
README.md Add system uptime metric, string formatted AND in float64 2015-08-31 14:43:34 -06:00
psnotify.go Add system uptime metric, string formatted AND in float64 2015-08-31 14:43:34 -06:00
psnotify_bsd.go Add system uptime metric, string formatted AND in float64 2015-08-31 14:43:34 -06:00
psnotify_linux.go Add system uptime metric, string formatted AND in float64 2015-08-31 14:43:34 -06:00
psnotify_test.go Add system uptime metric, string formatted AND in float64 2015-08-31 14:43:34 -06:00

README.md

Process notifications for Go

Overview

The psnotify package captures process events from the kernel via kqueue on Darwin/BSD and the netlink connector on Linux.

The psnotify API is similar to the fsnotify package.

Example:

    watcher, err := psnotify.NewWatcher()
    if err != nil {
        log.Fatal(err)
    }

    // Process events
    go func() {
        for {
            select {
            case ev := <-watcher.Fork:
                log.Println("fork event:", ev)
            case ev := <-watcher.Exec:
                log.Println("exec event:", ev)
            case ev := <-watcher.Exit:
                log.Println("exit event:", ev)
            case err := <-watcher.Error:
                log.Println("error:", err)
            }
        }
    }()

    err = watcher.Watch(os.Getpid(), psnotify.PROC_EVENT_ALL)
    if err != nil {
        log.Fatal(err)
    }

    /* ... do stuff ... */
    watcher.Close()

Supported platforms

Currently targeting modern flavors of Darwin and Linux. Should work on BSD, but untested.

License

Apache 2.0