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
2bo
June 03, 2021
Programming
480
0
Share
ZabbixAPIをつんつんした
OSC Nagoya 2021
Pyhton東海/JuliaTokai 合同ミニ勉強会
発表資料
2bo
June 03, 2021
More Decks by 2bo
See All by 2bo
おっきなガジェットの回線事情
2bo
1
210
おたく監視してみた
2bo
0
98
巨大ガジェット買ってみた
2bo
0
700
PyScriptの話
2bo
0
320
名古屋とお菓子🍪
2bo
0
490
名古屋 勉強会 会場 選定 2019
2bo
2
200
お城Pythonの作り方/OshiroPython
2bo
1
700
Python勉強法
2bo
0
880
Python 環境構築方法 2016
2bo
2
1.8k
Other Decks in Programming
See All in Programming
GoogleCloudとterraform完全に理解した
terisuke
1
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
380
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
Agentic AI & UI: Arcitecture, HITL, Emerging Standards
manfredsteyer
PRO
0
110
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
23k
[RubyKaigi 2026] Require Hooks
palkan
1
320
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
490
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
290
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
410
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
190
空間オーディオの活用
objectiveaudio
0
150
Featured
See All Featured
Building Adaptive Systems
keathley
44
3k
The Curse of the Amulet
leimatthew05
1
12k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
250
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
930
The Invisible Side of Design
smashingmag
302
52k
Done Done
chrislema
186
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Become a Pro
speakerdeck
PRO
31
5.9k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
180
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
560
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݄ࠒʹ։࠵༧ఆͰ͢