SlideShare a Scribd company logo
R.I.Pienaar
Malta DevOps December 2016
Monitoring using Sensu
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Who am I?
• Malta since December 2015
• Consultant for 20+ years
• Government, Finance, Health, Social Media,
Fortune 50, Startups
• DevOps, Automation, Architect,
Development
• Open Source @ github.com/ripienaar
• Linux since Kernel 99 alpha p11
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Tool
vs
Framework
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Checks
API
MetricsDynamic
External InputsSecure
Events
Plugins
JSON
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Architecture - Overview
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Architecture - Schedule
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Architecture - Event
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Architecture - Integrate
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"checks": {
"procs_rhel7": {
"command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k",
"interval": 300,
"subscribers": [
"RedHat-7"
]
}
}
}
Config - Checks
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"checks": {
"procs_rhel7": {
"command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k",
"interval": 300,
"subscribers": [
"RedHat-7"
]
}
}
}
Config - Checks
Name
Command to run
How often
Where
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"client": {
"name": "dev3.devco.net",
"address": "139.162.163.118",
"subscriptions": [
"all",
"linode_fra",
"de",
"RedHat-7"
],
"redact": [
],
"socket": {
"bind": "127.0.0.1",
"port": 3030
},
"procs": {
"total": {
"warn": 80,
"crit": 90
}
}
}
}
Config - Clients
Local event sync
What am I?
Node Parameters
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"client": {
…,
"procs": {
"total": {
"warn": 80,
"crit": 90
}
}
}
}
Config - Clients
Node Parameters
{
"checks": {
"procs_rhel7": {
"command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k",
"interval": 300,
"subscribers": [
"RedHat-7"
]
}
}
}
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"client": {
…,
"procs": {
"total": {
"warn": 80,
"crit": 90
}
}
}
}
Config - Clients
Node Parameters
{
"checks": {
"procs_rhel7": {
"command": “…/check_procs -w :::procs.total.warn|50::: -c :::procs.total.crit|70::: -k",
"interval": 300,
"subscribers": [
"RedHat-7"
]
}
}
}
Check Tokens
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
require ‘sensu-plugin/check/cli'
class CheckFile < Sensu::Plugin::Check::CLI
option :file,
long: “—file FILE”,
description: “The file to check”,
default: nil
def run
unknown(“no file specified, please use —file”) unless config[:file]
if File.exist?(config[:file])
ok(“file %s exist” % [config[:file]])
else
critical(“file %s does not exist” % [config[:file]])
end
end
end
Checks - Writing in Ruby
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
require ‘sensu-plugin/check/cli'
class CheckFile < Sensu::Plugin::Check::CLI
option :file,
long: “—file FILE”,
description: “The file to check”,
default: nil
def run
unknown(“no file specified, please use —file”) unless config[:file]
if File.exist?(config[:file])
ok(“file %s exist” % [config[:file]])
else
critical(“file %s does not exist” % [config[:file]])
end
end
end
Checks - Writing in Ruby
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
require “sensu-plugin/check/cli”
class CheckFile < Sensu::Plugin::Check::CLI
option :file,
long: “—file FILE”,
description: “The file to check”,
default: nil
def run
unknown(“no file specified, please use —file”) unless config[:file]
if File.exist?(config[:file])
ok(“file %s exist” % [config[:file]])
else
critical(“file %s does not exist” % [config[:file]])
end
end
end
Checks - Writing in Ruby
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
# yum install nagios-plugins-all
# /usr/lib64/nagios/plugin/check_file_age —help
…
Usage:
check_file_age [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>
check_file_age [-h | --help]
check_file_age [-V | --version]
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE UNKNOWN: No file specified
3
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE CRITICAL: File not found - /keepalive
2
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE WARNING: /keepalive is 353 seconds old and 0 bytes
1
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE OK: keepalive is 4 seconds old and 0 bytes
0
Checks - Reuse
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
# yum install nagios-plugins-all
# /usr/lib64/nagios/plugin/check_file_age —help
…
Usage:
check_file_age [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>
check_file_age [-h | --help]
check_file_age [-V | --version]
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE UNKNOWN: No file specified
3
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE CRITICAL: File not found - /keepalive
2
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE WARNING: /keepalive is 353 seconds old and 0 bytes
1
# /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $?
FILE_AGE OK: keepalive is 4 seconds old and 0 bytes
0
Checks - Reuse
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Checks - Reuse
http://sensu-plugins.io/
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
$ cat <<EOF > /dev/tcp/localhost/3030
{
"name":"my_awesome_check",
"output":"everything is fine",
"ttl":600,
“status”:0
}
EOF
Checks -Your own App
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
{
"mailer": {
"mail_from": "sensu@example.com",
"mail_to": "monitor@example.com",
"smtp_address": "smtp.example.org",
"smtp_port": "25",
"smtp_domain": "example.org",
"template": “/etc/sensu/templates/mail.erb”,
"subscriptions": {
"subscription_name": {
"mail_to": "teamemail@example.com"
}
}
}
}
Handlers - Email
https://github.com/sensu-plugins/sensu-plugins-mailer
/etc/sensu/handlers/mailer.json
Custom mail body
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
<%= output %>
Admin GUI: <%= admin_gui %>
Host: <%= @event['client']['name'] %>
Timestamp: <%= Time.at(@event['check']['issued']) %>
Address: <%= @event['client']['address'] %>
Check Name: <%= @event['check']['name'] %>
Command: <%= command %>
Status: <%= status_to_string %>
Occurrences: <%= @event['occurrences'] %>
Handlers - Email
https://github.com/sensu-plugins/sensu-plugins-mailer
/etc/sensu/templates/mail.erb
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Handlers - Thirdparties
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
events = JSON.parse(
RestClient.get(“http://example:4567/events").body
)
statusmap = {0 => "OK", 1 => "WARNING", 2 => "CRITICAL", 3 => "UNKNOWN"}
puts "Found %d events" % [events.size]
events.each do |event|
puts "%30s: %-10s %s" % [
event["client"]["name"],
statusmap[event["check"]["status"]],
event[“check"]["output"]
]
end
API - JSON
Found 2 events
puppet1.example.net: CRITICAL DISK CRITICAL - /run/docker/netns/default is not accessible:
Permission denied
dev1.example.net: WARNING PROCS WARNING: 183 processes
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
API - Uchiwa
https://uchiwa.io/
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
API - Uchiwa
https://uchiwa.io/
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Links
https://sensuapp.org/
https://uchiwa.io/
https://graphiteapp.org/
http://grafana.org/
http://sensu-plugins.io/
R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
Questions?
twitter: @ripienaar
email: rip@devco.net
blog: www.devco.net
github: ripienaar
freenode: Volcane
slack.puppet.com: ripienaar
https://www.devco.net/

More Related Content

PDF
Docker Testing
PDF
Continuous Delivery As Code
PDF
Mocks, Stubs and Fakes. ¿What Else?
PDF
Александр Воронов | Building CLI with Swift
PDF
Geb for browser automation
PDF
Building Serverless applications with Python
PDF
GitGot: The Swiss Army Chainsaw of Git Repo Management
PDF
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
Docker Testing
Continuous Delivery As Code
Mocks, Stubs and Fakes. ¿What Else?
Александр Воронов | Building CLI with Swift
Geb for browser automation
Building Serverless applications with Python
GitGot: The Swiss Army Chainsaw of Git Repo Management
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019

What's hot (6)

PDF
An introduction to the MicroProfile
PDF
LetSwift 2017 - 토스 iOS 앱의 개발/배포 환경
PDF
Laravel Code Generators and Packages
PDF
Open Canary - novahackers
PDF
Jakob Holderbaum - Managing Shared secrets using basic Unix tools
PDF
Intro to git (UT biocomputing 2015)
An introduction to the MicroProfile
LetSwift 2017 - 토스 iOS 앱의 개발/배포 환경
Laravel Code Generators and Packages
Open Canary - novahackers
Jakob Holderbaum - Managing Shared secrets using basic Unix tools
Intro to git (UT biocomputing 2015)
Ad

Similar to Monitoring using Sensu (20)

PDF
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
PDF
Introduction to Configuration Management
PDF
External Data in Puppet 4
PDF
PuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
PDF
Let's build Developer Portal with Backstage
PDF
Puppet Performance Profiling - CM Camp 2015
PDF
Large Scale Continuous Delivery
PDF
Whirlwind Tour of Puppet 4
PPTX
Introduction to InSpec and 1.0 release update
PDF
Leveraging the GitHub Ecosystem for Python Projects: From Hello World to Dock...
PDF
Leveraging the GitHub Ecosystem for Python Projects: From Hello World to Dock...
PDF
DSSML24_tspann_CodelessGenerativeAIPipelines
PPTX
Reproducible, Automated and Portable Computational and Data Science Experimen...
PDF
Python Dependency Management - PyconDE 2018
PDF
Begin your journey to be a Selenium Committer - Valencia 2025 - Pallavi Sharm...
PDF
Puppet Performance Profiling
PPTX
Advanced malware analysis training session5 reversing automation
PPTX
Reversing Engineering a Web Application - For fun, behavior and detection
PDF
release_python_day1_slides_201606.pdf
PDF
The Scientific Filesystem
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Introduction to Configuration Management
External Data in Puppet 4
PuppetConf. 2016: External Data in Puppet 4 – R.I. Pienaar
Let's build Developer Portal with Backstage
Puppet Performance Profiling - CM Camp 2015
Large Scale Continuous Delivery
Whirlwind Tour of Puppet 4
Introduction to InSpec and 1.0 release update
Leveraging the GitHub Ecosystem for Python Projects: From Hello World to Dock...
Leveraging the GitHub Ecosystem for Python Projects: From Hello World to Dock...
DSSML24_tspann_CodelessGenerativeAIPipelines
Reproducible, Automated and Portable Computational and Data Science Experimen...
Python Dependency Management - PyconDE 2018
Begin your journey to be a Selenium Committer - Valencia 2025 - Pallavi Sharm...
Puppet Performance Profiling
Advanced malware analysis training session5 reversing automation
Reversing Engineering a Web Application - For fun, behavior and detection
release_python_day1_slides_201606.pdf
The Scientific Filesystem
Ad

Recently uploaded (20)

PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
international classification of diseases ICD-10 review PPT.pptx
DOCX
Unit-3 cyber security network security of internet system
PPTX
Introduction to Information and Communication Technology
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
E -tech empowerment technologies PowerPoint
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
international classification of diseases ICD-10 review PPT.pptx
Unit-3 cyber security network security of internet system
Introduction to Information and Communication Technology
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PptxGenJS_Demo_Chart_20250317130215833.pptx
Sims 4 Historia para lo sims 4 para jugar
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
Cloud-Scale Log Monitoring _ Datadog.pdf
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
presentation_pfe-universite-molay-seltan.pptx
Paper PDF World Game (s) Great Redesign.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
E -tech empowerment technologies PowerPoint
RPKI Status Update, presented by Makito Lay at IDNOG 10
isotopes_sddsadsaadasdasdasdasdsa1213.ppt

Monitoring using Sensu

  • 1. R.I.Pienaar Malta DevOps December 2016 Monitoring using Sensu
  • 2. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Who am I? • Malta since December 2015 • Consultant for 20+ years • Government, Finance, Health, Social Media, Fortune 50, Startups • DevOps, Automation, Architect, Development • Open Source @ github.com/ripienaar • Linux since Kernel 99 alpha p11
  • 3. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar
  • 4. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Tool vs Framework
  • 5. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Checks API MetricsDynamic External InputsSecure Events Plugins JSON
  • 6. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Architecture - Overview
  • 7. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Architecture - Schedule
  • 8. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Architecture - Event
  • 9. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Architecture - Integrate
  • 10. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "checks": { "procs_rhel7": { "command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k", "interval": 300, "subscribers": [ "RedHat-7" ] } } } Config - Checks
  • 11. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "checks": { "procs_rhel7": { "command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k", "interval": 300, "subscribers": [ "RedHat-7" ] } } } Config - Checks Name Command to run How often Where
  • 12. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "client": { "name": "dev3.devco.net", "address": "139.162.163.118", "subscriptions": [ "all", "linode_fra", "de", "RedHat-7" ], "redact": [ ], "socket": { "bind": "127.0.0.1", "port": 3030 }, "procs": { "total": { "warn": 80, "crit": 90 } } } } Config - Clients Local event sync What am I? Node Parameters
  • 13. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "client": { …, "procs": { "total": { "warn": 80, "crit": 90 } } } } Config - Clients Node Parameters { "checks": { "procs_rhel7": { "command": "/usr/lib64/nagios/plugins/check_procs -w 50 -c 70 -k", "interval": 300, "subscribers": [ "RedHat-7" ] } } }
  • 14. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "client": { …, "procs": { "total": { "warn": 80, "crit": 90 } } } } Config - Clients Node Parameters { "checks": { "procs_rhel7": { "command": “…/check_procs -w :::procs.total.warn|50::: -c :::procs.total.crit|70::: -k", "interval": 300, "subscribers": [ "RedHat-7" ] } } } Check Tokens
  • 15. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar require ‘sensu-plugin/check/cli' class CheckFile < Sensu::Plugin::Check::CLI option :file, long: “—file FILE”, description: “The file to check”, default: nil def run unknown(“no file specified, please use —file”) unless config[:file] if File.exist?(config[:file]) ok(“file %s exist” % [config[:file]]) else critical(“file %s does not exist” % [config[:file]]) end end end Checks - Writing in Ruby
  • 16. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar require ‘sensu-plugin/check/cli' class CheckFile < Sensu::Plugin::Check::CLI option :file, long: “—file FILE”, description: “The file to check”, default: nil def run unknown(“no file specified, please use —file”) unless config[:file] if File.exist?(config[:file]) ok(“file %s exist” % [config[:file]]) else critical(“file %s does not exist” % [config[:file]]) end end end Checks - Writing in Ruby
  • 17. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar require “sensu-plugin/check/cli” class CheckFile < Sensu::Plugin::Check::CLI option :file, long: “—file FILE”, description: “The file to check”, default: nil def run unknown(“no file specified, please use —file”) unless config[:file] if File.exist?(config[:file]) ok(“file %s exist” % [config[:file]]) else critical(“file %s does not exist” % [config[:file]]) end end end Checks - Writing in Ruby
  • 18. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar # yum install nagios-plugins-all # /usr/lib64/nagios/plugin/check_file_age —help … Usage: check_file_age [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file> check_file_age [-h | --help] check_file_age [-V | --version] # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE UNKNOWN: No file specified 3 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE CRITICAL: File not found - /keepalive 2 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE WARNING: /keepalive is 353 seconds old and 0 bytes 1 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE OK: keepalive is 4 seconds old and 0 bytes 0 Checks - Reuse
  • 19. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar # yum install nagios-plugins-all # /usr/lib64/nagios/plugin/check_file_age —help … Usage: check_file_age [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file> check_file_age [-h | --help] check_file_age [-V | --version] # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE UNKNOWN: No file specified 3 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE CRITICAL: File not found - /keepalive 2 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE WARNING: /keepalive is 353 seconds old and 0 bytes 1 # /usr/lib64/nagios/plugins/check_file_age -f /keepalive; echo $? FILE_AGE OK: keepalive is 4 seconds old and 0 bytes 0 Checks - Reuse
  • 20. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Checks - Reuse http://sensu-plugins.io/
  • 21. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar $ cat <<EOF > /dev/tcp/localhost/3030 { "name":"my_awesome_check", "output":"everything is fine", "ttl":600, “status”:0 } EOF Checks -Your own App
  • 22. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar { "mailer": { "mail_from": "sensu@example.com", "mail_to": "monitor@example.com", "smtp_address": "smtp.example.org", "smtp_port": "25", "smtp_domain": "example.org", "template": “/etc/sensu/templates/mail.erb”, "subscriptions": { "subscription_name": { "mail_to": "teamemail@example.com" } } } } Handlers - Email https://github.com/sensu-plugins/sensu-plugins-mailer /etc/sensu/handlers/mailer.json Custom mail body
  • 23. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar <%= output %> Admin GUI: <%= admin_gui %> Host: <%= @event['client']['name'] %> Timestamp: <%= Time.at(@event['check']['issued']) %> Address: <%= @event['client']['address'] %> Check Name: <%= @event['check']['name'] %> Command: <%= command %> Status: <%= status_to_string %> Occurrences: <%= @event['occurrences'] %> Handlers - Email https://github.com/sensu-plugins/sensu-plugins-mailer /etc/sensu/templates/mail.erb
  • 24. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Handlers - Thirdparties
  • 25. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar events = JSON.parse( RestClient.get(“http://example:4567/events").body ) statusmap = {0 => "OK", 1 => "WARNING", 2 => "CRITICAL", 3 => "UNKNOWN"} puts "Found %d events" % [events.size] events.each do |event| puts "%30s: %-10s %s" % [ event["client"]["name"], statusmap[event["check"]["status"]], event[“check"]["output"] ] end API - JSON Found 2 events puppet1.example.net: CRITICAL DISK CRITICAL - /run/docker/netns/default is not accessible: Permission denied dev1.example.net: WARNING PROCS WARNING: 183 processes
  • 26. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar API - Uchiwa https://uchiwa.io/
  • 27. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar API - Uchiwa https://uchiwa.io/
  • 28. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Links https://sensuapp.org/ https://uchiwa.io/ https://graphiteapp.org/ http://grafana.org/ http://sensu-plugins.io/
  • 29. R.I.Pienaar | rip@devco.net | http://devco.net | @ripienaar Questions? twitter: @ripienaar email: rip@devco.net blog: www.devco.net github: ripienaar freenode: Volcane slack.puppet.com: ripienaar https://www.devco.net/