Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ZabbixAPIをつんつんした
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
2bo
June 03, 2021
Programming
0
470
ZabbixAPIをつんつんした
OSC Nagoya 2021
Pyhton東海/JuliaTokai 合同ミニ勉強会
発表資料
2bo
June 03, 2021
Tweet
Share
More Decks by 2bo
See All by 2bo
おっきなガジェットの回線事情
2bo
1
200
おたく監視してみた
2bo
0
87
巨大ガジェット買ってみた
2bo
0
680
PyScriptの話
2bo
0
310
名古屋とお菓子🍪
2bo
0
470
名古屋 勉強会 会場 選定 2019
2bo
2
200
お城Pythonの作り方/OshiroPython
2bo
1
690
Python勉強法
2bo
0
880
Python 環境構築方法 2016
2bo
2
1.8k
Other Decks in Programming
See All in Programming
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
130
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
580
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.1k
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
210
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
仕様漏れ実装漏れをなくすトレーサビリティAI基盤のご紹介
orgachem
PRO
7
2.9k
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
170
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
610
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
750
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.3k
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
Featured
See All Featured
Designing for Performance
lara
611
70k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
From π to Pie charts
rasagy
0
150
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
54k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
30 Presentation Tips
portentint
PRO
1
260
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
92
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
360
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
52k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
200
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
92
Transcript
ZabbixAPIΛͭΜͭΜͨ͠ OSC2021 Online/Nagoya( community = “Python౦ւ”, date = “2021/05/29”,
location = [“Zoom”, “YoutubeLive”] )
Zabbixɺ͝ଘͰ͔͢ʁ
৭ʑͳπʔϧΛࢹͰ͖Δ ΦʔϓϯιʔειϑτΣΞͰ͢
https://www.zabbix.com/jp/features ΑΓ
͓ࣄ͔ΒΑ͘͏ͷͰ͕͢ɺ ࡉʑͱͨ͠ॲཧΛWebͰϙνϙν ਏ͍ͷͰAPIΛΑ͘ୟ͖·͢
طʹZabbixAPIΛ؆୯ʹ͑Δ PythonϞδϡʔϧଟ͍ͷͰ͕͢
ZabbixυΩϡϝϯτʹ͋Δ αϯϓϧJSONΛ ίϐϖͰ͖Δ΄͏͕ ݸਓతʹָͩͬͨͷͰ
ͦΜͳπʔϧΛ࿉͠·ͨ͠
https://github.com/2bobo/pyzbxtool
Կ͕Ͱ͖Δ͔? • APIͷϩάΠϯͱϩάΠϯใͷอ࣋ • API༻ͷJSONΛ͚͛ͭΔͱ݁ՌΛड͚औΔ
ͱ͍͏͘Β͍Կͯ͘͠Ε·ͤΜ
ͦͷΘΓ؆୯Ͱ͢
͍ํ import pyzbx-tool zbx_api = pyzbx-tool.ZabbixAPI("http://example.com", "Admin", "zabbix") version_json =
{ "jsonrpc": "2.0", "method": "apiinfo.version", "params": [], "auth": "", "id": 1 } version = zbx_api.call_api(version_json) print(version)
ެࣜυΩϡϝϯτͷ JSONΛίϐϖ͢ΕOK https://www.zabbix.com/documentation/current/manual/api/reference/apiinfo/version
؆୯Ͱ͠ΐʁ
ߋʹࠓͳΒͳΜͱʂʂ
ZabbixSenderػೳ ηοτʹ!!
Zabbix Sender? • ZabbixʹࢹσʔλΛ͚͛ͭΔϞϊ • ϗετΩʔɺΛࢦఆͯ͠ZabbixServerʹૹΔͷ͕ͩɺಠࣗͷύ έοτͰ௨৴͞ΕΔ • ZabbixͰఏڙ͞Ε͍ͯΔ͕ɺPython͔Β͛ΕΔͱRasPiͱ͔ Ͱ͏ͱ͖ʹָ
͍ํ import pyzbx-tool zbx_sender = pyzbx-tool.ZabbixSender("zabbix_server_ip", "10051") zbx_sender.add("host", "key", "value")
result = zbx_sender.send() print(result)
͜Ε؆୯Ͱ͠ΐʁ
ຊདྷ͚ͨ΄͏͕Α͍ػೳͰ͕͢ ݸਓతʹΑ͘͏ػೳΛࡶʹ ·ͱΊ͚ͨͩͩͬͨΓ͠·͢
None
ͱ͍͏͜ͱͰɺ Pythonͷͳͷ͔Zabbixͷͳͷ͔ Α͘Θ͔Βͳ͍Ͱͨ͠
͜ΜͳLTͰOKͳPython౦ւʹ ੋඇ͝ࢀՃ͍ͩ͘͞
࣍ճ8ʙ9݄ࠒʹ։࠵༧ఆͰ͢