CentOS 7
Sponsored Link

Sensu : Add Check Plugins#2
2017/11/07
 
Add general Check Plugins like memory check, disk check and others except CPU check (refer to here).
[1] Add memory check plugin.
[root@dlp ~]#
sensu-install -p memory-checks
[root@dlp ~]#
vi /etc/sensu/conf.d/check-memory-percent.json
# set Warning on 80% of Memory Usage , set Critical on 90%

{
  "checks": {
    "memory_check": {
      "command": "check-memory-percent.rb -w 80 -c 90",
      "subscribers": [ "development" ],
      "interval": 60
    }
  }
}

[root@dlp ~]#
vi /etc/sensu/conf.d/metrics-memory.json
# memory metrics collection

{
  "checks": {
    "metrics_memory-usage": {
      "type": "metric",
      "command": "metrics-memory.rb --scheme :::name:::.memory_usage",
      "interval": 60,
      "output_format": "graphite_plaintext",
      "subscribers": [ "development" ],
      "handlers": [ "graphite" ]
    }
  }
}

[root@dlp ~]#
systemctl restart sensu-server sensu-api

[2] Add disk check plugin.
[root@dlp ~]#
sensu-install -p disk-checks
[root@dlp ~]#
vi /etc/sensu/conf.d/check-disk-usage.json
# set Warning on 80% of Disk Usage, set Critical on 90%

{
  "checks": {
    "disk_check": {
      "command": "check-disk-usage.rb -w 80 -c 90",
      "subscribers": [ "development" ],
      "interval": 60
    }
  }
}

[root@dlp ~]#
vi /etc/sensu/conf.d/metrics-disk-usage.json
# disk metrics collection

{
  "checks": {
    "metrics_disk-usage": {
      "type": "metric",
      "command": "metrics-disk-usage.rb -l --scheme :::name:::.disk_usage",
      "interval": 60,
      "output_format": "graphite_plaintext",
      "subscribers": [ "development" ],
      "handlers": [ "graphite" ]
    }
  }
}

[root@dlp ~]#
systemctl restart sensu-server sensu-api

[3] Add network check plugin.
[root@dlp ~]#
sensu-install -p network-checks
[root@dlp ~]#
vi /etc/sensu/conf.d/check-ports.json
# check 22 port (timeout is 10 sec)

{
  "checks": {
    "port_check": {
      "command": "check-ports.rb -p 22 -t 10",
      "subscribers": [ "development" ],
      "interval": 60
    }
  }
}

[root@dlp ~]#
vi /etc/sensu/conf.d/metrics-net.json
# network metrics collection

{
  "checks": {
    "metrics_net-usage": {
      "type": "metric",
      "command": "metrics-net.rb --scheme :::name:::.network",
      "interval": 60,
      "output_format": "graphite_plaintext",
      "subscribers": [ "development" ],
      "handlers": [ "graphite" ]
    }
  }
}

[root@dlp ~]#
systemctl restart sensu-server sensu-api

[4] Add process check plugin.
[root@dlp ~]#
sensu-install -p process-checks
[root@dlp ~]#
vi /etc/sensu/conf.d/check-process.json
# set Warning on 400 proccesses, set Critical on 500

{
  "checks": {
    "processes_check": {
      "command": "check-process.rb -w 400 -c 500",
      "subscribers": [ "development" ],
      "interval": 60
    }
  }
}

[root@dlp ~]#
vi /etc/sensu/conf.d/metrics-processes-threads-count.json
# process metrics collection

{
  "checks": {
    "metrics_processes-count": {
      "type": "metric",
      "command": "metrics-processes-threads-count.rb --scheme :::name:::.processes",
      "interval": 60,
      "output_format": "graphite_plaintext",
      "subscribers": [ "development" ],
      "handlers": [ "graphite" ]
    }
  }
}

[root@dlp ~]#
systemctl restart sensu-server sensu-api

[5] Add NTP check plugin. (follows are the case on chrony, but for ntpd, install [sensu-install -p ntp])
[root@dlp ~]#
sensu-install -p chrony
[root@dlp ~]#
vi /etc/sensu/conf.d/check-chrony.json
# set Warning on offset 2 sec, set Critical on 3 sec

{
  "checks": {
    "chrony_check": {
      "command": "check-chrony.rb --warn-offset 2000 --crit-offset 3000",
      "subscribers": [ "development" ],
      "interval": 600
    }
  }
}

[root@dlp ~]#
vi /etc/sensu/conf.d/metrics-chrony.json
# Chrony metrics collection

{
  "checks": {
    "metrics_chrony": {
      "type": "metric",
      "command": "metrics-chrony.rb --scheme :::name:::.chrony",
      "interval": 600,
      "output_format": "graphite_plaintext",
      "subscribers": [ "development" ],
      "handlers": [ "graphite" ]
    }
  }
}

[root@dlp ~]#
systemctl restart sensu-server sensu-api

[6] Access to Uchiwa Dashboard and verify new metric collection checks are shown normally.
[7] Access to Graphite Web to see metrics with Graphs.
[8] If set Grafana web, it's also possible to see Graphs.
Matched Content
 
Tweet