Monitoring Drupal with Sensu. John VanDyk Iowa State University DrupalCorn Iowa City August 10, 2013



Similar documents
Maintaining Non-Stop Services with Multi Layer Monitoring

CONSUL AS A MONITORING SERVICE

Network Monitoring with SNMP

Drupal Performance Tuning

Architecting ColdFusion For Scalability And High Availability. Ryan Stewart Platform Evangelist

Aradial Installation Guide

Log management with Logstash and Elasticsearch. Matteo Dessalvi

Using vcenter Orchestrator AMQP Plug-in

AFW: Automating host-based firewalls with Chef

Bernd Ahlers Michael Friedrich. Log Monitoring Simplified Get the best out of Graylog2 & Icinga 2

Network Monitoring with SNMP

Adding Indirection Enhances Functionality

Web Application Firewall

Logging on a Shoestring Budget

Monitoring Windows Servers and Applications with GroundWork Monitor Enterprise 6.7. Product Application Guide October 8, 2012

Monitoring MySQL. Geert Vanderkelen MySQL Senior Support Engineer Sun Microsystems

OpenMind: Know Your Customer

IceWarp to IceWarp Server Migration

Taking Drupal development to the Cloud. Karel Bemelmans

PrivateWire Gateway Load Balancing and High Availability using Microsoft SQL Server Replication

TPAf KTl Pen source. System Monitoring. Zenoss Core 3.x Network and

Configuration Manual

ITSM Service Monitoring Using Open Source Tools

CloudStack Metering Working with the Usage Data. Tariq Iqbal Senior

Using VMware vrealize Orchestrator Plug-Ins

STEP 4 : GETTING LIGHTTPD TO WORK ON YOUR SEAGATE GOFLEX SATELLITE

PANDORA FMS OFFICIAL TRAINING

ICINGA2 OPEN SOURCE MONITORING

WebSphere Business Monitor V7.0 Business space dashboards

vcenter Hyperic Configuration Guide

A recipe using an Open Source monitoring tool for performance monitoring of a SaaS application.

How To Script Administrative Tasks In Marklogic Server

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Next Generation Open Source Messaging with Apache Apollo

Log management with Graylog2 Lennart Koopmann, FrOSCon Mittwoch, 29. August 12

socketio Documentation

Red Hat JBoss Core Services Apache HTTP Server 2.4 Apache HTTP Server Installation Guide

WhatsUp Gold v11 Features Overview

eccharts: Behind the scenes

EVENT LOG MANAGEMENT...

How To Monitor Your Computer With Nagiostee.Org (Nagios)

Proactively Monitoring Departmental Clinical IT Systems with an Open Source Availability System

Nagios. cooler than it looks. Wednesday, 31 October 2007

Log infrastructure & Zabbix. logging tools integration

Smartphone Enterprise Application Integration

Last time. Today. IaaS Providers. Amazon Web Services, overview

Performance Analysis and Capacity Planing

Information Systems Application Administration Manual Request Tracker

Monitoring Oracle Enterprise Performance Management System Release Deployments from Oracle Enterprise Manager 12c

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

Deploying Cisco Unified Contact Center Express Volume 1

Linux Syslog Messages in IBM Director

VAULT MODERN SECRETS MANAGEMENT

DEPLOYING EMC DOCUMENTUM BUSINESS ACTIVITY MONITOR SERVER ON IBM WEBSPHERE APPLICATION SERVER CLUSTER

Welcome to this review guide for Configuration and Using ZyALERT. Conditions. Contact Us. Review Guide Configuration and Using ZyALERT

Availability Management Nagios overview. TEIN2 training Bangkok September 2005

IPSL - PRODIGUER. Messaging Platform Design

Oracle WebLogic Server 11g Administration

PANDORA FMS OFFICIAL TRAINING

WebSphere Business Monitor V7.0 Configuring a remote CEI server

WhatsUp Gold v11 Features Overview

the missing log collector Treasure Data, Inc. Muga Nishizawa

Moving beyond hardware

HDA Integration Guide. Help Desk Authority 9.0

How we monitor 1 billion km of monthly ride sharing

Developing an Application Tracing Utility for Mule ESB Application on EL (Elastic Search, Log stash) Stack Using AOP

1. INTERFACE ENHANCEMENTS 2. REPORTING ENHANCEMENTS

F-Secure Messaging Security Gateway. Deployment Guide

Immotec Systems, Inc. SQL Server 2005 Installation Document

PUBLIC Model Manager User Guide

1. INTERFACE ENHANCEMENTS 2. REPORTING ENHANCEMENTS

No.1 IT Online training institute from Hyderabad URL: sriramtechnologies.com

Graylog2 Lennart Koopmann, OSDC /

Deployment and Monitoring. Pascal Robert MacTI

HelpSystems Web Server User Guide

Getting Started with RES ONE Automation 2015

SMT v4.0 Users Guide (Linux version)

Achieving Continuous Integration with Drupal

DEPLOYMENT GUIDE DEPLOYING F5 AUTOMATED NETWORK PROVISIONING FOR VMWARE INFRASTRUCTURE

AlienVault Unified Security Management (USM) 4.x-5.x. Deploying HIDS Agents to Linux Hosts

Running an OpenStack Cloud for several years and living to tell the tale. Alexandre Maumené Gaëtan Trellu Tokyo Summit, November 2015

Aqua Connect Load Balancer User Manual (Mac)

Architecture and Mode of Operation

IHS USER SECURITY AUDIT

Create!form Folder Monitor. Technical Note April 1, 2008

Acronis Monitoring Service

For Internet Facing and Private Data Systems

VMware vrealize Operations for Horizon Administration

How to extend Puppet using Ruby

Parallels Plesk Panel

WEBLOGIC ADMINISTRATION

VMware vcenter Operations Manager Administration Guide

Andrew Moore Amsterdam 2015

Chancery SMS Database Split

HRC Advanced Citrix Troubleshooting Guide. Remove all Citrix Instances from the Registry

How do I use Push Notifications with ios?

HP Cloud Service Automation

Transcription:

Monitoring Drupal with Sensu John VanDyk Iowa State University DrupalCorn Iowa City August 10, 2013

What is Sensu? Sensu architecture Sensu server Sensu client Drupal and Sensu

Q: What is Sensu? A: A monitoring router

A monitoring router Disk Sensu Space Sensu is focused on monitoring; that is watching something to make sure it s OK.

A monitoring router Hey! Almost Out of Disk Space Sensu Email It also handles routing.

A monitoring router EEK! Out of Disk Space Sensu Email Logs Pager Check results can be routed to the appropriate alerting system.

Check Sensu Handler Sensu receives results from a check and gives them to a handler.

Check Sensu Handler Disk space Email

*yawn* So what's special? What's special is very little client configuration, JSON everywhere, understandable code and little of it, and route all the things.

Sensu Architecture

Redis is an in-memory key/value store sponsored by VMWare. RabbitMQ Redis Ruby code Sensu consists of a message queue, a key/value store, and ruby code. RabbitMQ is a message broker that implements Advanced Message Queueing Protocol (AMQP). Written in Erlang, acquired by SpringSource which was then acquired by VMWare.

RabbitMQ Redis Base Web MySQL Ruby code Sensu creates queues in RabbitMQ.

RabbitMQ Base Checks: Web Checks: MySQL Checks: Redis - Disk space - CPU% - Network if - Security - httpd up - SSL current - varnish up - db connect - log size OK - replication running - long queries Ruby code Sensu server sends checks into the queues.

RabbitMQ Redis Base Web MySQL Ruby code Webservers MySQL Server Servers subscribe to one more more queues.

RabbitMQ Redis Base Web MySQL Ruby code Webservers MySQL Server All servers can subscribe to a base queue.

RabbitMQ Redis Base Web MySQL Ruby code Webservers MySQL Server A server may subscribe to any number of appropriate queues.

RabbitMQ Redis Base Web MySQL Ruby code Webservers MySQL Server Adding monitoring for a new server is as simple as subscribing it to the proper queues.

Sensu Server eventmachine oj em-redisunified amqp OJ is the ruby Optimized JSON parser, a C extension to Ruby. Eventmachine is a library providing the Reactor design pattern which demultiplexes incoming events, dispatching them to individual handlers.

Sensu configuration directory structure.

/etc/sensu/conf.d/rabbitmq.json { "rabbitmq": { "user": "sensu", "port": 5671, "password": "secret", "vhost": "/sensu", "host": "sensuserver.example.com", "ssl": { "private_key_file": "/etc/sensu/ssl/key.pem", "cert_chain_file": "/etc/sensu/ssl/cert.pem" Example of Sensu client configuration. Sets location of RabbitMQ so client can find queues to receive checks and publish results.

/etc/sensu/conf.d/client.json { "client": { "name": "www.example.com", "address": "203.0.113.5", "safe_mode": false, "subscriptions": [ "base", "drupal" ] Example of Sensu client configuration. Client identifies itself and says which queues it wants to subscribe to. Safe mode means checks must be defined on client as well as server, preventing an evil server from running arbitrary code as checks on the client.

Example: Checking that Drupal version is current

1. Create plugin (code that check will execute on client when check runs) 2. Define check configuration 3. Determine appropriate handler(s) General methodology.

1. Create plugin (code that check will execute on client when check runs) drush @nrem.live core-status drupal-version --pipe Output: 7.20

#!/bin/bash 1. Create plugin (code that check will execute when check runs) /etc/sensu/plugins/check_drupal_current.sh # Sensu check for Drupal current-ness. # # Example: check_drupal_current.sh @example.alias DRUPAL_VERSION=`drush $@ core-status drupal-version --pipe` DRUPAL_MAJOR_VERSION=${DRUPAL_VERSION:0:1 CURRENT_VERSION=$(</etc/drush/constants/currentdrupal${DRUPAL_MAJOR_VERSION.txt) if [ $DRUPAL_VERSION!= $CURRENT_VERSION ] then echo "VERSION WARNING - $@ $DRUPAL_VERSION" exit 1 else echo "VERSION OK - $@ $DRUPAL_VERSION" exit 0 fi

2. Define check configuration on server { "checks": { "check_drupal_current": { "handlers": [ "mailer" ], "command": "/etc/sensu/plugins/check_drupal_current.sh @nrem.live", "subscribers": [ "drupal" ], "interval": 3600 "refresh": 86400 Interval means "run this check every this-many seconds." Refresh means "number of seconds handlers should wait before taking second action."

3. Determine appropriate handler(s) { "checks": { "check_drupal_current": { "handlers": [ "mailer" ], "command": "/etc/sensu/plugins/check_drupal_current.sh @nrem.live", "subscribers": [ "drupal" ], "interval": 3600 "refresh": 86400

Avoid hardcoding drush alias { "checks": { "check_drupal_current": { "handlers": [ "mailer" ], "command": "/etc/sensu/plugins/check_drupal_current.sh :::drushalias:::", "subscribers": [ "drupal" ], "interval": 3600 "refresh": 86400 Use a placeholder instead of hardcoding.

/etc/sensu/conf.d/client.json { "client": { "name": "www.example.com", "address": "203.0.113.5", "safe_mode": false, "subscriptions": [ "base", "drupal" ], "drushalias": "@nrem.live", Arbitrary tokens can be set on the client in the client configuration JSON.

Example: Checking a Drupal Metric

1. Create plugin (code that check will execute on client when check runs) 2. Define check configuration 3. Determine appropriate handler(s) Same methodology for metrics.

1. Create plugin (code that check will execute on client when check runs) drush @nrem.live sql-query "SELECT COUNT(lid) FROM linkchecker_link WHERE fail_count > 0" sed -n 2p Output: 157

1. Create plugin (code that check will execute on client when check runs) /etc/sensu/plugins/count_broken_drupal_links.sh #!/bin/bash # Sensu check for broken links in a Drupal site. Requires linkchecker Drupal # module. # # Example: count_broken_drupal_links.sh @example.alias BROKEN_LINK_COUNT=`drush $@ sql-query "SELECT COUNT(lid) AS broken FROM linkchecker_link WHERE fail_count > 0" sed -n 2p` if [ $BROKEN_LINK_COUNT -gt 0 ] then echo "LINK WARNING - $@ $BROKEN_LINK_COUNT broken links" exit 1 else echo "LINK OK - $@ no broken links" exit 0 fi

2. Define check configuration on server { "checks": { "check_broken_drupal_links": { "type": "metric", "handlers": [ "mailer" ], "command": "/etc/sensu/plugins/ count_broken_drupal_links.sh :::drushalias:::", "subscribers": [ "drupal" ], "interval": 3600 "refresh": 86400 If you declare the check as a metric the results will be sent to the server even if the exit value is 0.

3. Determine appropriate handler(s) { "checks": { "check_broken_drupal_links": { "type": "metric", "handlers": [ "graphite" ], "command": "/etc/sensu/plugins/ count_broken_drupal_links.sh :::drushalias:::", "subscribers": [ "drupal" ], "interval": 3600 You might want to send your metrics to graphite.

Pushing Info from Drupal to Sensu

(demo of logtosensu Drupal module)

{ "timestamp":"2013-08-09t16:43:56.060628-0500", "level":"info", "message":"publishing check result", "payload": { "client":"www.example.com", "check": { "name":"watchdog", "output":"page: updated Foo.", "status":0, "handler":["default", "mailer"], "drupal_base_url":"http://local.dev/d723", "drupal_timestamp":1376084636, "drupal_type":"content", "drupal_ip":"127.0.0.1", "drupal_request_uri":"http://local.dev/d723/node/1/edit", "drupal_referer":"http://local.dev/d723/node/1/edit", "drupal_uid":"1", "drupal_link":"view", "type":"metric", "issued":1376084636 JSON event resulting from updating a page in Drupal.

Much, much more: Any test, including Nagios scripts Any Drupal metric http://sensuapp.org Any handler Mutators (not covered here) may change data before handler gets it http://drupal.org/project/logtosensu