SlideShare a Scribd company logo
1 of 66
Download to read offline
Puppet Data Mining
Report processors, stored configs and more

PuppetCamp 22nd March 2012


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/map408/2412123378
Gareth Rushgrove @garethr


gareth rushgrove | morethanseven.net
Blog at morethanseven.net


gareth rushgrove | morethanseven.net
Curate devopsweekly.com


gareth rushgrove | morethanseven.net
Text




Work at UK Government Digital Service


gareth rushgrove | morethanseven.net
Serious Government Business


gareth rushgrove | morethanseven.net
-      Why do we want it?
-      How do we get our hands on it
-      What can we build with it




Puppet data


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/iancarroll/5027441664
-      Why do we want it?
-      How do we get our hands on it
-      What can we build with it




Puppet data


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/iancarroll/5027441664
-      Why do we want it?
-      How do we get our hands on it
-      What can we build with it




Puppet data


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/iancarroll/5027441664
Why
Single source of truth


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/joeshlabotnik/4132307070/
-      Spreadsheets
-      Wiki
-      Deployment scripts
-      Application code
-      SSH configs
-      More deployment scripts
-      Monitoring configuration




Example: find a list of hostnames


gareth rushgrove | morethanseven.net
Operational reports


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/nettsu/5276327339
Company hardware




Example: hardware spreadsheet


gareth rushgrove | morethanseven.net
Hooks for tooling


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/nickstone333/3135318558
Example: Nagios integration


gareth rushgrove | morethanseven.net
Example: Rundeck integration


gareth rushgrove | morethanseven.net
How
-      Report processors
-      Stored configurations
-      Puppet internal APIs




Where to find the data


gareth rushgrove | morethanseven.net
Report processors


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/nathaninsandiego/3757033518
[agent]
     report = true
     pluginsync = true

     [master]
     reports = store
     pluginsync = true



Configuration


gareth rushgrove | morethanseven.net
[agent]
     report = true
     pluginsync = true

     [master]
     reports = store,http,log,sample
     pluginsync = true



Adding reports


gareth rushgrove | morethanseven.net
Built in


gareth rushgrove | morethanseven.net
Store the YAML report on disk. Each host sends
        its report as a YAML dump and this just stores
        the file on disk, in the reportdir directory.




Store


gareth rushgrove | morethanseven.net
Send all received logs to the local log
        destinations. Usually the log destination is syslog.




Log


gareth rushgrove | morethanseven.net
Send report information via HTTP to the
        reporturl. Each host sends its report as a YAML
        dump and this sends this YAML to a client via
        HTTP POST.




HTTP


gareth rushgrove | morethanseven.net
This report sends specific log messages to
        specific email addresses based on the tags in
        the log messages.




Tagmail


gareth rushgrove | morethanseven.net
Graph all available data about hosts using
        the RRD library.




RRDgraph


gareth rushgrove | morethanseven.net
.
     └── sample-report
         ├── lib
         │   └── puppet
         │       └── reports
         │           └── sample.rb
         └── manifests
             └── init.pp



Simple report structure


gareth rushgrove | morethanseven.net
require 'puppet'
 require 'yaml'
 require 'logger'

 LOG = Logger.new('/tmp/puppet.log')

 Puppet::Reports.register_report(:sample) do
   def process
     message = "Puppet run for #{self.host} #{self.status}"
     Puppet.debug "Hello from sample report processor"
     LOG.info message
   end
 end




Simple report processor


gareth rushgrove | morethanseven.net
require 'puppet'
 require 'yaml'
 require 'logger'

 LOG = Logger.new('/tmp/puppet.log')

 Puppet::Reports.register_report(:sample) do
   def process
     message = "Puppet run for #{self.host} #{self.status}"
     Puppet.debug "Hello from sample report processor"
     LOG.info message
   end
 end




Register report


gareth rushgrove | morethanseven.net
require 'puppet'
 require 'yaml'
 require 'logger'

 LOG = Logger.new('/tmp/puppet.log')

 Puppet::Reports.register_report(:sample) do
   def process
     message = "Puppet run for #{self.host} #{self.status}"
     Puppet.debug "Hello from sample report processor"
     LOG.info message
   end
 end




Do something with the data in self


gareth rushgrove | morethanseven.net
Open source examples


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/nettsu/5771348892
IRC/Campfire


gareth rushgrove | morethanseven.net
IRC/Campfire


gareth rushgrove | morethanseven.net
Ganglia


gareth rushgrove | morethanseven.net
Graphs!


gareth rushgrove | morethanseven.net
Zendesk


gareth rushgrove | morethanseven.net
James Turnbull will have got there first


gareth rushgrove | morethanseven.net
Stored configuration database


gareth rushgrove | morethanseven.net
[master]
     storeconfigs = true
     dbadapter = mysql
     dbuser = puppet
     dbpassword = password
     dbserver = localhost
     dbsocket = /var/run/mysql.sock



Configuration


gareth rushgrove | morethanseven.net
SQL


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/nettsu/4997777753
mysql> SHOW TABLES;
     +------------------+
     | Tables_in_puppet |
     +------------------+
     | fact_names        |
     | fact_values       |
     | hosts             |
     | inventory_facts |
     | inventory_nodes |
     | param_names       |
     | param_values      |
     | puppet_tags       |
     | resource_tags     |
     | resources         |
     | source_files      |
     +------------------+
     11 rows in set (0.00 sec)




Lots of tables to explore


gareth rushgrove | morethanseven.net
mysql> SELECT name,ip,environment,last_compile FROM hosts;
     +--------------------+-----------------+-------------+---------------------+
     | name               | ip              | environment | last_compile        |
     +--------------------+-----------------+-------------+---------------------+
     | ubuntu.localdomain | 192.168.157.129 | production | 2012-03-04 21:19:41 |
     +--------------------+-----------------+-------------+---------------------+
     1 row in set (0.00 sec)




Easily get a list of hosts


gareth rushgrove | morethanseven.net
mysql> SELECT filename,updated_at FROM source_files;
      +-----------------------------------------------------+---------------------+
      | filename                                            | updated_at          |
      +-----------------------------------------------------+---------------------+
      | NULL                                                | 2011-10-11 10:34:36 |
      | /etc/puppet/modules/users/manifests/init.pp         | 2011-10-12 14:13:49 |
      | /etc/puppet/modules/nagios/manifests/init.pp        | 2011-10-12 14:13:49 |
      | /etc/puppet/modules/ntp/manifests/init.pp           | 2011-10-12 14:13:50 |
      | /etc/puppet/modules/base_packages/manifests/init.pp | 2011-10-12 14:13:50 |
      | /etc/puppet/modules/sudo/manifests/init.pp          | 2011-10-12 14:13:50 |
      | /etc/puppet/modules/apt/manifests/init.pp           | 2011-10-12 14:13:50 |
      | /etc/puppet/modules/logrotate/manifests/init.pp     | 2011-10-12 14:13:51 |
      | /etc/puppet/modules/ganglia/manifests/init.pp       | 2011-10-12 14:13:52 |
      | /etc/puppet/modules/motd/manifests/init.pp          | 2011-10-12 14:13:57 |
      | /etc/puppet/manifests/classes.pp                    | 2011-10-12 14:17:25 |
      | /etc/puppet/modules/mysql/manifests/init.pp         | 2011-10-12 14:17:25 |
      | /etc/puppet/modules/apache2/manifests/init.pp       | 2011-10-12 14:17:25 |
      | /etc/puppet/modules/passenger/manifests/init.pp     | 2011-10-12 14:17:26 |
      +-----------------------------------------------------+---------------------+




Other interesting data too


gareth rushgrove | morethanseven.net
Active Record


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/simplebitsdan/480696708
#!/usr/bin/env ruby

    require 'puppet/rails'

    Puppet[:config] = '/etc/puppet/puppet.conf'
    Puppet.parse_config
    config = Puppet.settings.instance_variable_get(:@values)
    master_config = config[:master]




Load Puppet master configuration


gareth rushgrove | morethanseven.net
adapter = master_conf[:dbadapter]
    args = {:adapter => adapter,
      :log_level => master_conf[:rails_loglevel]}

    args[:host]                        =   master_conf[:dbserver]
    args[:username]                    =   master_conf[:dbuser]
    args[:password]                    =   master_conf[:dbpassword]
    args[:database]                    =   master_conf[:dbname]
    args[:database]                    =   "puppet" unless not args[:database].to_s.empty?
    args[:port]                        =   master_conf[:dbport]
    socket                             =   master_conf[:dbsocket]
    args[:socket]                      =   socket unless socket.to_s.empty?




Map database connection settings


gareth rushgrove | morethanseven.net
ActiveRecord::Base.establish_connection(args)

    Puppet::Rails::Host.all.each { |h|
      puts "#{h.name}"
    }




Make an active record query


gareth rushgrove | morethanseven.net
⚡ ./list.rb
      ubuntu.localdomain




Example run


gareth rushgrove | morethanseven.net
Code spelunking


gareth rushgrove | morethanseven.net
#!/usr/bin/env ruby

     require 'puppet'
     Puppet[:config] = "/etc/puppet/puppet.conf"
     Puppet.parse_config
     Puppet[:clientyamldir] = Puppet[:yamldir]
     Puppet::Node.indirection.terminus_class = :yaml




Load Puppet master configuration


gareth rushgrove | morethanseven.net
nodes = Puppet::Node.indirection.search("*")
     nodes.each do |n|
       facts = Puppet::Node::Facts.indirection.find(n.name)
       tags = Puppet::Resource::Catalog.indirection.find(n.name).tags
       puts "#{n.name} - #{tags.join(', ')}"
     end




Make a query using the internal API


gareth rushgrove | morethanseven.net
⚡ sudo ./puppettags.rb
      ubuntu.localdomain - settings, default, node




Needs root permissions


gareth rushgrove | morethanseven.net
What
⚡ ./puppetlast.rb
      +-----------+-----------------+
      | hostname | last puppet run |
      +-----------+-----------------+
      | hostname4 | 100 minutes     |
      | hostname1 | 25 minutes      |
      | hostname5 | 10 minutes      |
      | hostname2 | 15 minutes      |
      | hostname3 | 5 minutes       |
      +-----------+-----------------+



Command line tools


gareth rushgrove | morethanseven.net
Dashboards


gareth rushgrove | morethanseven.net
web-puppet


gareth rushgrove | morethanseven.net
JSON over HTTP


gareth rushgrove | morethanseven.net
capistrano-puppet


gareth rushgrove | morethanseven.net
require 'capistrano-puppet'

     web_puppet = CapistranoPuppet::Server.new(
       'http://username:password@localhost:9295')

     role :web do
       web_puppet.get_servers('webserver')
     end




Get hosts from puppet


gareth rushgrove | morethanseven.net
Visualisation


gareth rushgrove | morethanseven.net
Your imagination
                                       ?
gareth rushgrove | morethanseven.net
-      web-puppet - https://github.com/garethr/web-puppet
-      capistrano-puppet - https://github.com/garethr/capistrano-puppet
-      puppet-ganglia - https://github.com/jamtur01/puppet-ganglia
-      puppet-zendesk - https://github.com/jamtur01/puppet-zendesk
-      puppet-irc - https://github.com/jamtur01/puppet-irc
-      puppet-campfire - https://github.com/jamtur01/puppet-campfire




Links


gareth rushgrove | morethanseven.net
One more thing


gareth rushgrove | morethanseven.net   http://www.flickr.com/photos/benterrett/6852348725/
Questions?


gareth rushgrove | morethanseven.net   http://flickr.com/photos/psd/102332391/

More Related Content

What's hot

Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration ManagementGareth Rushgrove
 
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICES
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICESTHE RED METHOD: HOW TO INSTRUMENT YOUR SERVICES
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICESInfluxData
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No LearningOlaf Alders
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsHeroku
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with PuppetNick Jones
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Soshi Nemoto
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeKAI CHU CHUNG
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰KAI CHU CHUNG
 
Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4jChristophe Willemsen
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronNick Jones
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Giulio Vian
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easyKim Chee Leong
 
Docker in Action
Docker in ActionDocker in Action
Docker in ActionSimon Su
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)Robert Swisher
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with ResqueNicolas Blanco
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resquehomanj
 

What's hot (20)

Vagrant and Configuration Management
Vagrant and Configuration ManagementVagrant and Configuration Management
Vagrant and Configuration Management
 
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICES
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICESTHE RED METHOD: HOW TO INSTRUMENT YOUR SERVICES
THE RED METHOD: HOW TO INSTRUMENT YOUR SERVICES
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No Learning
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
Building Docker images with Puppet
Building Docker images with PuppetBuilding Docker images with Puppet
Building Docker images with Puppet
 
vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
 
Analysing Github events with Neo4j
Analysing Github events with Neo4jAnalysing Github events with Neo4j
Analysing Github events with Neo4j
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Weird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack NeutronWeird things we've seen with OpenStack Neutron
Weird things we've seen with OpenStack Neutron
 
Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)Introduzione a GitHub Actions (beta)
Introduzione a GitHub Actions (beta)
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easy
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Mangling
Mangling Mangling
Mangling
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
Background processing with Resque
Background processing with ResqueBackground processing with Resque
Background processing with Resque
 
Background Jobs with Resque
Background Jobs with ResqueBackground Jobs with Resque
Background Jobs with Resque
 

Viewers also liked

Communications Between Tribes
Communications Between TribesCommunications Between Tribes
Communications Between TribesGareth Rushgrove
 
Two Sides of Google Infrastructure for Everyone Else
Two Sides of Google Infrastructure for Everyone ElseTwo Sides of Google Infrastructure for Everyone Else
Two Sides of Google Infrastructure for Everyone ElseGareth Rushgrove
 
What to Build with Google App Engine
What to Build with Google App EngineWhat to Build with Google App Engine
What to Build with Google App EngineGareth Rushgrove
 
Social Media Risk and Reputation Management
Social Media Risk and Reputation ManagementSocial Media Risk and Reputation Management
Social Media Risk and Reputation ManagementClaudiu Popa
 
Dev opsdays scriptcode
Dev opsdays scriptcodeDev opsdays scriptcode
Dev opsdays scriptcodeDevopsdays
 
introduction to python
introduction to pythonintroduction to python
introduction to pythonSardar Alam
 
DevOps at DreamLab
DevOps at DreamLabDevOps at DreamLab
DevOps at DreamLabDreamLab
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Chef
 

Viewers also liked (10)

Communications Between Tribes
Communications Between TribesCommunications Between Tribes
Communications Between Tribes
 
Two Sides of Google Infrastructure for Everyone Else
Two Sides of Google Infrastructure for Everyone ElseTwo Sides of Google Infrastructure for Everyone Else
Two Sides of Google Infrastructure for Everyone Else
 
What to Build with Google App Engine
What to Build with Google App EngineWhat to Build with Google App Engine
What to Build with Google App Engine
 
Social Media Risk and Reputation Management
Social Media Risk and Reputation ManagementSocial Media Risk and Reputation Management
Social Media Risk and Reputation Management
 
Dev opsdays scriptcode
Dev opsdays scriptcodeDev opsdays scriptcode
Dev opsdays scriptcode
 
Ruby
RubyRuby
Ruby
 
Thinking Evil Thoughts
Thinking Evil ThoughtsThinking Evil Thoughts
Thinking Evil Thoughts
 
introduction to python
introduction to pythonintroduction to python
introduction to python
 
DevOps at DreamLab
DevOps at DreamLabDevOps at DreamLab
DevOps at DreamLab
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
 

Similar to Puppet Data Mining

Config managament for development environments iii
Config managament for development environments iiiConfig managament for development environments iii
Config managament for development environments iiiPuppet
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
 
10 things I learned building Nomad packs
10 things I learned building Nomad packs10 things I learned building Nomad packs
10 things I learned building Nomad packsBram Vogelaar
 
KubeCon EU 2016: Kubernetes and the Potential for Higher Level Interfaces
KubeCon EU 2016: Kubernetes and the Potential for Higher Level InterfacesKubeCon EU 2016: Kubernetes and the Potential for Higher Level Interfaces
KubeCon EU 2016: Kubernetes and the Potential for Higher Level InterfacesKubeAcademy
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102APNIC
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
Bare-metal and Virtual Provisioning with Razor
Bare-metal and Virtual Provisioning with RazorBare-metal and Virtual Provisioning with Razor
Bare-metal and Virtual Provisioning with RazorKristian Reese
 
Integrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowIntegrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowTatiana Al-Chueyr
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...corehard_by
 
PostgreSQL - Haute disponibilité avec Patroni
PostgreSQL - Haute disponibilité avec PatroniPostgreSQL - Haute disponibilité avec Patroni
PostgreSQL - Haute disponibilité avec Patronislardiere
 
Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014Santiago Bassett
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop AutomationRui Lapa
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 

Similar to Puppet Data Mining (20)

Config managament for development environments iii
Config managament for development environments iiiConfig managament for development environments iii
Config managament for development environments iii
 
Metrics with Ganglia
Metrics with GangliaMetrics with Ganglia
Metrics with Ganglia
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
10 things I learned building Nomad packs
10 things I learned building Nomad packs10 things I learned building Nomad packs
10 things I learned building Nomad packs
 
KubeCon EU 2016: Kubernetes and the Potential for Higher Level Interfaces
KubeCon EU 2016: Kubernetes and the Potential for Higher Level InterfacesKubeCon EU 2016: Kubernetes and the Potential for Higher Level Interfaces
KubeCon EU 2016: Kubernetes and the Potential for Higher Level Interfaces
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Network Automation: Ansible 102
Network Automation: Ansible 102Network Automation: Ansible 102
Network Automation: Ansible 102
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Bare-metal and Virtual Provisioning with Razor
Bare-metal and Virtual Provisioning with RazorBare-metal and Virtual Provisioning with Razor
Bare-metal and Virtual Provisioning with Razor
 
Integrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowIntegrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache Airflow
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...
Встраиваем python для появления аналитики в проекте на С++. Александр Боргард...
 
PostgreSQL - Haute disponibilité avec Patroni
PostgreSQL - Haute disponibilité avec PatroniPostgreSQL - Haute disponibilité avec Patroni
PostgreSQL - Haute disponibilité avec Patroni
 
Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014Malware Detection with OSSEC HIDS - OSSECCON 2014
Malware Detection with OSSEC HIDS - OSSECCON 2014
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop Automation
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 

More from Gareth Rushgrove

You're Going To Need A Bigger Toolbox
You're Going To Need A Bigger ToolboxYou're Going To Need A Bigger Toolbox
You're Going To Need A Bigger ToolboxGareth Rushgrove
 
Message Queues for Web Applications
Message Queues for Web ApplicationsMessage Queues for Web Applications
Message Queues for Web ApplicationsGareth Rushgrove
 
Beyond basic web development
Beyond basic web developmentBeyond basic web development
Beyond basic web developmentGareth Rushgrove
 
Self Education for Web Professionals
Self Education for Web ProfessionalsSelf Education for Web Professionals
Self Education for Web ProfessionalsGareth Rushgrove
 
App Engine for Python Developers
App Engine for Python DevelopersApp Engine for Python Developers
App Engine for Python DevelopersGareth Rushgrove
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django ApplicationsGareth Rushgrove
 
Design Strategies for a Distributed Web
Design Strategies for a Distributed WebDesign Strategies for a Distributed Web
Design Strategies for a Distributed WebGareth Rushgrove
 
Things you probably don't do (or tying to make project automation sexy)
Things you probably don't do (or tying to make project automation sexy)Things you probably don't do (or tying to make project automation sexy)
Things you probably don't do (or tying to make project automation sexy)Gareth Rushgrove
 
Notes from (Web 2.0) Revolution
Notes from (Web 2.0) RevolutionNotes from (Web 2.0) Revolution
Notes from (Web 2.0) RevolutionGareth Rushgrove
 
Shiny Content Management with Radiant
Shiny Content Management with RadiantShiny Content Management with Radiant
Shiny Content Management with RadiantGareth Rushgrove
 

More from Gareth Rushgrove (16)

Web operations
Web operationsWeb operations
Web operations
 
You're Going To Need A Bigger Toolbox
You're Going To Need A Bigger ToolboxYou're Going To Need A Bigger Toolbox
You're Going To Need A Bigger Toolbox
 
Devops
DevopsDevops
Devops
 
Message Queues for Web Applications
Message Queues for Web ApplicationsMessage Queues for Web Applications
Message Queues for Web Applications
 
Beyond basic web development
Beyond basic web developmentBeyond basic web development
Beyond basic web development
 
Self Education for Web Professionals
Self Education for Web ProfessionalsSelf Education for Web Professionals
Self Education for Web Professionals
 
App Engine for Python Developers
App Engine for Python DevelopersApp Engine for Python Developers
App Engine for Python Developers
 
Testing Django Applications
Testing Django ApplicationsTesting Django Applications
Testing Django Applications
 
Design Strategies for a Distributed Web
Design Strategies for a Distributed WebDesign Strategies for a Distributed Web
Design Strategies for a Distributed Web
 
A First Class Web Citizen
A First Class Web CitizenA First Class Web Citizen
A First Class Web Citizen
 
Parsing Microformats
Parsing MicroformatsParsing Microformats
Parsing Microformats
 
Things you probably don't do (or tying to make project automation sexy)
Things you probably don't do (or tying to make project automation sexy)Things you probably don't do (or tying to make project automation sexy)
Things you probably don't do (or tying to make project automation sexy)
 
Notes from (Web 2.0) Revolution
Notes from (Web 2.0) RevolutionNotes from (Web 2.0) Revolution
Notes from (Web 2.0) Revolution
 
Rails flavoured OpenId
Rails flavoured OpenIdRails flavoured OpenId
Rails flavoured OpenId
 
Shiny Content Management with Radiant
Shiny Content Management with RadiantShiny Content Management with Radiant
Shiny Content Management with Radiant
 
RESTful Rabbits
RESTful RabbitsRESTful Rabbits
RESTful Rabbits
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

Puppet Data Mining

  • 1. Puppet Data Mining Report processors, stored configs and more PuppetCamp 22nd March 2012 gareth rushgrove | morethanseven.net http://www.flickr.com/photos/map408/2412123378
  • 2. Gareth Rushgrove @garethr gareth rushgrove | morethanseven.net
  • 3. Blog at morethanseven.net gareth rushgrove | morethanseven.net
  • 5. Text Work at UK Government Digital Service gareth rushgrove | morethanseven.net
  • 6. Serious Government Business gareth rushgrove | morethanseven.net
  • 7. - Why do we want it? - How do we get our hands on it - What can we build with it Puppet data gareth rushgrove | morethanseven.net http://www.flickr.com/photos/iancarroll/5027441664
  • 8. - Why do we want it? - How do we get our hands on it - What can we build with it Puppet data gareth rushgrove | morethanseven.net http://www.flickr.com/photos/iancarroll/5027441664
  • 9. - Why do we want it? - How do we get our hands on it - What can we build with it Puppet data gareth rushgrove | morethanseven.net http://www.flickr.com/photos/iancarroll/5027441664
  • 10. Why
  • 11. Single source of truth gareth rushgrove | morethanseven.net http://www.flickr.com/photos/joeshlabotnik/4132307070/
  • 12. - Spreadsheets - Wiki - Deployment scripts - Application code - SSH configs - More deployment scripts - Monitoring configuration Example: find a list of hostnames gareth rushgrove | morethanseven.net
  • 13. Operational reports gareth rushgrove | morethanseven.net http://www.flickr.com/photos/nettsu/5276327339
  • 14. Company hardware Example: hardware spreadsheet gareth rushgrove | morethanseven.net
  • 15. Hooks for tooling gareth rushgrove | morethanseven.net http://www.flickr.com/photos/nickstone333/3135318558
  • 16. Example: Nagios integration gareth rushgrove | morethanseven.net
  • 17. Example: Rundeck integration gareth rushgrove | morethanseven.net
  • 18. How
  • 19. - Report processors - Stored configurations - Puppet internal APIs Where to find the data gareth rushgrove | morethanseven.net
  • 20. Report processors gareth rushgrove | morethanseven.net http://www.flickr.com/photos/nathaninsandiego/3757033518
  • 21. [agent] report = true pluginsync = true [master] reports = store pluginsync = true Configuration gareth rushgrove | morethanseven.net
  • 22. [agent] report = true pluginsync = true [master] reports = store,http,log,sample pluginsync = true Adding reports gareth rushgrove | morethanseven.net
  • 23. Built in gareth rushgrove | morethanseven.net
  • 24. Store the YAML report on disk. Each host sends its report as a YAML dump and this just stores the file on disk, in the reportdir directory. Store gareth rushgrove | morethanseven.net
  • 25. Send all received logs to the local log destinations. Usually the log destination is syslog. Log gareth rushgrove | morethanseven.net
  • 26. Send report information via HTTP to the reporturl. Each host sends its report as a YAML dump and this sends this YAML to a client via HTTP POST. HTTP gareth rushgrove | morethanseven.net
  • 27. This report sends specific log messages to specific email addresses based on the tags in the log messages. Tagmail gareth rushgrove | morethanseven.net
  • 28. Graph all available data about hosts using the RRD library. RRDgraph gareth rushgrove | morethanseven.net
  • 29. . └── sample-report ├── lib │   └── puppet │   └── reports │   └── sample.rb └── manifests └── init.pp Simple report structure gareth rushgrove | morethanseven.net
  • 30. require 'puppet' require 'yaml' require 'logger' LOG = Logger.new('/tmp/puppet.log') Puppet::Reports.register_report(:sample) do def process message = "Puppet run for #{self.host} #{self.status}" Puppet.debug "Hello from sample report processor" LOG.info message end end Simple report processor gareth rushgrove | morethanseven.net
  • 31. require 'puppet' require 'yaml' require 'logger' LOG = Logger.new('/tmp/puppet.log') Puppet::Reports.register_report(:sample) do def process message = "Puppet run for #{self.host} #{self.status}" Puppet.debug "Hello from sample report processor" LOG.info message end end Register report gareth rushgrove | morethanseven.net
  • 32. require 'puppet' require 'yaml' require 'logger' LOG = Logger.new('/tmp/puppet.log') Puppet::Reports.register_report(:sample) do def process message = "Puppet run for #{self.host} #{self.status}" Puppet.debug "Hello from sample report processor" LOG.info message end end Do something with the data in self gareth rushgrove | morethanseven.net
  • 33. Open source examples gareth rushgrove | morethanseven.net http://www.flickr.com/photos/nettsu/5771348892
  • 34. IRC/Campfire gareth rushgrove | morethanseven.net
  • 35. IRC/Campfire gareth rushgrove | morethanseven.net
  • 36. Ganglia gareth rushgrove | morethanseven.net
  • 37. Graphs! gareth rushgrove | morethanseven.net
  • 38. Zendesk gareth rushgrove | morethanseven.net
  • 39. James Turnbull will have got there first gareth rushgrove | morethanseven.net
  • 40. Stored configuration database gareth rushgrove | morethanseven.net
  • 41. [master] storeconfigs = true dbadapter = mysql dbuser = puppet dbpassword = password dbserver = localhost dbsocket = /var/run/mysql.sock Configuration gareth rushgrove | morethanseven.net
  • 42. SQL gareth rushgrove | morethanseven.net http://www.flickr.com/photos/nettsu/4997777753
  • 43. mysql> SHOW TABLES; +------------------+ | Tables_in_puppet | +------------------+ | fact_names | | fact_values | | hosts | | inventory_facts | | inventory_nodes | | param_names | | param_values | | puppet_tags | | resource_tags | | resources | | source_files | +------------------+ 11 rows in set (0.00 sec) Lots of tables to explore gareth rushgrove | morethanseven.net
  • 44. mysql> SELECT name,ip,environment,last_compile FROM hosts; +--------------------+-----------------+-------------+---------------------+ | name | ip | environment | last_compile | +--------------------+-----------------+-------------+---------------------+ | ubuntu.localdomain | 192.168.157.129 | production | 2012-03-04 21:19:41 | +--------------------+-----------------+-------------+---------------------+ 1 row in set (0.00 sec) Easily get a list of hosts gareth rushgrove | morethanseven.net
  • 45. mysql> SELECT filename,updated_at FROM source_files; +-----------------------------------------------------+---------------------+ | filename | updated_at | +-----------------------------------------------------+---------------------+ | NULL | 2011-10-11 10:34:36 | | /etc/puppet/modules/users/manifests/init.pp | 2011-10-12 14:13:49 | | /etc/puppet/modules/nagios/manifests/init.pp | 2011-10-12 14:13:49 | | /etc/puppet/modules/ntp/manifests/init.pp | 2011-10-12 14:13:50 | | /etc/puppet/modules/base_packages/manifests/init.pp | 2011-10-12 14:13:50 | | /etc/puppet/modules/sudo/manifests/init.pp | 2011-10-12 14:13:50 | | /etc/puppet/modules/apt/manifests/init.pp | 2011-10-12 14:13:50 | | /etc/puppet/modules/logrotate/manifests/init.pp | 2011-10-12 14:13:51 | | /etc/puppet/modules/ganglia/manifests/init.pp | 2011-10-12 14:13:52 | | /etc/puppet/modules/motd/manifests/init.pp | 2011-10-12 14:13:57 | | /etc/puppet/manifests/classes.pp | 2011-10-12 14:17:25 | | /etc/puppet/modules/mysql/manifests/init.pp | 2011-10-12 14:17:25 | | /etc/puppet/modules/apache2/manifests/init.pp | 2011-10-12 14:17:25 | | /etc/puppet/modules/passenger/manifests/init.pp | 2011-10-12 14:17:26 | +-----------------------------------------------------+---------------------+ Other interesting data too gareth rushgrove | morethanseven.net
  • 46. Active Record gareth rushgrove | morethanseven.net http://www.flickr.com/photos/simplebitsdan/480696708
  • 47. #!/usr/bin/env ruby require 'puppet/rails' Puppet[:config] = '/etc/puppet/puppet.conf' Puppet.parse_config config = Puppet.settings.instance_variable_get(:@values) master_config = config[:master] Load Puppet master configuration gareth rushgrove | morethanseven.net
  • 48. adapter = master_conf[:dbadapter] args = {:adapter => adapter, :log_level => master_conf[:rails_loglevel]} args[:host] = master_conf[:dbserver] args[:username] = master_conf[:dbuser] args[:password] = master_conf[:dbpassword] args[:database] = master_conf[:dbname] args[:database] = "puppet" unless not args[:database].to_s.empty? args[:port] = master_conf[:dbport] socket = master_conf[:dbsocket] args[:socket] = socket unless socket.to_s.empty? Map database connection settings gareth rushgrove | morethanseven.net
  • 49. ActiveRecord::Base.establish_connection(args) Puppet::Rails::Host.all.each { |h| puts "#{h.name}" } Make an active record query gareth rushgrove | morethanseven.net
  • 50. ⚡ ./list.rb ubuntu.localdomain Example run gareth rushgrove | morethanseven.net
  • 51. Code spelunking gareth rushgrove | morethanseven.net
  • 52. #!/usr/bin/env ruby require 'puppet' Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config Puppet[:clientyamldir] = Puppet[:yamldir] Puppet::Node.indirection.terminus_class = :yaml Load Puppet master configuration gareth rushgrove | morethanseven.net
  • 53. nodes = Puppet::Node.indirection.search("*") nodes.each do |n| facts = Puppet::Node::Facts.indirection.find(n.name) tags = Puppet::Resource::Catalog.indirection.find(n.name).tags puts "#{n.name} - #{tags.join(', ')}" end Make a query using the internal API gareth rushgrove | morethanseven.net
  • 54. ⚡ sudo ./puppettags.rb ubuntu.localdomain - settings, default, node Needs root permissions gareth rushgrove | morethanseven.net
  • 55. What
  • 56. ⚡ ./puppetlast.rb +-----------+-----------------+ | hostname | last puppet run | +-----------+-----------------+ | hostname4 | 100 minutes | | hostname1 | 25 minutes | | hostname5 | 10 minutes | | hostname2 | 15 minutes | | hostname3 | 5 minutes | +-----------+-----------------+ Command line tools gareth rushgrove | morethanseven.net
  • 57. Dashboards gareth rushgrove | morethanseven.net
  • 58. web-puppet gareth rushgrove | morethanseven.net
  • 59. JSON over HTTP gareth rushgrove | morethanseven.net
  • 61. require 'capistrano-puppet' web_puppet = CapistranoPuppet::Server.new( 'http://username:password@localhost:9295') role :web do web_puppet.get_servers('webserver') end Get hosts from puppet gareth rushgrove | morethanseven.net
  • 62. Visualisation gareth rushgrove | morethanseven.net
  • 63. Your imagination ? gareth rushgrove | morethanseven.net
  • 64. - web-puppet - https://github.com/garethr/web-puppet - capistrano-puppet - https://github.com/garethr/capistrano-puppet - puppet-ganglia - https://github.com/jamtur01/puppet-ganglia - puppet-zendesk - https://github.com/jamtur01/puppet-zendesk - puppet-irc - https://github.com/jamtur01/puppet-irc - puppet-campfire - https://github.com/jamtur01/puppet-campfire Links gareth rushgrove | morethanseven.net
  • 65. One more thing gareth rushgrove | morethanseven.net http://www.flickr.com/photos/benterrett/6852348725/
  • 66. Questions? gareth rushgrove | morethanseven.net http://flickr.com/photos/psd/102332391/