Skip to content
Filters Sensu Go check hook process table info
JavaScript Shell
Branch: master
Clone or download
Latest commit f8547fb Sep 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Because I can't computer Sep 4, 2019
lib Initial commit Sep 4, 2019
spec Initial commit Sep 4, 2019
.bonsai.yml Added bonsai config Sep 4, 2019
.gitignore Adds gitignore Sep 4, 2019
.travis.yml Initial commit Sep 4, 2019
README.md Update README.md Sep 4, 2019
karma.conf.js Initial commit Sep 4, 2019
package-lock.json Initial commit Sep 4, 2019
package.json Initial commit Sep 4, 2019
yarn.lock ???? Sep 4, 2019

README.md

sensu-go-hook-has-process-filter

Build Status

This is an experimental project that provides a filter library for evaluating the output of a Sensu check hook that gathers process table information.

Configuration

Let's start with an example check. In this case, we're checking the CPU of a group of given systems. Of note is the check hook "get_top_processes"

Example Check

type: CheckConfig
api_version: core/v2
metadata:
  name: check-cpu
  namespace: default
spec:
  command: sensu-go-cpu-check -w 70 -c 85
  runtime_assets:
  - sensu-go-cpu-check-linux
  interval: 10
  publish: true
  output_metric_format: nagios_perfdata
  output_metric_handlers: ["influxdb"]
  check_hooks:
  - warning:
    - get_top_processes
  - critical:
    - get_top_processes
  handlers:
  - slack
  subscriptions:
  - system

Example Hook

Here is the example hook. It just runs a ps command and does a bit of sorting by percent of CPU used.

type: HookConfig
api_version: core/v2
metadata:
  annotations: null
  labels: null
  name: get_top_processes
  namespace: default
spec:
  command: |-
    ps -eo user,pid,cmd:50,%cpu --sort=-%cpu | head -n 6
  stdin: false
  timeout: 60

Example Filter

---
type: EventFilter
api_version: core/v2
metadata:
  name: hook_process_gremlin
  namespace: default
spec:
  action: allow
  runtime_assets:
    - sensu-go-hook-has-process-filter
  expressions:
    - has_hook_process(event)
You can’t perform that action at this time.