Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ZabbixAPIをつんつんした
Search
2bo
June 03, 2021
Programming
510
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ZabbixAPIをつんつんした
OSC Nagoya 2021
Pyhton東海/JuliaTokai 合同ミニ勉強会
発表資料
2bo
June 03, 2021
More Decks by 2bo
See All by 2bo
おっきなガジェットの回線事情
2bo
1
240
おたく監視してみた
2bo
0
120
巨大ガジェット買ってみた
2bo
0
720
PyScriptの話
2bo
0
340
名古屋とお菓子🍪
2bo
0
520
名古屋 勉強会 会場 選定 2019
2bo
2
230
お城Pythonの作り方/OshiroPython
2bo
1
730
Python勉強法
2bo
0
900
Python 環境構築方法 2016
2bo
2
1.9k
Other Decks in Programming
See All in Programming
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
業務時間外もAIに働いてもらう話
colorful12
3
10k
自分的「カンファレンスの楽しみ方」
syumai
0
200
信頼性の目標を誰も求めてない
shubox
0
500
Deep dive into the select statement (GopherCon UK)
jespino
0
170
Press start. Python's next generation.
willingc
PRO
3
330
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
590
Intent as Code
shoppingjaws
4
660
Building an Out-of-Order CPU
latte72
1
740
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
3
400
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
150
高専キャリア LT 発表内容
crysta1221
6
5.6k
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Test your architecture with Archunit
thirion
2
2.4k
How to train your dragon (web standard)
notwaldorf
97
6.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
For a Future-Friendly Web
brad_frost
183
10k
Believing is Seeing
oripsolob
1
210
Fireside Chat
paigeccino
42
4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
The Limits of Empathy - UXLibs8
cassininazir
1
650
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
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݄ࠒʹ։࠵༧ఆͰ͢