Cov txheej txheem:

Nruab thiab teeb Shinken Network Monitor ntawm Raspberry Pi: 14 Cov Kauj Ruam
Nruab thiab teeb Shinken Network Monitor ntawm Raspberry Pi: 14 Cov Kauj Ruam

Video: Nruab thiab teeb Shinken Network Monitor ntawm Raspberry Pi: 14 Cov Kauj Ruam

Video: Nruab thiab teeb Shinken Network Monitor ntawm Raspberry Pi: 14 Cov Kauj Ruam
Video: Kuv tus niam tsev wb yuav tiab tsho rau wb pab ntxhai kawm ntawv 2024, Hlis ntuj nqeg
Anonim
Nruab thiab teeb tsa Shinken Network Monitor ntawm Raspberry Pi
Nruab thiab teeb tsa Shinken Network Monitor ntawm Raspberry Pi

NCO TSEG: shinken tau hloov kho zaum kawg hauv MAR2016 rau kev tso tawm ruaj khov ntawm 2.4.3. Yog li, ntau xyoo dhau los kuv tau txav mus rau lwm txoj hauv kev los saib xyuas lub network hauv tsev. Ib qho ntxiv, php5 tsis zoo li tsis muaj

Yog li, thov tsis txhob siv cov lus qhia no!

Nruab thiab teeb tsa qhov hloov tshiab kawg ntawm shinken Network Monitor rau lub tsev lossis kev lag luam me.

Ntawm kev ua haujlwm, kuv pab pawg tsim kho software rau ntau dua 75 chav kawm server, nrog ntau dua 300 qhov xwm txheej hauv ntau lub chaw khaws ntaub ntawv thiab cov ntsiab lus ntawm qhov muaj. Muaj pab pawg ua haujlwm paub dhau los uas saib xyuas thiab khaws cov servers no khiav 24x7. Kuv tsis muaj dab tsi ze rau lawv cov kev paub lossis kev txawj ntse. Dhau li ntawm kuv tus kheej, Kuv tsis muaj leej twg txhawb nqa kuv lub tsev network. Thiab, Kuv xav siv sijhawm xoom sijhawm saib xyuas thiab tswj hwm kuv lub tsev network.

Kuv lub tsev LAN muaj ntau dua 40 qhov khoom siv sib txuas, uas yog qhov loj dua qhov kuv xav tau. Ntau lub tsev, tej zaum txawm tias yog koj li, muaj cov khoom siv sib txuas coob. Piv txwv ntawm cov khoom siv sib txuas yog:

  • laptops thiab ntsiav tshuaj
  • eBook nyeem ntawv
  • xov tooj ntawm tes
  • zes cua sov, ntsaws lub qhov rooj
  • kev ruaj ntseg, dej system
  • ntse TVs, tus txais U-nqe lus thiab DVR
  • streaming media servers (Apple TV, Roku, ChromeCast FireStick)
  • raspberry pi tsev automation tej yaam num

Raws li ntau lub cuab yeej hauv tsev tau txuas nrog, Kuv cia siab tias kuv lub network yuav loj tuaj.

Vim li cas tsev thiaj yuav tsum muaj lub network saib xyuas? Muaj cov servers thiab cov kev pabcuam tseem ceeb ntawm lub network hauv tsev. Piv txwv ntawm cov servers tseem ceeb suav nrog: ISP lub qhov rooj, qhov nkag tsis siv tau, kev ruaj ntseg, thiab kev siv dej. Piv txwv ntawm cov kev pabcuam tseem ceeb suav nrog: thaub qab PCs lossis MACs, kom ntseeg tau tias Wi-nkaus lossis internet tau ua haujlwm ntawm qhov xav tau ceev. Txhawm rau kom ntseeg tau cov kev pabcuam tseem ceeb/cov server ua haujlwm, lawv yuav tsum tau tshuaj xyuas tus kheej ntawm cov sijhawm sib xws, uas xav tau sijhawm ntau. Xwb, cov servers yuav tsum raug tshuaj xyuas siv lub network saib xyuas, uas sim kho qhov teeb meem thiab xa lus ceeb toom yog tias nws tsis tuaj yeem kho tau.

Shinken yog Network Monitor uas khiav ntawm ib lub computer. Hauv cov lus qhia no, Kuv yuav ua kom nws khiav Raspberry Pi (2 lossis 3) khiav Diet-Pi lossis raspbian.

Muaj ntau daim ntawv thov tshuaj xyuas lub network zoo. Piv txwv yog: SolarWinds, NetCool, thiab nagios. Cov ntawv thov no muaj peev xwm tshuaj xyuas, txheeb xyuas teeb meem, kho tus kheej thiab xa ntawv ceeb toom.

Feem ntau, Kuv tau sim ua kom kuv lub network cov nqi qis thiab yooj yim los tswj thiab hloov kho. Kuv tau nqaim kuv qhov kev tsom mus qhib cov ntawv thov sau ua tsawg hom lus. Kuv hom lus xaiv yog: nab nab, bash, html thiab css.

Shinken yog qhov qhib qhov rov sau dua ntawm nagios hauv nab hab sej. Yog li, shinken haum rau hauv kuv cov kev txwv thiab ua tau raws li kuv xav tau.

Cov ntawv qhia muab cov lus qhia ib qib zuj zus yog tias koj xav ua los ntawm txhais tes. Tab sis, kuv xav tau cov txheej txheem rov ua dua, yog li kuv kuj suav nrog cov ntawv tsis raug teeb tsa hauv kab ntawv txuas ntxiv, uas ua txhua yam nrog ob peb ntawm cov lus txib. Yog qee yam ua tsis raug, tsuas yog ua haujlwm tsis muaj neeg saib xyuas thiab nws yuav tsum kho qhov teeb meem feem ntau.

Kauj Ruam 1: Sau Qhov Chaw

Ua haujlwm dhau sijhawm, Kuv tau pom cov ntu hauv qab no ua tau zoo tshaj plaws hauv kuv daim ntawv thov. Cov khoom no kim dua li cov uas muaj nyob hauv cov khoom siv ib txwm pib.

Tau txais cov khoom thiab cov cuab yeej (tus nqi hauv USD):

  • Raspberry Pi 2 qauv B (Pi 3) Element14 $ 35 ($ 39)
  • Panda 300n WiFi Adapter Amazon $ 16.99 (tsis xav tau yog Pi 3 siv)
  • 5.2V 2.1A USB Power Adapter los ntawm Amazon $ 5.99
  • Micro USB rau USB cable 3ft los ntawm Amazon $ 4.69
  • CAT5e/6 Ethernet cable $ x.xx, nyob ntawm qhov ntev
  • Case los ntawm Amazon $ 6.99
  • SanDisk Ultra 16 GB microSDHC Class 10 nrog Adapter (SDSQUAN-016G-G4A) los ntawm Amazon $ 8.99
  • Yam khoom qub los yog rov siv tau:

    • MacBook Pro (Kuv siv MAC vim nws khiav linux raws li nws lub hauv paus OS. Txawm li cas los xij, Windows PC tuaj yeem siv tau)
    • FTDI TTL-232R-RPI Serial rau USB cable los ntawm Mouser $ 15
    • TV nrog HDMI chaw nres nkoj
    • USB keyboard
    • USB mus
    • HDMI Cable (tsuas yog xav tau thawj zaug dhau)

Sau ntawv:

  • Cov ntawv nyob hauv cov spades, xws li, ♣ replace-this ♣, yuav tsum hloov nrog tus nqi tiag. Tau kawg, tshem cov spades.
  • Cov lus txib tau qhia los ntawm $. Yog tias txiav-thiab-pasting cov lus txib, tsis txhob luam $.

Kauj ruam 2: Teeb Raspberry Pi

Siv cov lus qhia no los teeb tsa Raspberry Pi khiav DietPi. Yog tias koj xav tau, Raspbian tuaj yeem siv nrog cov lus qhia no.

Kuv hloov lub npe hostname rau "monitor-hostname". Hloov cov khoom hauv with nrog qhov muaj txiaj ntsig tiag.

Kauj Ruam 3: Qhib Terminal Window thiab Nkag Mus

Ua ntej txhua qib hauv qab no:

  • Qhib lub davhlau ya nyob twg qhov rai ntawm MacBook lossis PC, thiab tom qab ntawd
  • Nkag mus rau hauv Raspberry Pi

$ ssh pi@♣ raspberry-pi-ip-address ♣

Yog tias koj teeb tsa avahi-daemon ntawm koj li Raspberry Pi, tom qab ntawd koj tuaj yeem nkag mus rau txoj hauv kev no (Kuv tub nkeeg thiab kuv tsis xav nco IP chaw nyob):

$ ssh pi ♣ hostname loc.local

Kauj Ruam 4: Ib txwm Hloov Kho thiab Hloov Kho

Ua ntej txhim kho pob tshiab ntawm tus neeg rau zaub mov, ib txwm hloov kho thiab txhim kho.

  • Hloov kho rub tawm cov npe pob tshiab los ntawm cov chaw cia khoom tsim nyog.
  • Txhim kho tshiab cov pob khoom
  • Autoremove tshem cov pob khoom uas tsis xav tau ntxiv lawm
  • Rov pib dua yog xaiv tau. Qee qhov kev pabcuam yuav tsum tau rov pib dua tom qab hloov kho dua tshiab. Rebooting yog txoj kev tub nkeeg kom ntseeg tau tias txhua qhov kev pabcuam xav tau raug rov pib dua

$ sudo apt -tau hloov tshiab -y

$ sudo apt-tau hloov tshiab -y $ sudo apt-tau autoremove $ sudo reboot

Lossis koj tuaj yeem hla txhua cov kauj ruam uas tseem tshuav thiab siv qhov tsis muaj neeg saib xyuas hauv ib qho ntawm cov ntawv ntxiv.

Kauj Ruam 5: Txhim Kho Shinken Dependencies

Feem ntau shinken khiav ntawm tus neeg rau zaub mov loj heev thiab tau teeb tsa ntawm lub tshuab virtual (VMs). Tus neeg rau zaub mov loj muaj peev xwm ua haujlwm ntau VMs. VMs muaj ntau cov txiaj ntsig thaum tswj hwm ntau lub server, lossis ntau zaus ntawm tib lub server. VMs ua kom siv tau zoo ntawm cov peev txheej server.

Lub tshuab virtual tuaj yeem khiav ntawm Raspberry Pi. Txawm li cas los xij, ntau qhov zoo ntawm kev khiav VM ntawm $ 35 Raspberry Pi poob lawm. Shinken tsis xav tau VM. Cov lus qhia no tsis siv lub tshuab virtual.

Nruab shinken dependencies: sqlite3, php5, python3, thiab qee lub tsev qiv ntawv nab nab:

$ sudo apt -tau nruab sqlite3 -y

$ sudo apt-tau nruab php5 -y $ sudo apt-tau nruab python3 -y $ sudo apt-tau nruab python-pip python-pycurl python-cherrypy3 python-setuptools -y

Kauj Ruam 6: Nruab Shinken

Ntxiv cov neeg siv shinken thiab teeb tsa shaken siv pip.

$ sudo adduser shinken

$ sudo pip nruab shinken $ sudo adduser shinken sudo

Cov saum toj no teeb tsa shinken thiab qee daemons hauv /etc/init.d:

  • shinken-tus neeg pov npav
  • shinken-reactionner
  • shinken-txais
  • shinken-teem caij
  • shinken-broker

Kauj Ruam 7: Pib thiab Pib Shinken

Tsuas yog thaum shinken tab tom khiav, nres nws. Tsis tas li, tsim phau ntawv teev npe thiab teeb tsa kev tso cai.

$ sudo mkdir/var/log/shinken

$ sudo chmod 777/var/log/shinken $ sudo kev pabcuam shinken nres

Khiav cov hauv qab no kom pib thiab pib shinken:

$ sudo shinken --init

$ sudo /etc/init.d/shinken pib

Txheeb xyuas shinken tau teeb tsa kom raug:

$/usr/bin/shinken -arbiter -v -c /etc/shinken/shinken.cfg

Ua shinken pib ntawm khau raj

$ sudo hloov tshiab-rc.d shinken defaults

Kauj Ruam 8: Teeb tsa thiab teeb tsa Sqlite3

Teeb sqlite los ua shinken database:

$ sudo shinken nruab sqlitedb

Tsim cov ntaub ntawv teeb tsa ntxiv rau sqlite:

$ sudo nano /etc/shinken/modules/sqlitedb.cfg

Kuv siv sqlite3. Nws tsis paub meej tias daim ntawv qhia no mus rau sqlite3 lossis rau hauv cov ntaub ntawv tshwj xeeb sqlite DB.

txhais module {

module_name sqlitedb module_type sqlitedb uri /var/lib/shinken/webui.db}

Hloov kev tso cai ntawm cov ntawv

$ sudo chmod 777 /etc/shinken/modules/sqlitedb.cfg

Kauj Ruam 9: Nruab Shinken Web UI

Nruab Shinken's Web UI:

$ sudo/usr/bin/shinken tshawb webui

$ sudo/usr/bin/shinken nruab webui Rub: webui OK webui

Kho qhov Web UI teeb tsa thiab hloov qhov nkag: CHANGE_ME. Kuv tsis paub meej tias nws yuav tsum hloov mus rau qhov twg. Kuv hloov mus rau lo lus random.

$ sudo nano /etc/shinken/modules/webui.cfg

Hloov kho tus tswv lag luam kom suav nrog Web UI cov qauv

$ sudo nano /etc/shinken/brokers/broker-master.cfg

Hloov kab:

cov qauv

rau

modules web ua

Restart shinken

$ sudo /etc/init.d/shinken rov pib dua

Kauj ruam 10: Ntxiv Cov Neeg Siv thiab Passwords

Xyuas kom muaj txheej txheem teeb tsa tso cai rau cov neeg siv shinken

$ sudo shinken nruab auth-cfg-password Kho kom raug shinken's Web UI teeb tsa

$ sudo nano /etc/shinken/modules/webui.cfg

Hloov mus zoo li:

modules auth-cfg-password

Vince35 qhia tias yuav tsum tau rov pib dua ntawm qhov no:

$ sudo /etc/init.d/shinken rov pib dua

Qhib lub qhov rai browser thiab nkag mus siv tus password thiab lub npe siv: admin, admin. Nkag mus rau cov hauv qab no hauv qhov browser URL (tshem qhov chaw nyob ib ncig ntawm txoj hnyuv):

♣hostname♣.local:7767

nkag mus siv admin, raspberry-pi-password

Thiab nws yuav tsum ua haujlwm!

Kauj Ruam 11: Cov Ntawv Ntxiv: Cov neeg ua tim khawv

Saib Xyuas Network

Nthuav nthuav cov ntaub ntawv saib xyuas lub network

Network Saib

  • ntiv tes:
  • HowToGeek.com - qhov zoo tshaj plaws
  • MRTG:
  • Netbeez:
  • Raspberry Pi Geek:
  • Shinken: rov sau dua ntawm Nagios hauv nab hab sej:
  • Shinken Nruab:
  • Shinken Web UI Teeb:
  • GitHub systemd:
  • Rob Layton: Teeb tsa tus kheej teeb tsa Shinken Saib Xyuas Neeg rau zaub mov

Kauj ruam 12: Cov ntawv txuas ntxiv: Hloov kho tshiab

15OCT2016: Hloov kho daim duab kom suav nrog Shinken thiab Raspberry Pi cov cim

16 Lub Kaum Hli 2016: Hloov kho qee nqe lus. Tsis muaj kev hloov pauv.

19 Lub Kaum Hli 2016: Hloov kho cov lus qhia thiab UAI kom pib shinken ntawm kev rov pib dua

Kev Txhim Kho Yav Tom Ntej:

Ntxiv cov kab ke los saib xyuas, txawm nyob hauv cov lus qhia lossis ua cov ntawv txuas nrog piv txwv sau ntawv

Kauj Ruam 13: Cov Ntawv Ntxiv: Troubleshooting

Hloov kev tso cai ntawm Cov Ntawv Qhia

/usr/rau

/etc/init.d/etc/shinken/var/lib/shinken/modules/webui//etc/shinken/modules/

Kuv rov pib dua Raspberry Pi, tab sis shinken yuav tsis pib. Kuv tsis tuaj yeem sau rau phau ntawv teev npe. Yog li, kuv tau hloov pauv hauv qab no:

sudo mkdir/var/cav/shinken

sudo chmod 777/var/log/shinken

shinken localhost nqis

Yog localhost qhia raws li nqes.

$ sudo nano/etc/network/interfaces

Vim li cas los xij, kuv/lwm yam/network/cuam tshuam cov ntaub ntawv feem ntau tsis quav ntsej. Hloov kab no:

auto lo iface lo inet loopback

rau ob kab no:

auto hlo

hais tias nws yog inet loopback

Thiab reboot

$ sudo rov pib dua

Init.d yuav tsum pib shinken txiav, tab sis kuv yuav tsum ua qhov no:

$ sudo /etc/init.d/shinken rov pib dua

Kauj Ruam 14: Cov Ntawv Ntxiv: Tsis Siv Neeg Nruab

Ua kom shinken teeb tsa thiab teeb tsa yooj yim heev los ntawm kev siv cov txheej txheem qhia siv bash unattended install script. Tsab ntawv xav tias raspberry pi khiav raspbian lossis dietpi, uas tau teeb tsa siv ib qho ntawm qhov txuas txuas.

Kuv ua tiav tsab ntawv ntawm github thiab

  • sim qhov chaw ntawm dietpi
  • sim unattended install script ntawm dietpi

    • khiav ib zaug
    • khiav ntau zaus, nrog CTRL-c cuam tshuam
  • sim tsis tau saib xyuas cov ntawv sau ntawm raspbian thiab noj zaub mov-pi

Tsab ntawv xav tias lub npe siv = pi, thiab tus password = raspberry, thiab tsab ntawv tau sim teeb tsa shinken. Yog tias cov no tsis raug, tom qab ntawv kho cov ntawv kom raug.

Qhib lub davhlau ya nyob twg qhov rai ntawm MacBook lossis PC thiab khiav cov lus txib hauv qab no:

$ ssh pi@♣ ip-address ♣

$ sudo wget https://raw.githubusercontent.com/dumbo25/uai_install_shinken_rpi/master/shinken_uai.sh $ sudo chmod o+x shinken_uai.sh $ sudo bash shinken_uai.sh $ sudo reboot $ sudo /etc/init.d/ shinken rov pib dua

Tsab ntawv yuav siv ob peb feeb los khiav ntawm kev noj haus-pi.

Nco ntsoov rov pib dua Raspberry Pi thiab tos kom txog thaum shinken pib

Qhib qhov browser thiab hauv qhov URL nkag mus:

♣ ip-chaw nyob: 7767

ID nkag mus siv admin thiab ♣ raspberry-pi-password ♣

Thiab nws yuav tsum ua haujlwm!

Pom zoo: