SlideShare a Scribd company logo
Assurer – A server testing/monitoring framework Gosuke Miyashita http://mizzy.org/
Myself Known as Chocoboy Miyashita somewhere Working in paperboy&co. Mainly developed public/private web service APIs with perl and catalyt ... but now also woking on servers and networks and so on Today’s my son’s entrance ceremony of an elementary school
 
What’s Assurer ? A server testing/monitoring framework like Plagger  Plugin mechanism YAML configurable assets Test by Test::Base  Originally developed for one time test of servers that are newly built Monitoring seems like testing, so decided to cover monitoring
Where the name Assurer derived from ? Pronounce “A-shu-ra” Plagger like tools ended with “er” Archer by tokuhirom Observer by Hatena (not in public) Dishuber by Yappo Precure by Kan Fushihara Testing is also called “Quality Assurance” MISS
Image of exec Assurer #0
Image of exec Assurer #1
Image of Asura Baster
Image of the real Asura
Image of fake Asura
Execution phases of Assurer
Execution phases of Assurer  Test phase Execute test Nofity phase Notify test results Format phase Format test results Publish phase Output formatted test results
Relation of each phases Test Publish Format Nofity
Details of each phases
Test phase
Test phase Execute test Plugins on this phase: Test::HTTP Test::SMTP Test::DBI Test::Ping etc
Config of test phase test: -  module:  HTTP config: host:   www.mizzy.org content:   It works!
Notify phase
Notify  フェーズ Notify test results Plugin on this phase: Notify::IRC
Config of notify phase notify: -  module:  IRC config: daemon_port:  9991 nickname:  assurerbot server_host:  chat.freenode.net server_port:  6667 server_channels: - #assurer - #assurer-jp charset:  iso-2022-jp announce:  notice
Notify::IRC example
Format phase
Format phase Format test results Plugins on this phase: Format::Text Fomat::HTML
Config of format phase format: -  module:  HTML config: css:  /css/style.css
Publish phase
Publish phase Output formatted results Plugins on this phase: Publish::Term Publish::Mail Publish::File
Config of publish phase publish: - module: Mail config: subject: Test results from Assurer to: someone@example.com from: root@example.com publish: -  module:  Mail config: subject:  Test results from Assurer to:  someone@example.com from:  root@example.com
Format::Text + Publish::Term
Format::HTML + Publish::File
Format::Text + Publish::Mail
Summary for now Assurer is a serverPlagger  Test, Notify, Format and Publish phases Easily change tests and outputs with plugins
Extra functions
Hosts and Roles
Hosts and roles Write target hosts and roles in one place on config.yaml
Config without hosts and roles test: - module: HTTP config: host: www0.mizzy.org - module: HTTP config: host: www1.mizzy.org
Config with hosts and roles test: - module: HTTP role: web hosts: web: - www0.mizzy.org - www1.mizzy.org
Filter
Filter Filtering test results on format and notify phase Filtering formatted results on publish phase
Filter on format phase Only OK results are formatted as text format format: - module: Text filter: module:  Status status:  ok
Filter on notify phase Only NOK results are notified to IRC notify: - module: IRC filter: module:  Status status:  not ok
Filter on publish phase Text formatted results are displayed on a terminal,html formatted results are sent as a mail format: - module: Text - module: HTML pusblish: - module: Term filter: module:  Type type:  text/plain - module: Mail filter: module:  Type type:  text/html
Config validation
Config validation Kwalify – YAML schema validator  http://www.kuwata-lab.com/kwalify /   Validate common config Validate config of each plugin Kwalify schemas for each plugin put under assets/kwalify/plugins
Mistake on common config test s :  # test is right - module: Test::HTTP  $ ./assurer.pl -c config.yaml Assurer::ConfigLoader [fatal] - [/]  Expected required key  `test‘ - [/tests]  Unexpected key  `tests'  at line 46
Mistake on plugin config test: - module: HTTP config: content s : XXX  # content is right $ ./assurer.pl -c config.yaml Assurer::ConfigLoader [fatal] Config error in  Test::HTTP - [/contents]  Unexpected key  `contents'  at line 66
Shell mode
Shell mode Execute shell command on hosts in config.yaml
Shell mode $ ./assurer.pl --shell assurer>   uptime [www.mizzy.org]  21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17 [svn.mizzy.org]  21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17 [ftp.mizzy.org]  21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17
Exec on hosts belong to specified role $ ./assurer.pl --shell  --role=web assurer>   uptime [www.mizzy.org]  21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17
Special command !on assurer>   !on   app1.foo.com  \   app2.foo.com   do  uptime # Exec on app1.foo.com and app2.foo.com only assurer>   !on   /.*\.foo\.com/   do   \ uptime # Exec on hosts matched .*\.foo\.com only
Special command !with assurer>   !with   web db   do  uptime # exec on hosts belong to web role and db role assurer>   !with   /web|mail/   do  uptime # exec on hosts belong to role match web or mail
Special command !test assurer>   !test  HTTP Assurer::Plugin::Test::HTTP [info] Testing HTTP on www0.mizzy.org ...  ok 1 - HTTP status code of http://mizzy.org:80 is 200 not ok 2 – Content of http://mizzy.org:80 matches 'It works!‘ assurer>
Special command !test assurer>   !test  HTTP  on  app1.foo.com  # test http on app1.foo.com assurer>   !test  HTTP  on  /.*.foo.com/  # can use regexp assurer>   !test  HTTP  with  web  # test http on hosts belong to web role assurer>   !test  HTTP  with  /web|mail/ # can use regexp
Parallel testing
Pallarel testing Multiple test processes on test phase Default is 5 Can change number processes working at once $ assurer.pl  --para=20
Distributed testing
Distributed testing localhost test0.mizzy.org www0.mizzy.org www1.mizzy.org www2.mizzy.org test1.mizzy.org test2.mizzy.org 1. ssh assurer_test.pl 3. Return result 2. Exec test
Config for distributed testing exec_on: -  host:  test0.mizzy.org priority:  3 -  host:  test1.mizzy.org priority:  2  -  host:  test2.mizzy.org priority:  1
Auto config generation
Auto config generation Scan hosts in template.yaml by Nmap::Scanner Detect services working on the hosts and generete config.yaml automatically config templates for each plugin put under assets/discover (http.yaml, mysql.yaml, etc)  # assurer.pl  --discover   -c template.yaml
Integragte Test::WWW::Mechanize
Integrate Test::WWW::Mechanize Can write tests using Test::WWW::Mechanize  Put .pl files under assets/plugins/Test-WWW-Mechanize  Pre-set $mech, $host  on execution
asset file for Test::WWW::Mechanize # $host and $mech are set by Assure core $mech ->get_ok("http:// $host ", "got htttp:// $host "); $mech ->content_contains('It works!', "Content matches 'It works!'");
Inside Assurer
Assurer::Test module
Assurer::Test module Export Test::More like methods is,() like(), ok() Output test results formatted as TAP (Test Analyze Protocol)
Inside test plugins
Inside test plugins package Assurer::Plugin::Test::HTTP; use base qw( Assurer::Plugin::Test ); use Assurer::Test; sub register { my $self = shift; $self->register_tests( qw/  status  content server / ); } sub status { my ( $self, $context, $args ) = @_; ...  中略 is( $res->code, '200', 'HTTP status code of $self->{url} is 200' ); }
Internal mechanism in test phase
Internal mechanism in test phase assurer.pl Assurer::bootstrap() Assurer::Dispatch::run() call exec directly or  by ssh exec tests return test results call generate result objects next phase assurer_test.pl assurer_test.pl assurer_test.pl assurer_test.pl assurer_test.pl Assurer::Result Assurer::Result Assurer::Result Assurer::Result Assurer::Result
Assurer::Dispatch::run() Exec assurer_test.pl for each test  Pallarelize by POE::Wheel::Run Number of processed controlled by POE::Component::JobQueue Pass config for plugin and context object serialized by YAML and encoded by Base64
assurer_test.pl assurer_test.pl   -– config = LS0tCmNvbmZpZzoKICBjb250ZW50OiBJ dCB3b3JrcyEKICBob3N0OiB3d3cubWl6enkub3JnCm1vZHVsZTogSFRUUApuYW1lOiBIVFRQIHRlc3QKcm9sZTogd2ViCg== - - context =LS0tICEhcGVybC9oYXNoOkFzc3VyZXIKYmFzZV9kaXI6IC9 ob21lL21peWEvc3ZrL0Fzc3VyZXIKY29uZmlnOgogIGZvcm1hdDoKICAgIC0gY29uZmlnOiAmMSB7fQogICAgICBtb2R1bGU6IFRleHQKICBnbG9iYWw6CiAgICBob3N0OiB+CiAgICBpbnRlcnZhbDogMwogICAgbG9nOgogICAgICBsZXZlbDogZGVidWcKICAgIG5vX2RpYWc6IDAKICAgIHJldHJ5OiAzCiAgaG9zdHM6CiAgICBmdHA6CiAgICAgIC0gZnRwLm1penp5Lm9yZwogICAgc3ZuOgogICAgICAtIHN2bi5taXp6eS5vcmcKICAgIHdlYjoKICAgICAgLSB3d3cubWl6enkub3JnCiAgICAgIC0gc3ZuLm1penp5Lm9yZwogICAgICAtIHRyYWMubWl6enkub3JnCiAgbm90aWZ5OgogICAgLSBjb25maWc6CiAgICAgICAgYW5ub3VuY2U6IG5vdGljZQogICAgICAgIGNoYXJzZXQ6IGlzby0yMDIyLWpwCiAgICAgICAgZGFlbW9uX3BvcnQ6IDk5OTEKICAgICAgICBuaWNrbmFtZTogYXNzdXJlcmJvdAog  ... cont ...
Why POE::Wheel::Run ? Would like to exec tests as other processes Need non-blocking I/O with single process and POE Can easily distribute to remote servers (exec directly on local, exec by ssh on remote ) Communication with test processes Can communicate easily with test processes by STDIN, STDOUT and STDERR
Roadmap
Roadmap Integrate with Nagios/NRPE (Test::Nagios) Enhance notify phase Store Plugin (store test results in database) Integrate with Archer, puppet (share host lists) Test of Assurer itsself
Web site and IRC channels
Web sites and IRC channels http://assurer.jp/trac http://mizzy.org/ #assurer@chat.freenode.net #assurer-ja@chat.freenode.net
Thanks

More Related Content

What's hot (20)

PPTX
Design patterns as power of programing
Lukas Lesniewski
 
PDF
"Swoole: double troubles in c", Alexandr Vronskiy
Fwdays
 
PDF
Ruby HTTP clients comparison
Hiroshi Nakamura
 
PPTX
Getting Started with Capistrano
LaunchAny
 
PPTX
Implement server push in flask framework
Chi-Chia Huang
 
PDF
Designing net-aws-glacier
Workhorse Computing
 
PPTX
Capistrano - automate all the things
John Cleary
 
PPT
Capistrano
Jason Noble
 
PDF
Effective Benchmarks
Workhorse Computing
 
PDF
Unit Testing Lots of Perl
Workhorse Computing
 
PDF
Getting testy with Perl
Workhorse Computing
 
PDF
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Zend by Rogue Wave Software
 
KEY
Plack - LPW 2009
Tatsuhiko Miyagawa
 
PPTX
PowerShell: Automation for everyone
Gavin Barron
 
PPTX
Controlling multiple VMs with the power of Python
Yurii Vasylenko
 
PDF
Perl web app 테스트전략
Jeen Lee
 
PDF
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
 
PDF
Ruby HTTP clients
Zoran Majstorovic
 
PDF
Asynchronous programming done right - Node.js
Piotr Pelczar
 
PDF
Flask Introduction - Python Meetup
Areski Belaid
 
Design patterns as power of programing
Lukas Lesniewski
 
"Swoole: double troubles in c", Alexandr Vronskiy
Fwdays
 
Ruby HTTP clients comparison
Hiroshi Nakamura
 
Getting Started with Capistrano
LaunchAny
 
Implement server push in flask framework
Chi-Chia Huang
 
Designing net-aws-glacier
Workhorse Computing
 
Capistrano - automate all the things
John Cleary
 
Capistrano
Jason Noble
 
Effective Benchmarks
Workhorse Computing
 
Unit Testing Lots of Perl
Workhorse Computing
 
Getting testy with Perl
Workhorse Computing
 
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Zend by Rogue Wave Software
 
Plack - LPW 2009
Tatsuhiko Miyagawa
 
PowerShell: Automation for everyone
Gavin Barron
 
Controlling multiple VMs with the power of Python
Yurii Vasylenko
 
Perl web app 테스트전략
Jeen Lee
 
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
 
Ruby HTTP clients
Zoran Majstorovic
 
Asynchronous programming done right - Node.js
Piotr Pelczar
 
Flask Introduction - Python Meetup
Areski Belaid
 

Viewers also liked (6)

PDF
Server specのご紹介
Akira Kaneda
 
ODP
Serverspecの本気をみるのです
hayabusa333
 
PDF
serverspecでサーバ環境のテストを書いてみよう
Daisuke Ikeda
 
PDF
Serverspecを自分好みにアレンジ スクリーンショットで証跡保存を撲滅-
Daisuke Ikeda
 
PDF
Serverspecの活用tips紹介
Daisuke Ikeda
 
PDF
Serverspecを使ってサーバ5000台のBaculaクライアントをテスト
Ken Sawada
 
Server specのご紹介
Akira Kaneda
 
Serverspecの本気をみるのです
hayabusa333
 
serverspecでサーバ環境のテストを書いてみよう
Daisuke Ikeda
 
Serverspecを自分好みにアレンジ スクリーンショットで証跡保存を撲滅-
Daisuke Ikeda
 
Serverspecの活用tips紹介
Daisuke Ikeda
 
Serverspecを使ってサーバ5000台のBaculaクライアントをテスト
Ken Sawada
 
Ad

Similar to Assurer - a pluggable server testing/monitoring framework (20)

PDF
Network Test Automation - Net Ops Coding 2015
Hiroshi Ota
 
PPT
Integris Security - Hacking With Glue ℠
Integris Security LLC
 
PPTX
Puppet meetup testing
Phil Zimmerman
 
PDF
2021 04-15 operational verification (with notes)
Puppet
 
PPTX
Best practices for ansible
George Shuklin
 
PPTX
BuildStuff.LT 2018 InSpec Workshop
Mandi Walls
 
KEY
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
PDF
How could I automate log gathering in the distributed system
Jun Hong Kim
 
PDF
Care and Feeding of Large Web Applications
Perrin Harkins
 
PDF
How to Make a Unicorn: Finding Cybersecurity Talent in the Real World (Boston)
Franklin Mosley
 
PDF
Creating a mature puppet system
rkhatibi
 
PDF
Creating a Mature Puppet System
Puppet
 
PPTX
Testing Ansible
Anth Courtney
 
PDF
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet
 
PDF
Steamlining your puppet development workflow
Tomas Doran
 
PDF
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet
 
PDF
PLNOG Automation@Brainly
vespian_256
 
PDF
PLNOG14: Automation at Brainly - Paweł Rozlach
PROIDEA
 
PDF
Test driven infrastructure
Skills Matter Talks
 
Network Test Automation - Net Ops Coding 2015
Hiroshi Ota
 
Integris Security - Hacking With Glue ℠
Integris Security LLC
 
Puppet meetup testing
Phil Zimmerman
 
2021 04-15 operational verification (with notes)
Puppet
 
Best practices for ansible
George Shuklin
 
BuildStuff.LT 2018 InSpec Workshop
Mandi Walls
 
From Dev to DevOps - Apache Barcamp Spain 2011
Carlos Sanchez
 
How could I automate log gathering in the distributed system
Jun Hong Kim
 
Care and Feeding of Large Web Applications
Perrin Harkins
 
How to Make a Unicorn: Finding Cybersecurity Talent in the Real World (Boston)
Franklin Mosley
 
Creating a mature puppet system
rkhatibi
 
Creating a Mature Puppet System
Puppet
 
Testing Ansible
Anth Courtney
 
Puppet Camp Atlanta 2014: DEV Toolsets for Ops (Beginner) -
Puppet
 
Steamlining your puppet development workflow
Tomas Doran
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet
 
PLNOG Automation@Brainly
vespian_256
 
PLNOG14: Automation at Brainly - Paweł Rozlach
PROIDEA
 
Test driven infrastructure
Skills Matter Talks
 
Ad

More from Gosuke Miyashita (20)

PDF
Walter ファミリーの紹介 at Shibuya.go#1
Gosuke Miyashita
 
PDF
Serverspec at Testing Framework Meeting
Gosuke Miyashita
 
PPTX
Serverspec at July Tech Festa 2013
Gosuke Miyashita
 
PPTX
Serverspec at hbstudy #45
Gosuke Miyashita
 
PPTX
NoSQLに関するまとめ
Gosuke Miyashita
 
PPTX
イベント駆動プログラミングとI/O多重化
Gosuke Miyashita
 
PPTX
Maglica - A Simple Internal Cloud Tool at #techkayac
Gosuke Miyashita
 
PPTX
DevOps とは何か 何であるべきか
Gosuke Miyashita
 
PPTX
Inside Sqale's Backend at RubyConf Taiwan 2012
Gosuke Miyashita
 
PPTX
Ia型超新星とチャンドラセカール限界
Gosuke Miyashita
 
PPTX
How Perl Changed My Life
Gosuke Miyashita
 
PPTX
Inside Sqale's Backend at YAPC::Asia Tokyo 2012
Gosuke Miyashita
 
PPTX
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Gosuke Miyashita
 
PPTX
Open Source System Administration Framework - Func
Gosuke Miyashita
 
PPTX
10分でわかるDevOps
Gosuke Miyashita
 
PPTX
DevOpsって何?
Gosuke Miyashita
 
PPTX
Puppetのススメ
Gosuke Miyashita
 
PPT
Puppet Best Practices? at COOKPAD
Gosuke Miyashita
 
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...
Gosuke Miyashita
 
PPT
Danga::Socketの非同期処理の仕組みとPerlbalで非同期処理するプラグインを書く方法
Gosuke Miyashita
 
Walter ファミリーの紹介 at Shibuya.go#1
Gosuke Miyashita
 
Serverspec at Testing Framework Meeting
Gosuke Miyashita
 
Serverspec at July Tech Festa 2013
Gosuke Miyashita
 
Serverspec at hbstudy #45
Gosuke Miyashita
 
NoSQLに関するまとめ
Gosuke Miyashita
 
イベント駆動プログラミングとI/O多重化
Gosuke Miyashita
 
Maglica - A Simple Internal Cloud Tool at #techkayac
Gosuke Miyashita
 
DevOps とは何か 何であるべきか
Gosuke Miyashita
 
Inside Sqale's Backend at RubyConf Taiwan 2012
Gosuke Miyashita
 
Ia型超新星とチャンドラセカール限界
Gosuke Miyashita
 
How Perl Changed My Life
Gosuke Miyashita
 
Inside Sqale's Backend at YAPC::Asia Tokyo 2012
Gosuke Miyashita
 
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Gosuke Miyashita
 
Open Source System Administration Framework - Func
Gosuke Miyashita
 
10分でわかるDevOps
Gosuke Miyashita
 
DevOpsって何?
Gosuke Miyashita
 
Puppetのススメ
Gosuke Miyashita
 
Puppet Best Practices? at COOKPAD
Gosuke Miyashita
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
Gosuke Miyashita
 
Danga::Socketの非同期処理の仕組みとPerlbalで非同期処理するプラグインを書く方法
Gosuke Miyashita
 

Recently uploaded (20)

PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 

Assurer - a pluggable server testing/monitoring framework

  • 1. Assurer – A server testing/monitoring framework Gosuke Miyashita http://mizzy.org/
  • 2. Myself Known as Chocoboy Miyashita somewhere Working in paperboy&co. Mainly developed public/private web service APIs with perl and catalyt ... but now also woking on servers and networks and so on Today’s my son’s entrance ceremony of an elementary school
  • 3.  
  • 4. What’s Assurer ? A server testing/monitoring framework like Plagger Plugin mechanism YAML configurable assets Test by Test::Base Originally developed for one time test of servers that are newly built Monitoring seems like testing, so decided to cover monitoring
  • 5. Where the name Assurer derived from ? Pronounce “A-shu-ra” Plagger like tools ended with “er” Archer by tokuhirom Observer by Hatena (not in public) Dishuber by Yappo Precure by Kan Fushihara Testing is also called “Quality Assurance” MISS
  • 6. Image of exec Assurer #0
  • 7. Image of exec Assurer #1
  • 8. Image of Asura Baster
  • 9. Image of the real Asura
  • 10. Image of fake Asura
  • 12. Execution phases of Assurer Test phase Execute test Nofity phase Notify test results Format phase Format test results Publish phase Output formatted test results
  • 13. Relation of each phases Test Publish Format Nofity
  • 14. Details of each phases
  • 16. Test phase Execute test Plugins on this phase: Test::HTTP Test::SMTP Test::DBI Test::Ping etc
  • 17. Config of test phase test: - module: HTTP config: host: www.mizzy.org content: It works!
  • 19. Notify フェーズ Notify test results Plugin on this phase: Notify::IRC
  • 20. Config of notify phase notify: - module: IRC config: daemon_port: 9991 nickname: assurerbot server_host: chat.freenode.net server_port: 6667 server_channels: - #assurer - #assurer-jp charset: iso-2022-jp announce: notice
  • 23. Format phase Format test results Plugins on this phase: Format::Text Fomat::HTML
  • 24. Config of format phase format: - module: HTML config: css: /css/style.css
  • 26. Publish phase Output formatted results Plugins on this phase: Publish::Term Publish::Mail Publish::File
  • 27. Config of publish phase publish: - module: Mail config: subject: Test results from Assurer to: [email protected] from: [email protected] publish: - module: Mail config: subject: Test results from Assurer to: [email protected] from: [email protected]
  • 31. Summary for now Assurer is a serverPlagger Test, Notify, Format and Publish phases Easily change tests and outputs with plugins
  • 34. Hosts and roles Write target hosts and roles in one place on config.yaml
  • 35. Config without hosts and roles test: - module: HTTP config: host: www0.mizzy.org - module: HTTP config: host: www1.mizzy.org
  • 36. Config with hosts and roles test: - module: HTTP role: web hosts: web: - www0.mizzy.org - www1.mizzy.org
  • 38. Filter Filtering test results on format and notify phase Filtering formatted results on publish phase
  • 39. Filter on format phase Only OK results are formatted as text format format: - module: Text filter: module: Status status: ok
  • 40. Filter on notify phase Only NOK results are notified to IRC notify: - module: IRC filter: module: Status status: not ok
  • 41. Filter on publish phase Text formatted results are displayed on a terminal,html formatted results are sent as a mail format: - module: Text - module: HTML pusblish: - module: Term filter: module: Type type: text/plain - module: Mail filter: module: Type type: text/html
  • 43. Config validation Kwalify – YAML schema validator http://www.kuwata-lab.com/kwalify / Validate common config Validate config of each plugin Kwalify schemas for each plugin put under assets/kwalify/plugins
  • 44. Mistake on common config test s : # test is right - module: Test::HTTP $ ./assurer.pl -c config.yaml Assurer::ConfigLoader [fatal] - [/] Expected required key `test‘ - [/tests] Unexpected key `tests' at line 46
  • 45. Mistake on plugin config test: - module: HTTP config: content s : XXX # content is right $ ./assurer.pl -c config.yaml Assurer::ConfigLoader [fatal] Config error in Test::HTTP - [/contents] Unexpected key `contents' at line 66
  • 47. Shell mode Execute shell command on hosts in config.yaml
  • 48. Shell mode $ ./assurer.pl --shell assurer> uptime [www.mizzy.org] 21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17 [svn.mizzy.org] 21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17 [ftp.mizzy.org] 21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17
  • 49. Exec on hosts belong to specified role $ ./assurer.pl --shell --role=web assurer> uptime [www.mizzy.org] 21:48:24 up 5 days, 23:08, 2 users, load average: 0.24, 0.16, 0.17
  • 50. Special command !on assurer> !on app1.foo.com \ app2.foo.com do uptime # Exec on app1.foo.com and app2.foo.com only assurer> !on /.*\.foo\.com/ do \ uptime # Exec on hosts matched .*\.foo\.com only
  • 51. Special command !with assurer> !with web db do uptime # exec on hosts belong to web role and db role assurer> !with /web|mail/ do uptime # exec on hosts belong to role match web or mail
  • 52. Special command !test assurer> !test HTTP Assurer::Plugin::Test::HTTP [info] Testing HTTP on www0.mizzy.org ... ok 1 - HTTP status code of http://mizzy.org:80 is 200 not ok 2 – Content of http://mizzy.org:80 matches 'It works!‘ assurer>
  • 53. Special command !test assurer> !test HTTP on app1.foo.com # test http on app1.foo.com assurer> !test HTTP on /.*.foo.com/ # can use regexp assurer> !test HTTP with web # test http on hosts belong to web role assurer> !test HTTP with /web|mail/ # can use regexp
  • 55. Pallarel testing Multiple test processes on test phase Default is 5 Can change number processes working at once $ assurer.pl --para=20
  • 57. Distributed testing localhost test0.mizzy.org www0.mizzy.org www1.mizzy.org www2.mizzy.org test1.mizzy.org test2.mizzy.org 1. ssh assurer_test.pl 3. Return result 2. Exec test
  • 58. Config for distributed testing exec_on: - host: test0.mizzy.org priority: 3 - host: test1.mizzy.org priority: 2 - host: test2.mizzy.org priority: 1
  • 60. Auto config generation Scan hosts in template.yaml by Nmap::Scanner Detect services working on the hosts and generete config.yaml automatically config templates for each plugin put under assets/discover (http.yaml, mysql.yaml, etc) # assurer.pl --discover -c template.yaml
  • 62. Integrate Test::WWW::Mechanize Can write tests using Test::WWW::Mechanize Put .pl files under assets/plugins/Test-WWW-Mechanize Pre-set $mech, $host on execution
  • 63. asset file for Test::WWW::Mechanize # $host and $mech are set by Assure core $mech ->get_ok("http:// $host ", "got htttp:// $host "); $mech ->content_contains('It works!', "Content matches 'It works!'");
  • 66. Assurer::Test module Export Test::More like methods is,() like(), ok() Output test results formatted as TAP (Test Analyze Protocol)
  • 68. Inside test plugins package Assurer::Plugin::Test::HTTP; use base qw( Assurer::Plugin::Test ); use Assurer::Test; sub register { my $self = shift; $self->register_tests( qw/ status content server / ); } sub status { my ( $self, $context, $args ) = @_; ... 中略 is( $res->code, '200', 'HTTP status code of $self->{url} is 200' ); }
  • 69. Internal mechanism in test phase
  • 70. Internal mechanism in test phase assurer.pl Assurer::bootstrap() Assurer::Dispatch::run() call exec directly or by ssh exec tests return test results call generate result objects next phase assurer_test.pl assurer_test.pl assurer_test.pl assurer_test.pl assurer_test.pl Assurer::Result Assurer::Result Assurer::Result Assurer::Result Assurer::Result
  • 71. Assurer::Dispatch::run() Exec assurer_test.pl for each test Pallarelize by POE::Wheel::Run Number of processed controlled by POE::Component::JobQueue Pass config for plugin and context object serialized by YAML and encoded by Base64
  • 72. assurer_test.pl assurer_test.pl -– config = LS0tCmNvbmZpZzoKICBjb250ZW50OiBJ dCB3b3JrcyEKICBob3N0OiB3d3cubWl6enkub3JnCm1vZHVsZTogSFRUUApuYW1lOiBIVFRQIHRlc3QKcm9sZTogd2ViCg== - - context =LS0tICEhcGVybC9oYXNoOkFzc3VyZXIKYmFzZV9kaXI6IC9 ob21lL21peWEvc3ZrL0Fzc3VyZXIKY29uZmlnOgogIGZvcm1hdDoKICAgIC0gY29uZmlnOiAmMSB7fQogICAgICBtb2R1bGU6IFRleHQKICBnbG9iYWw6CiAgICBob3N0OiB+CiAgICBpbnRlcnZhbDogMwogICAgbG9nOgogICAgICBsZXZlbDogZGVidWcKICAgIG5vX2RpYWc6IDAKICAgIHJldHJ5OiAzCiAgaG9zdHM6CiAgICBmdHA6CiAgICAgIC0gZnRwLm1penp5Lm9yZwogICAgc3ZuOgogICAgICAtIHN2bi5taXp6eS5vcmcKICAgIHdlYjoKICAgICAgLSB3d3cubWl6enkub3JnCiAgICAgIC0gc3ZuLm1penp5Lm9yZwogICAgICAtIHRyYWMubWl6enkub3JnCiAgbm90aWZ5OgogICAgLSBjb25maWc6CiAgICAgICAgYW5ub3VuY2U6IG5vdGljZQogICAgICAgIGNoYXJzZXQ6IGlzby0yMDIyLWpwCiAgICAgICAgZGFlbW9uX3BvcnQ6IDk5OTEKICAgICAgICBuaWNrbmFtZTogYXNzdXJlcmJvdAog ... cont ...
  • 73. Why POE::Wheel::Run ? Would like to exec tests as other processes Need non-blocking I/O with single process and POE Can easily distribute to remote servers (exec directly on local, exec by ssh on remote ) Communication with test processes Can communicate easily with test processes by STDIN, STDOUT and STDERR
  • 75. Roadmap Integrate with Nagios/NRPE (Test::Nagios) Enhance notify phase Store Plugin (store test results in database) Integrate with Archer, puppet (share host lists) Test of Assurer itsself
  • 76. Web site and IRC channels
  • 77. Web sites and IRC channels http://assurer.jp/trac http://mizzy.org/ #[email protected] #[email protected]