SlideShare a Scribd company logo
1 of 16
Pipe your script to Slack
Chuck Kato - Course Hero
Quick Introduction
Chuck Kato
Engineering Manager at Course Hero
Mid-size EdTech startup
(100+ employees)
Using Slack from Aug. 2014
Custom Slack Integration ‘slacktee’
Bash script which works like the 'tee' command.
You can integrate any scripts/commands with Slack without any development.
‘tee’ command ‘slacktee’ command
Why we created ‘slacktee’
Two reasons:
1. Wanted to see the result of backend tasks on Slack, because we love Slack
2. Most of the tasks are small or one-time, so we didn’t want to spend time to
implement a Slack integration for each task
Real life use cases
Use Case 1 : Notify errors
Sometimes our database replication is backed up due to long-running queries
from our analytics team.
To detect it, we wrote a tiny script to monitor the replication status.
> php replication_checker.php prod_dbbi
prod_dbbi is 4999 seconds behind Master
>
Use Case 1 : Notify errors (Continue)
Before ‘slacktee’, we sent a notification through email
Problem:
Difficult to notice
php replication_checker.php prod_dbbi | mail -s ‘dbbi replication’ ckato@coursehero.com
Use Case 1 : Notify errors (Continue)
With ‘slacktee’, we can send a notification on Slack
php replication_checker.php prod_dbbi |
slacktee.sh -a "danger" -c "devops" -u "dbbi replication" -i "siren"
Problem solved!
- Easy to notice
- Custom notification setting allows us to send the notification to mobile
Attachment with ‘danger’ color
Send to #devops channel
Use this username for posting
Use :siren: emoji for icon
Use Case 2 : Check the progress of a long running script
One day, we executed a script which fixed missing data in the database. Since
the script processed a lot of documents, it took almost a day to finish.
We executed the script in the background using the 'screen' command, but we
needed to check its progress periodically and monitor for errors.
> php 2016_02_10_update_cfw_doc_pages.php
Script starts at 2016-03-02 12:50:44
There are 53014 missing records that need to be updated
0 records updated
1000 records updated
2000 records updated
3000 records updated
4000 records updated
5000 records updated
Takes 20 - 30 mins
Use Case 2 : Check the progress of a long running script (Continue)
Before ‘slacktee’, we had to login to the server and attach the screen each time
Problem :
- VPN into the server and attaching the screen for checking are tedious
- Impossible to notice errors immediately
Use Case 2 : Check the progress of a long running script (Continue)
With ‘slacktee’, we can see the progress on Slack
Problem solved!
- No server login required
- Real time monitoring
php 2016_02_10_update_cfw_doc_pages.php 2>&1 |
slacktee.sh -u "2016_02_10_update_cfw_doc_pages.php" -n
Use this username for posting No buffering mode
Use Case 3 : Download the result from the server
To investigate permission issues, we executed a 'find' command on our NFS
server and listed the files which have the wrong owner.
Since many millions of files are stored in our NFS, the output of the command
was huge, and we needed to download it to our local PC to check it.
> find . -type f ! -user apache | tee ~/result.txt
./00005063699b18d149beced28b35a7ad70bde9a9.txt
./00003e3f0345bd63cbcdb502b08cb77722112dbd.txt
./0000a7d5cb15b4188232633e798f638df2c33e07-1.txt
./000088e3ca537bef76df9c8d3aea9cb045e65f46.txt
./0000cc6fd2248580cde4a3f4e1ed306812e17b4c-2.txt
./000016f7c58a8802cbbb07a9033b0da41660d4b4.txt
./000088e3ca537bef76df9c8d3aea9cb045e65f46-0.txt
./00006329498e0bb6b4d49019b84d6fd3cf5d9cdb-0.txt
./0000e1cbc26144fcf8d44ba6eb4881affd447a2f-2.txt
About 100 MB
Use Case 3 : Download the result from the server (Continue)
Before ‘slacktee’, we had to use ‘scp’ to download the file from the server
Problem :
- Using ‘scp’ is not a pleasant experience (maybe only for me)
- Sharing results with colleagues is not easy
Use Case 3 : Download the result from the server (Continue)
With ‘slacktee’, we can download it from Slack
find . -type f ! -user apache | slacktee.sh -u 'Wrong owner check' -f
Use this username for posting File upload mode
Problem solved!
- No ‘scp’ required
- Easy to share
* Since Incoming Webhook doesn’t
support file upload, ‘slacktee’ uses
the user’s token for uploading.
Conclusion
Slack integration and ‘slacktee’ have really helped us.
1. More information is available on Slack
2. Non-technical people can get insight from the results too
If you have a script, pipe it to Slack now!
1. Google ‘slacktee’
Easiest way to find ‘slacktee’
2. Click 1st link in the result
Thank you!
Slacktee
https://github.com/course-hero/slacktee
* Star it, if you like it ;)
Chuck Kato
Slack : @ckato on dev4slack.slack.com
Email : ckato@coursehero.com

More Related Content

What's hot

Google App Engine: For PHP Developers
Google App Engine: For PHP DevelopersGoogle App Engine: For PHP Developers
Google App Engine: For PHP DevelopersAbu Ashraf Masnun
 
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014Puppet
 
Salt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannonSalt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannonWilliam Cannon
 
Puppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and PuppetPuppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and PuppetMarc Cluet
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the PipelinePuppet
 
Getting Started with Capistrano
Getting Started with CapistranoGetting Started with Capistrano
Getting Started with CapistranoLaunchAny
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the thingsJohn Cleary
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014Puppet
 
Async programming: From 0 to task.IsComplete - es
Async programming: From 0 to task.IsComplete - esAsync programming: From 0 to task.IsComplete - es
Async programming: From 0 to task.IsComplete - esDarío Kondratiuk
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecDaniel Paulus
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCLFastly
 
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with PerlPerrin Harkins
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltStack
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Fastly
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a ManifestPuppet
 

What's hot (20)

Google App Engine: For PHP Developers
Google App Engine: For PHP DevelopersGoogle App Engine: For PHP Developers
Google App Engine: For PHP Developers
 
Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
 
NATE-CHEF
NATE-CHEFNATE-CHEF
NATE-CHEF
 
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
 
Salt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannonSalt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannon
 
Puppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and PuppetPuppet Camp London Fall 2015 - Service Discovery and Puppet
Puppet Camp London Fall 2015 - Service Discovery and Puppet
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the Pipeline
 
Getting Started with Capistrano
Getting Started with CapistranoGetting Started with Capistrano
Getting Started with Capistrano
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the things
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014
 
Async programming: From 0 to task.IsComplete - es
Async programming: From 0 to task.IsComplete - esAsync programming: From 0 to task.IsComplete - es
Async programming: From 0 to task.IsComplete - es
 
Gopcpro
GopcproGopcpro
Gopcpro
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
 
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with Perl
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
TCPIP Networks for DBAs
TCPIP Networks for DBAsTCPIP Networks for DBAs
TCPIP Networks for DBAs
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a Manifest
 

Similar to Pipe your script to slack

Badge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyBadge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyFabio Cicerchia
 
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB
 
Extending Piwik At R7.com
Extending Piwik At R7.comExtending Piwik At R7.com
Extending Piwik At R7.comLeo Lorieri
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindSam Keen
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesNicholas Dionysopoulos
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2Merixstudio
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii ShumadaFwdays
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon praguehernanibf
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStormShu Sugimoto
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)WordCamp Cape Town
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPDemin Yin
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web SitesRavi Raj
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet
 
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...Nagios
 
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupSaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupJon Henry
 
Automating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellAutomating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellEnclaveSecurity
 

Similar to Pipe your script to slack (20)

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
 
Badge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps JourneyBadge Poser v3.0 - A DevOps Journey
Badge Poser v3.0 - A DevOps Journey
 
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
MongoDB World 2019: Becoming an Ops Manager Backup Superhero!
 
Extending Piwik At R7.com
Extending Piwik At R7.comExtending Piwik At R7.com
Extending Piwik At R7.com
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sites
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Fix me if you can - DrupalCon prague
Fix me if you can - DrupalCon pragueFix me if you can - DrupalCon prague
Fix me if you can - DrupalCon prague
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStorm
 
Os Whitaker
Os WhitakerOs Whitaker
Os Whitaker
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
Massively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHPMassively Scaled High Performance Web Services with PHP
Massively Scaled High Performance Web Services with PHP
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web Sites
 
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
Puppet Camp NYC 2014: Build a Modern Infrastructure in 45 min!
 
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
Nagios Conference 2011 - Nate Broderick - Nagios XI Large Implementation Tips...
 
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack MeetupSaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
SaltStack's NetAPI at Photobucket - Denver SaltStack Meetup
 
CV_RishabhDixit
CV_RishabhDixitCV_RishabhDixit
CV_RishabhDixit
 
Automating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellAutomating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShell
 

Recently uploaded

What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 

Recently uploaded (20)

What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 

Pipe your script to slack

  • 1. Pipe your script to Slack Chuck Kato - Course Hero
  • 2. Quick Introduction Chuck Kato Engineering Manager at Course Hero Mid-size EdTech startup (100+ employees) Using Slack from Aug. 2014
  • 3. Custom Slack Integration ‘slacktee’ Bash script which works like the 'tee' command. You can integrate any scripts/commands with Slack without any development. ‘tee’ command ‘slacktee’ command
  • 4. Why we created ‘slacktee’ Two reasons: 1. Wanted to see the result of backend tasks on Slack, because we love Slack 2. Most of the tasks are small or one-time, so we didn’t want to spend time to implement a Slack integration for each task
  • 6. Use Case 1 : Notify errors Sometimes our database replication is backed up due to long-running queries from our analytics team. To detect it, we wrote a tiny script to monitor the replication status. > php replication_checker.php prod_dbbi prod_dbbi is 4999 seconds behind Master >
  • 7. Use Case 1 : Notify errors (Continue) Before ‘slacktee’, we sent a notification through email Problem: Difficult to notice php replication_checker.php prod_dbbi | mail -s ‘dbbi replication’ ckato@coursehero.com
  • 8. Use Case 1 : Notify errors (Continue) With ‘slacktee’, we can send a notification on Slack php replication_checker.php prod_dbbi | slacktee.sh -a "danger" -c "devops" -u "dbbi replication" -i "siren" Problem solved! - Easy to notice - Custom notification setting allows us to send the notification to mobile Attachment with ‘danger’ color Send to #devops channel Use this username for posting Use :siren: emoji for icon
  • 9. Use Case 2 : Check the progress of a long running script One day, we executed a script which fixed missing data in the database. Since the script processed a lot of documents, it took almost a day to finish. We executed the script in the background using the 'screen' command, but we needed to check its progress periodically and monitor for errors. > php 2016_02_10_update_cfw_doc_pages.php Script starts at 2016-03-02 12:50:44 There are 53014 missing records that need to be updated 0 records updated 1000 records updated 2000 records updated 3000 records updated 4000 records updated 5000 records updated Takes 20 - 30 mins
  • 10. Use Case 2 : Check the progress of a long running script (Continue) Before ‘slacktee’, we had to login to the server and attach the screen each time Problem : - VPN into the server and attaching the screen for checking are tedious - Impossible to notice errors immediately
  • 11. Use Case 2 : Check the progress of a long running script (Continue) With ‘slacktee’, we can see the progress on Slack Problem solved! - No server login required - Real time monitoring php 2016_02_10_update_cfw_doc_pages.php 2>&1 | slacktee.sh -u "2016_02_10_update_cfw_doc_pages.php" -n Use this username for posting No buffering mode
  • 12. Use Case 3 : Download the result from the server To investigate permission issues, we executed a 'find' command on our NFS server and listed the files which have the wrong owner. Since many millions of files are stored in our NFS, the output of the command was huge, and we needed to download it to our local PC to check it. > find . -type f ! -user apache | tee ~/result.txt ./00005063699b18d149beced28b35a7ad70bde9a9.txt ./00003e3f0345bd63cbcdb502b08cb77722112dbd.txt ./0000a7d5cb15b4188232633e798f638df2c33e07-1.txt ./000088e3ca537bef76df9c8d3aea9cb045e65f46.txt ./0000cc6fd2248580cde4a3f4e1ed306812e17b4c-2.txt ./000016f7c58a8802cbbb07a9033b0da41660d4b4.txt ./000088e3ca537bef76df9c8d3aea9cb045e65f46-0.txt ./00006329498e0bb6b4d49019b84d6fd3cf5d9cdb-0.txt ./0000e1cbc26144fcf8d44ba6eb4881affd447a2f-2.txt About 100 MB
  • 13. Use Case 3 : Download the result from the server (Continue) Before ‘slacktee’, we had to use ‘scp’ to download the file from the server Problem : - Using ‘scp’ is not a pleasant experience (maybe only for me) - Sharing results with colleagues is not easy
  • 14. Use Case 3 : Download the result from the server (Continue) With ‘slacktee’, we can download it from Slack find . -type f ! -user apache | slacktee.sh -u 'Wrong owner check' -f Use this username for posting File upload mode Problem solved! - No ‘scp’ required - Easy to share * Since Incoming Webhook doesn’t support file upload, ‘slacktee’ uses the user’s token for uploading.
  • 15. Conclusion Slack integration and ‘slacktee’ have really helped us. 1. More information is available on Slack 2. Non-technical people can get insight from the results too If you have a script, pipe it to Slack now! 1. Google ‘slacktee’ Easiest way to find ‘slacktee’ 2. Click 1st link in the result
  • 16. Thank you! Slacktee https://github.com/course-hero/slacktee * Star it, if you like it ;) Chuck Kato Slack : @ckato on dev4slack.slack.com Email : ckato@coursehero.com

Editor's Notes

  1. Today’s my talk is ‘Pipe your script to Slack’.
  2. (15 - 30 sec) Before talking about what it means, let me introduce myself and my company ‘Course Hero’ briefly. I’m Chuck Kato. Engineering Manager at Course Hero. Course Hero is a mid size EdTech start-up company. We are providing cloud sources materials and online tutoring platform. We started using Slack from Aug. 2014 in the engineering team and then it became our core communication tool quickly.
  3. (30 sec - 1 min) Today, I’m introducing our open source custom slack integration ‘slacktee’. ‘slacktee’ is a bash script which works like the 'tee' command. As you may know, the 'tee' command reads standard input and writes it to standard output and one or more files. Instead of writing to files, 'slacktee' posts the input to a Slack channel. So, basically, you can pipe any scripts/commands to Slack without any additional development! [Show very quick demo] > echo “Hello everyone!” | slacktee.sh > ls -l | slacktee.sh Easy, isn’t it?
  4. (30 sec) At Course Hero, we execute a bunch of scripts and commands every day to accomplish backend tasks. Since Slack is our core communication tool, we wanted to see the result of tasks on Slack. However, even though implementing a custom Slack integration is easy, most of the backend tasks were small or one time, so we couldn't justify the development cost. For these two reasons, we created 'slacktee'. If you have the same dilemma, ‘slacktee’ should work for you too.
  5. (5 - 10 sec) Actually, 'slacktee' changed the way we monitor backend tasks. I'd like to show you 3 real life use cases today.
  6. (30 sec) First use case is an error notification. We are maintaining multiple replication slave databases, but sometimes they are backed up due to long-running queries from our analytics team. To detect the backup, we wrote a tiny script to monitor the replication status. Here is the example of the output.
  7. (30 sec) To send a backup notification to engineering team, we used to use an email. However, as you can see, it’s difficult to notice and often we overlooked it. Also, personally, I don’t check inbox frequently, so I cannot notice it in a timely manner. But, ‘slacktee’ solved this problem.
  8. (30 sec) With ‘slacktee’, we can send the notification on Slack. Here is the command and example of the notification. To make the notification prominent, we added a few options, but, basically, we just piped ‘slacktee’ instead of ‘mail’ command. As you can see, it stands out and it’s difficult to overlook. Also, the notification is sent to mobile too, if we set up custom notification.
  9. (30 sec) Let’s move to 2nd use case. One day, we executed a script which fixed missing data in the database. But, the script was slow and took almost a day to finish. So, we executed the script in the background using the ‘screen’ command, but we needed to check its progress periodically and monitor for errors.
  10. (30 sec) Before ‘slacktee’, we had to login to the server and attached the screen each time when we checked the progress. To access server, we had to establish VPN session with 2-way authentication. This monitoring process was really tedious and not mobile friendly. Also, it was impossible to notice errors immediately, because there was no way to see the errors until we access to the server. Actually, ‘slacktee’ solved these problems.
  11. (30 sec) With ‘no buffering’ option, we can send the input to Slack line by line. So, we can see the progress on Slack in real time without logging into the server. Since we are redirecting the standard error to the standard input here, we can also notice errors immediately. This was amazing improvement for us.
  12. (30 sec) This is the last use case I’m explaining today. To fix permission issues, we recently executed a ‘find’ command on our NFS server and listed the files which have the wrong owner. Since many mllions of files are stored in our NFS, the output of the command was huge, and we needed to download it to our local PC to check it.
  13. (30 sec) Before ‘slacktee’, we needed to ‘scp’ the file from the server. But, frankly speaking, using ‘scp’ is not a pleasant experience. We cannot use path auto completion, so we have to remember the file path of the target file correctly. Also, if the file has been created by different user, we have to change the permission on the server side first. ‘scp’ is a necessary tool, but I’m not a big fan of it. And, after we downloaded it, we needed to share it with other members. So we had to email or uploaded it to other place such as Slack. Yeah, Slack.
  14. (30 sec) Actually, these problems could be solved with ‘slacktee’. By using slacktee’s file upload mode, we can upload the result to Slack directly. Now, we don’t have to use ‘scp’ to download the result file from the server. Just click the download link on Slack. Also, if you’d like to share it with your colleagues, simply share the link or post itself with them! BTW, slacktee is using Incoming Webhook to post the message to Slack, but it doesn’t support file upload. So, in the file upload mode’, slacktee uses the user’s token for uploading.
  15. (30 sec) Slack integration and ‘slacktee’ have really helped us. After creating ‘slacktee’, more information is available on Slack and it makes our daily job much easier. Also, non-technical people can get insight from the results. Sometimes, they point out issues, sometimes, they get an inspiration about new ideas from the information. This was a positive surprise for engineers. I believe these things will happen in your team too. So, if you have a script, pipe it to Slack now.
  16. (5 sec) Thank you. Any questions?