Khoa Luan Nghien Cuu

  • View
    215

  • Download
    0

Embed Size (px)

Text of Khoa Luan Nghien Cuu

  • 8/2/2019 Khoa Luan Nghien Cuu

    1/74

    I HC QUC GIA H NITRNG I HC CNG NGH

    Phm Hng Khi

    NGHIN CU TRIN KHAI H THNG GIM

    ST QUN TR MNG (TRN NN TNG HTHNG M NGUN M NAGIOS)

    KHO LUN TT NGHIP I HC H CHNH QUY

    Ngnh:Cng ngh thng tin

    H NI - 2009

  • 8/2/2019 Khoa Luan Nghien Cuu

    2/74

    2

    I HC QUC GIA H NITRNG I HC CNG NGH

    Phm Hng Khi

    NGHIN CU TRIN KHAI H THNG GIMST QUN TR MNG (TRN NN TNG H

    THNG M NGUN M NAGIOS)

    KHO LUN TT NGHIP I HC H CHNH QUY

    Ngnh:Cng ngh thng tin

    Cn b hng dn:ThS. Nguyn Nam HiCn b ng hng dn: Th.S Phng Ch Dng

    H NI - 2009

  • 8/2/2019 Khoa Luan Nghien Cuu

    3/74

    LI CM N

    Sau 3 thng lm kho lun tt nghip, c s hng dn, ch bo tn tnh ca

    thy gio Nguyn Nam Hi v s c gng n lc ca bn thn, em hon thnh kho

    lun tt nghip vi ti NGHIN CU TRIN KHAI H THNG GIM ST

    QUN TR MNG (TRN NN TNG H THNG M NGUN M NAGIOS);

    Em xin chn thnh cm n Thy v cc thy c gio khoa Cng ngh thng tin

    trng i Hc Cng Ngh - i Hc Quc Gia H Ni o to, truyn t cho em

    nhng kin thc v kinh nghim trong lnh vc Cng ngh thng tin ni ring v nhng

    kin thc khc ni chung em c c nhng kin thc tng hp trc khi ra trng;

    Xin cm n bn b gip ti liu v trao i kinh nghim hon thnh kho

    lun tt nghip.

    Xin cm n!

    H Ni, Thng 5-2009

    Ngi thc hin

    Phm Hng Khi

    3

  • 8/2/2019 Khoa Luan Nghien Cuu

    4/74

    TM TT

    Hin nay khi nim qun tr mng khng cn xa l g trong ngnh cng ngh

    thng tin. N tr thnh mt trong nhng lnh vc nghin cu chnh v mng my tnh

    v l mt cng vic quan trng khng th thiu trong cc h thng my tnh ca cc t

    chc, doanh nghip, trng hc Theo hng nghin cu lnh vc trn, kha lun nytp trung vo vic tm hiu v trin khai mt h thng gim st qun tr mng da trn

    nn tng h thng m ngun m. l Nagios. Nagios l h thng gim st mng c chi

    ph u t thp. Tuy nhin n c kh nng rt mnh m trong vic gim st hot ng

    ca cc thit b trn mng. Bi vy Nagios rt c tin tng v s dng rng ri trn

    ton cu.

    4

  • 8/2/2019 Khoa Luan Nghien Cuu

    5/74

    MC LC

    DANH MC CC T, THUT NG VIT TT

    Vit tt/thutng

    Tn y ngha

    Host Dng ch cc thit b mng, cc myu cui c gim st(tt c cc thit btham gia vo mng u c gi chung lhost)

    Flap Tnh trng thay i trng thi lin tc

    plugin L cc ng dng h tr cho hot ngca mt phn mm.

    5

  • 8/2/2019 Khoa Luan Nghien Cuu

    6/74

    CHNG 1. GII THIU CHUNG1.1. Gii thiu

    Network mornitoring hay ting vit hiu l gim st, theo di mng l mt trong

    nhng vn hin nay tr ln rt quan trng trong vic qun tr cc h thng mng. Nhn ch ti a vic mng b gin on trong qu trnh hot ng. N m bo vic khai

    thc ti nguyn c hiu qu, m bo an ton, tin cy cho nhng dch v cung cp

    Hin nay c rt nhiu cng c gim st mng h tr cho cng vic ca ngi qun tr.

    Chc nng ca chng l gim st thng thi hot ng ca cc thit b mng, cc dch

    v mng, v cc my u cui tham gia vo mng v thng bo cho ngi qun tr khi

    c s c hoc kh nng s sy ra s c. C c nhng h thng thng mi nh HPopen

    View Hay ngun m nh openNMS, Cacti, Nagios Mi h thng li c nhng u

    nhc im ring. Tuy nhin kh nng ca chng li khng hn nhau nhiu lm. Bi

    kha lun ny tp trung vo vic nghin cu mt h thng gim st da trn Nagios,

    mt sn phm ngun m c s dng rng ri. T khi ra i 2002 n nay Nagios

    lin tc pht trin v rt c quan tm. Cng ng quan tm v s dng Nagios cho

    n nay theo thng k ca http://nagios.org l vo khong 250.000 ngi. T phin bn

    1.0 u tin, n nay Nagios pht trin nn phin bn 3.x v vn lin tc cho ra

    nhng phin bn mi vi tnh nng mnh m hn. c bit Nagios c kh nng phn

    tn. V vy n c th gim st cc mng khng l, t c 100.000 node.

    1.2. Mc ch ca kha lunKha lun s tp trung vo tm hiu kh nng ca h thng Nagios. N p ng

    c nhng g cho cng vic qun tr mng. Cch thc n hot ng nh th no v

    trin khai th nghim h thng trn mng ca trng i hc cng ngh.

    1.3. Kt qu t cSau mt thi gian nghin cu, tm hiu, ti nm bt c cc chc nng v c

    im ca Nagios, tm hiu c cch thc t chc v hot ng ca h thng. Ti

    trin khai th nghim h thng trn mng ca trng i hc Cng Ngh v bc

    u c nhng nhn xt v nh gi v hot ng ca h thng.

    1.4. B cc kha lunChng 1: Gii thiu chung v kha lun, ti, mc ch thc hin v kt qu

    t c.

    1

    http://nagios.org/http://nagios.org/
  • 8/2/2019 Khoa Luan Nghien Cuu

    7/74

  • 8/2/2019 Khoa Luan Nghien Cuu

    8/74

    Gim st cc ti nguyn cc my phc v v cc thit b u cui (chy h iu

    hnh Unix/Linux, Windows, Novell netware): tnh trng s dng CPU, ngi dng ang

    log on, tnh trng s dng a cng, tnh trng s dng b nh trong v swap, s tin

    trnh ang chy, cc tp log h thng.

    Gim st cc thng s an ton thit b phn cng trn host nh: nhit CPU,

    tc qut, pin, gi h thng

    Gim st cc thit b mng c IP nh router, switch v my in. Vi Router,

    Switch, Nagios c th theo di c tnh trng hot ng, trng thi bt tt ca tng

    cng, lu lng bng thng qua mi cng, thi gian hot ng lin tc (Uptime) ca

    thit b. Vi my in, Nagios c th nhn bit c nhiu trng thi, tnh hung sy ra

    nh kt giy, ht mc

    Cnh bo cho ngi qun tr bng nhiu hnh thc nh email, tin nhn tc thi

    (IM), m thanh nu nh c thit b, dch v gp trc trc

    Tng hp, lu gi v bo co nh k v tnh trng hot ng ca mng.

    2.2 c im ca Nagios Cc hot ng kim tra c thc hin bi cc plugin cho my phc v Nagios

    v cc m un client trn cc thit b ca ngi dng cui, Nagios ch nh k nhn cc

    thng tin t cc plugin v x l nhng thng tin (thng bo cho ngi qun l, ghivo tp log, hin thi ln giao din web).

    Thit k plugin n gin cho php ngi dng c th t nh ngha v pht trin

    cc plugin kim tra cc dch v theo nhu cu ring bng cc cng c lp trnh nh shell

    scripts, C/C++, Perl, Ruby, Python, PHP, C#.

    C kh nng kim tra song song trng thi hot ng ca cc dch v( ng thi

    kim tra nhiu dch v).

    H tr khai bo kin trc mng. Nagios khng c kh nng nht dng c topoca mng. ton b cc thit b, dch v mun c gim st u phi khai bo v nh

    ngha trong cu hnh.

    Gi thng bo n ngi/nhm ngi c ch nh sn khi dch v/host c

    gim st gp vn v khi chng khi phc hot ng bnh thng.(qua e-mail, pager,

    SMS, IM)

    Kh nng nh ngha b x l s kin thc thi ngay khi c s kin sy ra vi

    host/ dch v.

    3

  • 8/2/2019 Khoa Luan Nghien Cuu

    9/74

    Giao din web cho php xem trng thi ca mng, thng bo, history, tp log.

    2.3. Kin trc v t chc hot ng

    2.3.1 Kin trc ca Nagios

    H thng Nagios gm hai phn chnh:1. Li Nagios

    2. Plugin

    Phn li nagios c chc nng qun l cc host/dch v c gim st, thu thp cckt qu kim tra (check) host/dch v t cc plugin gi v, biu din trn giao dinchng trnh, lu tr v thng bo cho ngi qun tr. Ngoi ra n cn tng hp v ara cc bo co v tnh hnh hot ng chung hoc ca tng host/dch v trong mtkhong thi gian no .

    Plugin l b phn trc tip thc hin kim tra host/dch v. Mi mt loi dch vu c mt plugin ring bit c vit phc v ring cho cng vic kim tra dch v. Plugin l cc script (Perl, C ) hay cc tp c bin dch (executable). Khi cnthc hin kim tra mt host/dch v no Nagios ch vic gi plugin tng ng vnht kt qu kim tra t chng. Vi thit k nh th ny, h thng Nagios rt d dngc m rng v pht trin. Bt k mt thit b hay dch v no cng c th c gimst nu nh vit c plugin cho n. Hnh bn di cho ta thy s tng quan gia ccthnh phn trong Nagios.

    Hnh 2.1 S t chc ca Nagios

    2.3.2. Cch thc t chc hot ng

    Nagios c 5 cch thc thi cc hnh ng kim tra:

    2.3.2.1. Kim tra dch v trc tip.

    i vi cc dch v mng c giao thc giao tip qua mng nh smtp, http, ftp

    Nagios c th tin hnh kim tra trc tip mt dch v xem n ang hot ng hay

    4

  • 8/2/2019 Khoa Luan Nghien Cuu

    10/74

    khng bng cch gi truy vn kt ni dch v n server dch v v i kt qu tr v.

    Cc plugin phc v kim tra ny c t ngay trn server Nagios.

    2.3.2.2. Chy cc plugin trn my xa bng secure shell

    Nagios server khng c cch no c th truy cp trc tip client theo di nhng

    thng tin nh tnh trng s dng a, swap, tin trnh lm c vic ny th

    trn my c gim st phi ci plugin cc b. Nagios s iu khin cc plugin cc b

    trn client qua secure shell ssh bng plugin check_by_ssh. Phng php ny yu cu

    mt ti khon truy cp host c gim st nhng n c th thc thi c tt c cc plug-

    in c ci trn host .

    2.3.2.3. B thc thi plugin t xa (NRPE - Nagios Remote Plugin Executor)

    NRPE l mt addon i km vi Nagios. N tr gip vic thc thi cc plugin c

    ci t trn my/thit b c gim st. NRPE c ci trn cc host c gim st. Khi

    nhn c truy vn t Nagios server th n gi cc plugin cc b ph hp trn host ny,

    thc hin kim tra v tr v kt qu cho Nagios server. Phng php ny khng i hi

    ti khon truy cp host c gim st nh s dng ssh. Tuy nhin cng nh ssh cc

    plugin phc v gim st phi c ci t trn host c gim st. NRPE c th thc thi

    c tt c cc loi plugin gim st. Nagios c th iu khin my ci NRPE kim tra

    cc thng s phn cng, cc ti nguyn, tnh trng hot ng ca my hoc s dngNRPE thc thi cc plugin yu cu truy vn dch v mng n mt my th 3 kim

    tra hot ng ca cc dch v mng nh http, ftp, mail

    2.3.2.4 Gim st qua SNMP

    Ct li ca giao thc SNMP (SimpleNetwork Management Protocol )l tp hp

    n gin cc hot ng gip nh qun tr mng c th qun l, thay i trng thi thit

    b. Hin nay rt nhiu thit b mng h tr giao thc SNMP nh Switch, router, my in,

    firewall ... Nagios cng c kh nng s dng giao thc SNMP theo di trng thi cacc client, cc thit b mng c h tr SNMP. Qua SNMP, Nagios c c thng tin v

    tnh trng hin thi ca thit b. V d nh vi SNMP, Nagios c th bit c cc cng

    ca Switch, router c m hay khng, thi gian Uptime (chy lin tc) l bao nhiu

    2.3.2.5. NSCA (Nagios Service Check Acceptor)

    Nagios c coi l mt phn mm rt mnh v n d dng c m rng v kt

    hp vi cc phn mm khc. N c th tng hp thng tin t cc phn mm kim tra

    5

  • 8/2/2019 Khoa Luan Nghien Cuu

    11/74

  • 8/2/2019 Khoa Luan Nghien Cuu