SlideShare a Scribd company logo
1 of 24
Investigative Debugging of
ManageIQ Automation
Peter McGowan
(An Automation
Scripter’s Guide to
Overcoming
Frustrations)
Agenda
• Making sense of the log files
• $evm & Service Model refresher
• Examining objects
• Inspecting objects
• Walking objects
• Object analysis mid-workflow
Takeaways
How to use the logs effectively
Understand when to use $evm.root or $evm.object
Understand how to examine Service Model objects
Understand how to inspect/debug objects mid-workflow
Use the Logs, Luke
Log Files
[----] I, [2016-05-23T11:34:08.351374 #3880:51197c] INFO -- : MIQ(MiqQueue.put) Message id: [2679], id: [], Zone: [default], Role: [smartstate], Server: [], Ident:
[generic], Target id: [], Instance id: [], Task id: [job_dispatcher], Command: [JobProxyDispatcher.dispatch], Timeout: [600], Priority: [20], State: [ready], Deliver On: [],
Data: [], Args: []
[----] I, [2016-05-23T11:34:09.144251 #3655:51197c] INFO -- : MIQ(MiqServer#populate_queue_messages) Fetched 2 miq_queue rows for queue_name=generic,
wcount=4, priority=200
[----] I, [2016-05-23T11:34:09.754587 #3857:51197c] INFO -- : MIQ(MiqPriorityWorker::Runner#get_message_via_drb) Message id: [2679], MiqWorker id: [4], Zone:
[default], Role: [smartstate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [job_dispatcher], Command: [JobProxyDispatcher.dispatch], Timeout:
[600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [], Dequeued in: [1.404928107] seconds
Log Files
# rake evm:status
Checking EVM status...
Zone | Server Name | Status | ID | PID | SPID | URL | Started On | ...
default | EVM | started | 1 | 3655 | 3685 | druby://127.0.0.1:60715 | 2016-05-23T05:58:07Z | ...
Worker Type | Status | ID | PID | SPID | Queue Name / URL --------------------------------------------------------------+---------+----+-------+-
------+----------------------- ManageIQ::Providers::Openstack::CloudManager::EventCatcher | started | 16 | 4760 | 4764 | ems_1 |
ManageIQ::Providers::Openstack::CloudManager::RefreshWorker | started | 20 | 34230 | 34234 | ems_1 |
ManageIQ::Providers::Openstack::NetworkManager::EventCatcher | started | 17 | 4767 | 4771 | ems_2 |
ManageIQ::Providers::Openstack::NetworkManager::RefreshWorker | started | 21 | 34235 | 34239 | ems_2 |
MiqEventHandler | started | 1 | 3841 | 3845 | ems |
MiqGenericWorker | started | 3 | 3851 | 3855 | generic |
MiqGenericWorker | started | 2 | 3846 | 3850 | generic |
MiqPriorityWorker | started | 4 | 3857 | 3861 | generic |
MiqPriorityWorker | started | 5 | 3863 | 3868 | generic |
MiqReportingWorker | started | 7 | 3874 | 3878 | reporting |
MiqReportingWorker | started | 6 | 3869 | 3873 | reporting |
MiqScheduleWorker | started | 8 | 3880 | 3885 | |
MiqUiWorker | started | 10 | 3904 | | http://127.0.0.1:3000 |
MiqWebServiceWorker | started | 11 | 3928 | | http://127.0.0.1:4000 |
MiqWebsocketWorker | started | 9 | 3892 | | http://127.0.0.1:5000 |
Log Files
grep -i "3846:|3851:|3857:|3863:" log/evm.log
[----] I, [2016-05-23T11:52:15.090823 #3846:51197c] INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [2845], MiqWorker id: [2], Zone:
[default], Role: [automate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqAeEngine.deliver], Timeout: [3600], Priority: [20], State:
[dequeue], Deliver On: [], Data: [], Args: [{:object_type=>"AutomationRequest", :object_id=>11, :attrs=>{:event_type=>"request_created",
"EventStream::event_stream"=>100, :event_stream_id=>100}, :instance_name=>"Event", :user_id=>1, :miq_group_id=>2, :tenant_id=>1, :automate_message=>nil}],
Dequeued in: [3.039205536] seconds
[----] I, [2016-05-23T11:52:16.166956 #3851:51197c] INFO -- : Q-task_id([automation_task_11]) <AutomationEngine> Invoking [inline] method [/Bit63/Stuff/Methods/test]
with inputs [{}]
[----] I, [2016-05-23T11:52:16.167584 #3851:51197c] INFO -- : Q-task_id([automation_task_11]) <AutomationEngine> <AEMethod [/Bit63/Stuff/Methods/test]> Starting
[----] I, [2016-05-23T11:52:16.241517 #3846:b1083c] INFO -- : <AutomationEngine> <AEMethod parse_provider_category> Parse Provider Category Key: nil Value:
unknown
[----] I, [2016-05-23T11:52:16.290814 #3846:51197c] INFO -- : <AutomationEngine> <AEMethod /ManageIQ/System/Process/parse_provider_category]> Ending
[----] I, [2016-05-23T11:52:16.290992 #3846:51197c] INFO -- : <AutomationEngine> Method exited with rc=MIQ_OK
Use Following…Followed
Following Relationship [miqaedb:/cloud/VM/Lifecycle/Provisioning#create]
Following Relationship
[miqaedb:/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template#create]
…
Followed Relationship
[miqaedb:/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template#create]
Followed Relationship [miqaedb:/cloud/VM/Lifecycle/Provisioning#create]
Extracting $evm.log Output
grep and awk are your friends:
grep "AEMethod test” automation.log | 
awk 'BEGIN {FS="AEMethod test>"}; {print $2}'
$evm & Service Model Refresher
$evm
$evm.log(:info, "my_method started")
vm_name = $evm.root['dialog_vm_name']
username = $evm.object['username']
password = $evm.object.decrypt('password')
$evm.set_state_var(:this_or_that, "the_other")
$evm
“Handle” into the Automation Engine
Attributes (e.g. $evm.current_instance, $evm.current_method)
Methods (e.g. $evm.log, $evm.vmdb, $evm.instantiate)
Workspace (e.g. $evm.root, $evm.parent, $evm.object)
Instance Object Hierarchy
/ManageIQ/System/Process/AUTOMATION ($evm.root)
| /ManageIQ/cloud/VM/Lifecycle/Provisioning
| | /ManageIQ/Cloud/VM/Provisioning/Profile/EvmGroup-super_administrator
| | /Bit63/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template ($evm.parent)
| | | /ManageIQ/Cloud/VM/Provisioning/StateMachines/Methods/CustomizeRequest
| | | /Bit63/Stuff/Methods/my_method ($evm.object)
The Sandpit
MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
Automation Engine
MiqAeMethodService::MiqAeService.new(MiqAeEngine::MiqAeWorkspaceRuntime.new)
Automate Method
$evm (DRb::DRbObject)
druby://127.0.0.1:54787
Service Model
Service Model
Service Model
Service Models
MiqAeServiceSomething
(Mostly) read-only abstractions of Active Records
• RHEV Virtual Machine (MiqAeServiceManageIQ_Providers_Redhat_InfraManager_Vm)
• User (MiqAeServiceUser)
• Provision Request (MiqAeServiceMiqProvisionRequest)
Retrievable using $evm.vmdb
Service Model Object Properties
Attributes (e.g. vm.name, vm.raw_power_state)
Virtual Columns (e.g. vm.cpu_total_cores, vm.ipaddresses)
Associations (e.g. vm.availability_zone, vm.ext_management_system)
Methods (e.g. vm.start, vm.stop)
Examining Objects
Rails Console
(https://github.com/georgegoh/cloudforms-util)
Demo
Inspecting Objects
InspectMe
Demo
Inspecting Objects
An Improved InspectMe
(https://github.com/ramrexx/CloudForms_Essentials)
Demo
Walking Objects
object_walker
(https://github.com/pemcg/object_walker)
Demo
Object Analysis Mid-Workflow – Scenario 1
How can I see what my provisioning dialog selection
looks like in the options hash?
Demo
Object Analysis Mid-Workflow – Scenario 2
What changes do the DialogParser and CatalogItemInitialization methods make to my
service_template_provision_task object?
Demo
Summary
• Use the logs to your advantage
• Understand the relationships between instances
• Understand what a Service Model is
• Use the Inspection tools

More Related Content

What's hot

What's hot (20)

Sprint 45 review
Sprint 45 reviewSprint 45 review
Sprint 45 review
 
Sprint 68
Sprint 68Sprint 68
Sprint 68
 
Sprint 44 review
Sprint 44 reviewSprint 44 review
Sprint 44 review
 
Sprint 40 review
Sprint 40 reviewSprint 40 review
Sprint 40 review
 
Sprint 39 review
Sprint 39 reviewSprint 39 review
Sprint 39 review
 
Sprint 16 report
Sprint 16 reportSprint 16 report
Sprint 16 report
 
Sprint 46 review
Sprint 46 reviewSprint 46 review
Sprint 46 review
 
Sprint 67
Sprint 67Sprint 67
Sprint 67
 
Sprint 49 review
Sprint 49 reviewSprint 49 review
Sprint 49 review
 
Sprint 48 review
Sprint 48 reviewSprint 48 review
Sprint 48 review
 
Sprint 47
Sprint 47Sprint 47
Sprint 47
 
Sprint 66
Sprint 66Sprint 66
Sprint 66
 
Sprint 77
Sprint 77Sprint 77
Sprint 77
 
Airflow and supervisor
Airflow and supervisorAirflow and supervisor
Airflow and supervisor
 
UI Improvements - Dan Clarizio, Eric Winchell - ManageIQ Design Summit 2016
UI Improvements - Dan Clarizio, Eric Winchell - ManageIQ Design Summit 2016UI Improvements - Dan Clarizio, Eric Winchell - ManageIQ Design Summit 2016
UI Improvements - Dan Clarizio, Eric Winchell - ManageIQ Design Summit 2016
 
Sprint 61
Sprint 61Sprint 61
Sprint 61
 
Sprint 62
Sprint 62Sprint 62
Sprint 62
 
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
Kubernetes Colorado - Kubernetes metrics deep dive 10/25/2017
 
Sprint 63
Sprint 63Sprint 63
Sprint 63
 
Sprint 74
Sprint 74Sprint 74
Sprint 74
 

Viewers also liked

Viewers also liked (9)

Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
Google Cloud Platform - Eric Johnson, Joe Selman - ManageIQ Design Summit 2016
 
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
Keynote - Oleg Barenboim - ManageIQ Design Summit 2016
 
Sprint 51 review
Sprint 51 reviewSprint 51 review
Sprint 51 review
 
Sprint 54
Sprint 54Sprint 54
Sprint 54
 
Self-Service UI - Hapreet Kataria, Erik Clarizio - ManageIQ Design Summit 2016
Self-Service UI - Hapreet Kataria, Erik Clarizio - ManageIQ Design Summit 2016Self-Service UI - Hapreet Kataria, Erik Clarizio - ManageIQ Design Summit 2016
Self-Service UI - Hapreet Kataria, Erik Clarizio - ManageIQ Design Summit 2016
 
Sprint 52
Sprint 52Sprint 52
Sprint 52
 
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
NFVO based on ManageIQ - OPNFV Summit 2016 DemoNFVO based on ManageIQ - OPNFV Summit 2016 Demo
NFVO based on ManageIQ - OPNFV Summit 2016 Demo
 
Sprint 55
Sprint 55Sprint 55
Sprint 55
 
Jay
JayJay
Jay
 

Similar to Investigative Debugging - Peter McGowan - ManageIQ Design Summit 2016

Report from the trenches: Using SOA Integrated Gateway
Report from the trenches: Using SOA Integrated GatewayReport from the trenches: Using SOA Integrated Gateway
Report from the trenches: Using SOA Integrated Gateway
Lonneke Dikmans
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
Valeriy Kravchuk
 

Similar to Investigative Debugging - Peter McGowan - ManageIQ Design Summit 2016 (20)

Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015Introducing Workflow Architectures Using Grails - Greach 2015
Introducing Workflow Architectures Using Grails - Greach 2015
 
Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1
 
Mysql Performance Schema - fossasia 2016
Mysql Performance Schema - fossasia 2016Mysql Performance Schema - fossasia 2016
Mysql Performance Schema - fossasia 2016
 
MySQL Performance Schema : fossasia
MySQL Performance Schema : fossasiaMySQL Performance Schema : fossasia
MySQL Performance Schema : fossasia
 
Docker on openstack by OpenSource Consulting
Docker on openstack by OpenSource ConsultingDocker on openstack by OpenSource Consulting
Docker on openstack by OpenSource Consulting
 
Debugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in LoggersDebugging Planning Issues Using Calcite's Built-in Loggers
Debugging Planning Issues Using Calcite's Built-in Loggers
 
Profiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production EnvironmentProfiling Mondrian MDX Requests in a Production Environment
Profiling Mondrian MDX Requests in a Production Environment
 
Report from the trenches: Using SOA Integrated Gateway
Report from the trenches: Using SOA Integrated GatewayReport from the trenches: Using SOA Integrated Gateway
Report from the trenches: Using SOA Integrated Gateway
 
Welcome Webinar Slides
Welcome Webinar SlidesWelcome Webinar Slides
Welcome Webinar Slides
 
Puppet Performance Profiling
Puppet Performance ProfilingPuppet Performance Profiling
Puppet Performance Profiling
 
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRsMySQL-Performance Schema- What's new in MySQL-5.7 DMRs
MySQL-Performance Schema- What's new in MySQL-5.7 DMRs
 
Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013Performance schema in_my_sql_5.6_pluk2013
Performance schema in_my_sql_5.6_pluk2013
 
Vertica trace
Vertica traceVertica trace
Vertica trace
 
practical9.pptx
practical9.pptxpractical9.pptx
practical9.pptx
 
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 TroubleshootingAzure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
Azure AD B2C Webinar Series: Custom Policies Part 3 Troubleshooting
 
Monitor your Java application with Prometheus Stack
Monitor your Java application with Prometheus StackMonitor your Java application with Prometheus Stack
Monitor your Java application with Prometheus Stack
 
Using TICK Stack For System and App Metrics
Using TICK Stack For System and App MetricsUsing TICK Stack For System and App Metrics
Using TICK Stack For System and App Metrics
 
Performance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, HowPerformance Instrumentation for PL/SQL: When, Why, How
Performance Instrumentation for PL/SQL: When, Why, How
 
"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementation"Taster Slides" for Most advanced GTM implementation
"Taster Slides" for Most advanced GTM implementation
 
Testing APEX apps At A Glance
Testing APEX apps At A GlanceTesting APEX apps At A Glance
Testing APEX apps At A Glance
 

More from ManageIQ

More from ManageIQ (20)

ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
ManageIQ - Sprint 235 Review - Slide Deck
ManageIQ - Sprint 235 Review - Slide DeckManageIQ - Sprint 235 Review - Slide Deck
ManageIQ - Sprint 235 Review - Slide Deck
 
ManageIQ - Sprint 234 Review - Slide Deck
ManageIQ - Sprint 234 Review - Slide DeckManageIQ - Sprint 234 Review - Slide Deck
ManageIQ - Sprint 234 Review - Slide Deck
 
ManageIQ - Sprint 233 Review - Slide Deck
ManageIQ - Sprint 233 Review - Slide DeckManageIQ - Sprint 233 Review - Slide Deck
ManageIQ - Sprint 233 Review - Slide Deck
 
ManageIQ - Sprint 232 Review - Slide Deck
ManageIQ - Sprint 232 Review - Slide DeckManageIQ - Sprint 232 Review - Slide Deck
ManageIQ - Sprint 232 Review - Slide Deck
 
ManageIQ - Sprint 231 Review - Slide Deck
ManageIQ - Sprint 231 Review - Slide DeckManageIQ - Sprint 231 Review - Slide Deck
ManageIQ - Sprint 231 Review - Slide Deck
 
ManageIQ - Sprint 230 Review - Slide Deck
ManageIQ - Sprint 230 Review - Slide DeckManageIQ - Sprint 230 Review - Slide Deck
ManageIQ - Sprint 230 Review - Slide Deck
 
ManageIQ - Sprint 229 Review - Slide Deck
ManageIQ - Sprint 229 Review - Slide DeckManageIQ - Sprint 229 Review - Slide Deck
ManageIQ - Sprint 229 Review - Slide Deck
 
ManageIQ - Sprint 228 Review - Slide Deck
ManageIQ - Sprint 228 Review - Slide DeckManageIQ - Sprint 228 Review - Slide Deck
ManageIQ - Sprint 228 Review - Slide Deck
 
Sprint 227
Sprint 227Sprint 227
Sprint 227
 
Sprint 226
Sprint 226Sprint 226
Sprint 226
 
Sprint 225
Sprint 225Sprint 225
Sprint 225
 
Sprint 224
Sprint 224Sprint 224
Sprint 224
 
Sprint 223
Sprint 223Sprint 223
Sprint 223
 
Sprint 222
Sprint 222Sprint 222
Sprint 222
 
Sprint 221
Sprint 221Sprint 221
Sprint 221
 
Sprint 220
Sprint 220Sprint 220
Sprint 220
 
Sprint 219
Sprint 219Sprint 219
Sprint 219
 
Sprint 218
Sprint 218Sprint 218
Sprint 218
 
Sprint 217
Sprint 217Sprint 217
Sprint 217
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Investigative Debugging - Peter McGowan - ManageIQ Design Summit 2016

  • 1. Investigative Debugging of ManageIQ Automation Peter McGowan
  • 2. (An Automation Scripter’s Guide to Overcoming Frustrations)
  • 3. Agenda • Making sense of the log files • $evm & Service Model refresher • Examining objects • Inspecting objects • Walking objects • Object analysis mid-workflow
  • 4. Takeaways How to use the logs effectively Understand when to use $evm.root or $evm.object Understand how to examine Service Model objects Understand how to inspect/debug objects mid-workflow
  • 6. Log Files [----] I, [2016-05-23T11:34:08.351374 #3880:51197c] INFO -- : MIQ(MiqQueue.put) Message id: [2679], id: [], Zone: [default], Role: [smartstate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [job_dispatcher], Command: [JobProxyDispatcher.dispatch], Timeout: [600], Priority: [20], State: [ready], Deliver On: [], Data: [], Args: [] [----] I, [2016-05-23T11:34:09.144251 #3655:51197c] INFO -- : MIQ(MiqServer#populate_queue_messages) Fetched 2 miq_queue rows for queue_name=generic, wcount=4, priority=200 [----] I, [2016-05-23T11:34:09.754587 #3857:51197c] INFO -- : MIQ(MiqPriorityWorker::Runner#get_message_via_drb) Message id: [2679], MiqWorker id: [4], Zone: [default], Role: [smartstate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [job_dispatcher], Command: [JobProxyDispatcher.dispatch], Timeout: [600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [], Dequeued in: [1.404928107] seconds
  • 7. Log Files # rake evm:status Checking EVM status... Zone | Server Name | Status | ID | PID | SPID | URL | Started On | ... default | EVM | started | 1 | 3655 | 3685 | druby://127.0.0.1:60715 | 2016-05-23T05:58:07Z | ... Worker Type | Status | ID | PID | SPID | Queue Name / URL --------------------------------------------------------------+---------+----+-------+- ------+----------------------- ManageIQ::Providers::Openstack::CloudManager::EventCatcher | started | 16 | 4760 | 4764 | ems_1 | ManageIQ::Providers::Openstack::CloudManager::RefreshWorker | started | 20 | 34230 | 34234 | ems_1 | ManageIQ::Providers::Openstack::NetworkManager::EventCatcher | started | 17 | 4767 | 4771 | ems_2 | ManageIQ::Providers::Openstack::NetworkManager::RefreshWorker | started | 21 | 34235 | 34239 | ems_2 | MiqEventHandler | started | 1 | 3841 | 3845 | ems | MiqGenericWorker | started | 3 | 3851 | 3855 | generic | MiqGenericWorker | started | 2 | 3846 | 3850 | generic | MiqPriorityWorker | started | 4 | 3857 | 3861 | generic | MiqPriorityWorker | started | 5 | 3863 | 3868 | generic | MiqReportingWorker | started | 7 | 3874 | 3878 | reporting | MiqReportingWorker | started | 6 | 3869 | 3873 | reporting | MiqScheduleWorker | started | 8 | 3880 | 3885 | | MiqUiWorker | started | 10 | 3904 | | http://127.0.0.1:3000 | MiqWebServiceWorker | started | 11 | 3928 | | http://127.0.0.1:4000 | MiqWebsocketWorker | started | 9 | 3892 | | http://127.0.0.1:5000 |
  • 8. Log Files grep -i "3846:|3851:|3857:|3863:" log/evm.log [----] I, [2016-05-23T11:52:15.090823 #3846:51197c] INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [2845], MiqWorker id: [2], Zone: [default], Role: [automate], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqAeEngine.deliver], Timeout: [3600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [{:object_type=>"AutomationRequest", :object_id=>11, :attrs=>{:event_type=>"request_created", "EventStream::event_stream"=>100, :event_stream_id=>100}, :instance_name=>"Event", :user_id=>1, :miq_group_id=>2, :tenant_id=>1, :automate_message=>nil}], Dequeued in: [3.039205536] seconds [----] I, [2016-05-23T11:52:16.166956 #3851:51197c] INFO -- : Q-task_id([automation_task_11]) <AutomationEngine> Invoking [inline] method [/Bit63/Stuff/Methods/test] with inputs [{}] [----] I, [2016-05-23T11:52:16.167584 #3851:51197c] INFO -- : Q-task_id([automation_task_11]) <AutomationEngine> <AEMethod [/Bit63/Stuff/Methods/test]> Starting [----] I, [2016-05-23T11:52:16.241517 #3846:b1083c] INFO -- : <AutomationEngine> <AEMethod parse_provider_category> Parse Provider Category Key: nil Value: unknown [----] I, [2016-05-23T11:52:16.290814 #3846:51197c] INFO -- : <AutomationEngine> <AEMethod /ManageIQ/System/Process/parse_provider_category]> Ending [----] I, [2016-05-23T11:52:16.290992 #3846:51197c] INFO -- : <AutomationEngine> Method exited with rc=MIQ_OK
  • 9. Use Following…Followed Following Relationship [miqaedb:/cloud/VM/Lifecycle/Provisioning#create] Following Relationship [miqaedb:/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template#create] … Followed Relationship [miqaedb:/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template#create] Followed Relationship [miqaedb:/cloud/VM/Lifecycle/Provisioning#create]
  • 10. Extracting $evm.log Output grep and awk are your friends: grep "AEMethod test” automation.log | awk 'BEGIN {FS="AEMethod test>"}; {print $2}'
  • 11. $evm & Service Model Refresher
  • 12. $evm $evm.log(:info, "my_method started") vm_name = $evm.root['dialog_vm_name'] username = $evm.object['username'] password = $evm.object.decrypt('password') $evm.set_state_var(:this_or_that, "the_other")
  • 13. $evm “Handle” into the Automation Engine Attributes (e.g. $evm.current_instance, $evm.current_method) Methods (e.g. $evm.log, $evm.vmdb, $evm.instantiate) Workspace (e.g. $evm.root, $evm.parent, $evm.object)
  • 14. Instance Object Hierarchy /ManageIQ/System/Process/AUTOMATION ($evm.root) | /ManageIQ/cloud/VM/Lifecycle/Provisioning | | /ManageIQ/Cloud/VM/Provisioning/Profile/EvmGroup-super_administrator | | /Bit63/Cloud/VM/Provisioning/StateMachines/VMProvision_vm/template ($evm.parent) | | | /ManageIQ/Cloud/VM/Provisioning/StateMachines/Methods/CustomizeRequest | | | /Bit63/Stuff/Methods/my_method ($evm.object)
  • 16. Service Models MiqAeServiceSomething (Mostly) read-only abstractions of Active Records • RHEV Virtual Machine (MiqAeServiceManageIQ_Providers_Redhat_InfraManager_Vm) • User (MiqAeServiceUser) • Provision Request (MiqAeServiceMiqProvisionRequest) Retrievable using $evm.vmdb
  • 17. Service Model Object Properties Attributes (e.g. vm.name, vm.raw_power_state) Virtual Columns (e.g. vm.cpu_total_cores, vm.ipaddresses) Associations (e.g. vm.availability_zone, vm.ext_management_system) Methods (e.g. vm.start, vm.stop)
  • 20. Inspecting Objects An Improved InspectMe (https://github.com/ramrexx/CloudForms_Essentials) Demo
  • 22. Object Analysis Mid-Workflow – Scenario 1 How can I see what my provisioning dialog selection looks like in the options hash? Demo
  • 23. Object Analysis Mid-Workflow – Scenario 2 What changes do the DialogParser and CatalogItemInitialization methods make to my service_template_provision_task object? Demo
  • 24. Summary • Use the logs to your advantage • Understand the relationships between instances • Understand what a Service Model is • Use the Inspection tools