Upgrade to Pro — share decks privately, control downloads, hide ads and more …

それでも僕はzabbixと生きていく

youyo
October 07, 2017

 それでも僕はzabbixと生きていく

youyo

October 07, 2017
Tweet

More Decks by youyo

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • ੴᖒ௚ਓ(Naoto Ishizawa) • twitter: @youyo_ • github: https://github.com/youyo

    • Cloud Architect @ heptagon inc. • I love golang, python, ruby • ࠷ۙϋϚ͍ͬͯΔ΋ͷ: 
 υϥΰϯϘʔϧυοΧϯότϧ
 LRଙޛ൧ͷݩΛखʹೖΕͨ͜ͱ͕࠷ۙҰ൪خ͔ͬͨ͠
  2. LLD (Low Level Discovery) • ͍͍ײ͡ʹ؂ࢹର৅Λݟ͚ͭͯ • ͍͍ײ͡ʹσʔλूΊͯ • ͍͍ײ͡ʹ؂ࢹର৅ফ͑ͨΒϗετొ࿥࡟আ΋ͯ͘͠ΕΔ


    
 “Ϣʔβʔ͸ɺಛఆͷJSONϓϩτίϧʹै͏ͱ͍͏৚݅ͰɺಠࣗͷλΠϓ ͷσΟεΧόϦΛఆٛͰ͖·͢ɻ” IUUQTXXX[BCCJYDPNEPDVNFOUBUJPOKQNBOVBMEJTDPWFSZMPX@MFWFM@EJTDPWFSZ
  3. UserParameter & Loadale modules • UserParameter
 “ر๬ͷσʔλͷݕࡧΛߦ͏ίϚϯυΛॻ͖ɺΤʔδΣϯτઃఆϑΝΠϧͷ ϢʔβʔύϥϝʔλʢʮUserParameterʯઃఆύϥϝʔλʣʹؚΊΔ͜ͱ͕ Ͱ͖·͢ɻ”
 >UserParameter=<key>,<command>

    • Loadable modules
 “loadable modules͸ɺZabbixͷػೳΛ֦ு͢ΔͨΊͷɺੑೳΛߟྀͨ͠ બ୒ࢶͱͳΓ·͢ɻZabbix 2.2͔Β͸ɺੑೳΛଛͶΔ͜ͱͳ͘ɺZabbixΤʔ δΣϯτ͓ΑͼαʔόʔΛ֦ு͢ΔͨΊͷloadable modules͕αϙʔτ͞ ΕΔΑ͏ʹͳΓ·ͨ͠ɻ” IUUQTXXX[BCCJYDPNEPDVNFOUBUJPOKQNBOVBMDPOpHJUFNTVTFSQBSBNFUFST IUUQTXXX[BCCJYDPNEPDVNFOUBUJPOKQNBOVBMDPOpHJUFNTMPBEBCMFNPEVMFT
  4. g2z

  5. What is "g2z”? • https://github.com/cavaliercoder/g2z • loadable modulesΛgolangͰॻ͚Δ. (golangͰshared libraryͱͯ͠ੜ੒)

    • Zabbix version 2.xܥ, 3.0ରԠ package main import ( "strings" "github.com/cavaliercoder/g2z" ) func main() { panic("THIS_SHOULD_NEVER_HAPPEN") } func Echo(request *g2z.AgentRequest) (string, error) { return strings.Join(request.Params, " "), nil } func init() { g2z.RegisterStringItem("go.echo", "Hello world!", Echo) }
  6. ҙ༁ • ֎෦ʹhttpϦΫΤετΛߦ͏ͱɺݻ·Δ͜ͱ͕͋Δ • golang͸ѱ͘ͳ͍ • zabbix΋ѱ͘ͳ͍ • goroutine͕ؔ܎ͯ͠Δͷ͔ͳʁ •

    single coreͷϚγϯͰͳΒਖ਼ৗʹಈͬ͘Ά͍Αʁ
 ->͍΍ಈ͔ͳ͍.. • ͪΐͬͱαϙʔτ͖͠Εͳ͍Θʔ
  7. UserParameterͰLLD͢Δʹ͸ • ϓϩάϥϜॻ͍ͯ΋shell-scriptͰ΋ԿͰ΋͍͍ • ܾ·ͬͨϑΥʔϚοτ(json)ͰσʔλΛฦ͢ඞཁ͕͋Δ { "data":[ { "{#INSTANCE_ID}":"i-xxxxxxxxxx", "{#INSTANCE_NAME}":"test1"

    }, { "{#INSTANCE_ID}":"i-yyyyyyyyyy", "{#INSTANCE_NAME}":"test2" }, { "{#INSTANCE_ID}":"i-zzzzzzzzzz", "{#INSTANCE_NAME}":"test3" } ] }
  8. ͓·͚: prometheusࡶײ • prometheus΋zabbixͷΑ͏ͳ؂ࢹπʔϧ • ΠϯετʔϧͳͲ͸όΠφϦஔ͚ͩ͘ͰࡁΉͷͰָ • Service discoveryͷػೳ͕͋Γɺࠓճ࡞੒ͨ͠Α͏ͳػೳ͸ॳΊ͔Β͍࣋ͬͯ ΔɻΫϥ΢υωΠςΟϒɻ

    • ίϯςφͷ؂ࢹ΋͍͍ײ͡ʹߦ͑ΔɻcAdvisorͱͷ࿈ܞ͕ૉ੖Β͍͠ɻ • σʔλͷอଘظؒ͸σϑΥϧτ15೔ɻ௕ظอଘ(long term storage)͸ਪ঑͞ Εͳ͍ɻͨͩ͠࠷ۙ֎෦ετϨʔδͱͯ͠influxdb͕αϙʔτ͞Εͨؾ͕͢Δ ͷͰཁݕূ • Ͱ΋ͦ΋ͦ΋؂ࢹσʔλͷ௕ظอଘ͕ඞཁͳέʔεͬͯ͋·Γͳ͍ؾ͕ͯ͠Δɻ (zabbixʹ׳Ε͗ͨ͢) • Ξϥʔτϧʔϧͷهड़͕େมͦ͏ɻzabbixͷ΄͏͕ݸਓతʹ͸Θ͔Γ΍͍͢ɻ • ΞϥʔτपΓΛ͏·͍͜ͱ΍ΕΔΑ͏ʹͳͬͨΒଈಋೖ͍ͨ͠Ϩϕϧ
 (zabbixͱ྆ํ͏·͘࢖͍෼͚͍͖͍ͯͨ)