SlideShare a Scribd company logo
1 of 16
Rubyによる(力技)でのネットワーク運用 u-ichi twitter: u1 mail: yuichi.u@gmail.com
自己紹介 名前 u-ichi/u1 植村優一 twitter http://twitter.com/u1 所属 NTTコミュニケーションズ 今年7月まで大規模ネットワーク(非OCN)の運用を5年やってました。 7月からホスティングサービスを提供する側へ異動・・・ 今回はネットワーク運用の現場でRuby使って闘ってきた時に大事だと感じた点を共有します。
なぜRubyでネットワーク運用なのか?
ネットワークを監視しようとした場合・・・ ネットワーク監視だけなら汎用製品使う場合が多いです Hinemos,ZABBIX,JP1,NNM,Tiboli,Cm2,BMC,WebNMS,etc… 装置の死活監視したり、リソース見たり でも監視以上の事はあまり得意ではありません ×外部の死活監視の仕組みと連携して自動切替をさせたりとか ×帯域の空きが無くなってきたら、空いてるところにトラフィックを自動で逃がすとか
ネットワーク装置単体の運用ではなく、 1つのシステムとして運用をするためには 運用システムの作り込みが必要 もう一つのアプローチとして、システムにあわせる形で ネットワークを作り上げるというのもあるけど、今回は割愛
でも最初からどう使うのかを全て想定して 運用システムを作り込むのって難しい 特にネットワークをサービスとして提供する立場だと、 ユーザ数の増加/ユーザ要望の変化によって ネットワーク構成/要件が変化するのはよくあること 変化を受け入れる事が重要
変化を受け入れられる力が欲しい
 そこでruby!
ネットワーク運用(主に保守側)に欲しい事 通常時 ログ監視(swatch等) 装置の定期的な正常性確認(ping,snmpwalk等) 故障/トラブル発生時 装置状態/ログの取得 取得した情報の解析 装置の操作(復旧作業) etc… ←本LTでのカバー範囲
装置状態を取得するには 情報取得の方法 snmpget,snmpwalk,snmpbulkwalk telnet/ssh 取得する上で大変な点 装置台数は数百台以上、時には数千台 でも1台の取得だけで1分以上かかる時も 処理プロセスのマルチスレッド化は必須!
装置をコントロールするには 基本的にコントロールはtelnet/ssh経由でコマンドで実施 装置種別/OS毎にclassライブラリを作成 よく使う命令はテストを十分に施してメソッド化 router = Cisco.login(“rubykaigi01_router”) router.interface(“Gi0/1”).shutdown 装置のコントロールは検証がとれた メソッドを組み合わていく形で実施する
例として、rxカウンタが0なインタフェースを全てshutdownさせてみる routers = [Cisco.login(“rubykaigi01_router”),            Cisco.login(“rubykaigi02_router”)] threads = Array.new routers.each do |router|   threads << Thread.new do router.get_interfaces_counter     router.interfaces.each do |interface|       if interface.rx_counter == 0 interface.shutdown       end     end   end end threads.each do |thread|   thread.join end 各装置毎に平行して処理を実施 ルータのインタフェースとトラフィック値を取得するメソッド 該当カウンタ値が0ならば、インタフェースをシャットダウンさせる スレッドの処理終了待ち・・・
作ったシステムのテストは凄く重要 でも・・・ 他装置との試験は時間がかかるし、準備も大変 装置のOSが新しくなる度に再試験が必要 そもそも柔軟な対応を現場でやりたいからシステムを内製してる 必要なのは・・・ 「テストを管理/自動化出来る仕組み」 「単体テストが可能な設計」
テストを管理/自動化出来る仕組み ,[object Object]
ラボでの試験もrspecで記述
日本語でケース書けるので後から凄く見やすいdescribe "xxx構成の場合" do   before(:each) do # ラボのネットワーク構成を作成するスクリプトを書く end   describe “100回繰り返して負荷試験を実施する場合" do     before(:all) do # 繰り返し処理をする内容を書く。ネットワークの切替とか。 end     it "装置状態が正常な事" do # 実際はもっと細かい精度で。(トラフィックカウンタとか)     end   end end

More Related Content

Recently uploaded

Recently uploaded (12)

新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

RubyKaigi2009 u-ichi - Rubyによる(力技での)ネットワーク運用