-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exposes table desktop process info in checkpoint and in kolide_deskto…
…p_procs table (#1240) * exposes table desktop process info in checkpoint and in kolide_desktop_procs table * bump scutil timeout for determining console users for desktop process
- Loading branch information
1 parent
145d28e
commit fa27bbf
Showing
5 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package desktopprocs | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/kolide/launcher/ee/desktop/runner" | ||
"github.com/osquery/osquery-go/plugin/table" | ||
) | ||
|
||
func TablePlugin() *table.Plugin { | ||
columns := []table.ColumnDefinition{ | ||
table.TextColumn("uid"), | ||
table.TextColumn("pid"), | ||
table.TextColumn("start_time"), | ||
table.TextColumn("last_health_check"), | ||
} | ||
return table.NewPlugin("kolide_desktop_procs", columns, generate()) | ||
} | ||
|
||
func generate() table.GenerateFunc { | ||
return func(ctx context.Context, queryContext table.QueryContext) ([]map[string]string, error) { | ||
results := []map[string]string{} | ||
|
||
for k, v := range runner.InstanceDesktopProcessRecords() { | ||
results = append(results, map[string]string{ | ||
"uid": k, | ||
"pid": fmt.Sprint(v.Process.Pid), | ||
"start_time": fmt.Sprint(v.StartTime), | ||
"last_health_check": fmt.Sprint(v.LastHealthCheck), | ||
}) | ||
} | ||
|
||
return results, nil | ||
} | ||
} |