SlideShare a Scribd company logo
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 Developers
Abu Ashraf Masnun
 
Capistrano 3 Deployment
Capistrano 3 DeploymentCapistrano 3 Deployment
Capistrano 3 Deployment
Creston Jamison
 
NATE-CHEF
NATE-CHEFNATE-CHEF
NATE-CHEF
Stefan Coetzee
 
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
Puppet
 
Salt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannonSalt conf15 presentation-william-cannon
Salt conf15 presentation-william-cannon
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
Marc Cluet
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the Pipeline
Puppet
 
Getting Started with Capistrano
Getting Started with CapistranoGetting Started with Capistrano
Getting Started with Capistrano
LaunchAny
 
Capistrano - automate all the things
Capistrano - automate all the thingsCapistrano - automate all the things
Capistrano - automate all the things
John 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 2014
Puppet
 
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
Darío Kondratiuk
 
Gopcpro
GopcproGopcpro
Gopcpro
web expert
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and Serverrspec
Daniel Paulus
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
 
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
Fastly
 
Building Scalable Websites with Perl
Building Scalable Websites with PerlBuilding Scalable Websites with Perl
Building Scalable Websites with Perl
Perrin 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 Environments
SaltStack
 
TCPIP Networks for DBAs
TCPIP Networks for DBAsTCPIP Networks for DBAs
TCPIP Networks for DBAs
Gwen (Chen) Shapira
 
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
Fastly
 
So I Wrote a Manifest
So I Wrote a ManifestSo I Wrote a Manifest
So I Wrote a Manifest
Puppet
 

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

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
CloudStack - Open Source Cloud Computing Project
 
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
Fabio 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.com
Leo Lorieri
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam 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! sites
Nicholas Dionysopoulos
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
Merixstudio
 
"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
Fwdays
 
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
hernanibf
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStorm
Shu Sugimoto
 
Os Whitaker
Os WhitakerOs Whitaker
Os Whitaker
oscon2007
 
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 PHP
Demin Yin
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web Sites
Ravi 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 Meetup
Jon Henry
 
CV_RishabhDixit
CV_RishabhDixitCV_RishabhDixit
CV_RishabhDixit
Rishabh Dixit
 
Automating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShellAutomating Post Exploitation with PowerShell
Automating Post Exploitation with PowerShell
EnclaveSecurity
 

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

Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
Mahmoud Morsy
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
riddhimaagrawal986
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 

Recently uploaded (20)

Certificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi AhmedCertificates - Mahmoud Mohamed Moursi Ahmed
Certificates - Mahmoud Mohamed Moursi Ahmed
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
People as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimalaPeople as resource Grade IX.pdf minimala
People as resource Grade IX.pdf minimala
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 

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?