请选择 进入手机版 | 继续访问电脑版
查看: 667|回复: 4

Zabbix监控之自定义监控项目

34

主题

34

帖子

138

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
138
羊大仙 发表于 2015-12-10 20:41:18 | 显示全部楼层 |阅读模式

zabbix搭建好后,除了调用默认的模板,还要监控其它常用的进程,有redis,rsync,nginx,gunicorn,mysql等等都要进行监控。

 

自定义监控的配置过程如下:

1、编写进程监控脚本,获取监控项的具体值

2、在zabbix_agentd.conf文件中定义UserParameter

3、在界面配置item,通过键值来控制传参

4、查看监控数据情况

5、配置触发器,用来报警

6、宕服务测试

 

对于zabbix的安装与邮件报警设置,可参考两篇文章。

http://yangrong.blog.51cto.com/6945369/1541810  zabbix监控之基于LNMP环境安装

http://yangrong.blog.51cto.com/6945369/1541822  zabbix监控之同时向多人邮件报警

  

1、编写进程监控脚本,获取监控项的具体值

进程监控脚本构思:

根据名称或端口号来判定该程序是否存在。

如果传参包含端口号,则根据端口号判断进程,有返回1,没有返回0

如果不包含端口号,根据进程名判断进程,有返回1,没有返回0

 

注:所编写的脚本只需要输出具体值即可,无须像nagios那样返回退出值,描述信息等。

 

 

2、在zabbix_agentd.conf文件中定义UserParameter

zabbix agent端修改zabbix_agentd.conf文件:

用户参数=键值

  • ,命令

    echo 'UserParameter =check_process

  • ,/usr/bin/python /python/process_port.py $1 $2 ' >>/usr/local/zabbix/etc/zabbix_agentd.conf  #添加用户参数

    /etc/init.d/zabbix_agentdrestart    #重启zabbixagent服务

     

    agent端本机测试:

    在中括号中内容为传参内容,如果要传参多个,用逗号隔开,第一个则是$1,第二个则是$2

    [root@yang python]#/usr/local/zabbix/sbin/zabbix_agentd -t check_process[hello]

    check_process[hello]                          [t|0]

    #返回结果为0,代表hello进程不存在。

    [root@yang python]#/usr/local/zabbix/sbin/zabbix_agentd -t check_process[mysql]

    check_process[mysql]                          [t|1]

    #返回结果为1,代表mysql进程存在。

    [root@yang python]#/usr/local/zabbix/sbin/zabbix_agentd -t check_process[mysql,3306]

    check_process[mysql,3306]                     [t|1]

     

    测试可用,接下来在主界面配置监控

     

    3、在界面配置item,通过键值来控制传参

    【组态】à【主机】à【项目】à【创建监控项】

    此处键值的用法和zabbix_agentd.conf中定义的UserParameter一致。


    4、查看监控数据情况

    【监控中】à【最新数据】 最新数据为1,监控正常。

    wKiom1PzZZiTI-DrAAEyMoVcg1o866.jpg

     

    5、配置触发器,用来报警

    【组态】à【主机】à【触发器】à【创建触发器】

    wKioL1PzZrCxH5bwAAHgeXMgjC4090.jpg 


    6、宕服务测试

    agent client端,宕掉mysql。邮箱1分钟后收到报警。

    wKioL1PzZrHwQKMHAAGlRhaybyA922.jpg

     

    成功收到报警邮件,自定义监控及报警配置完成。

     


    本文出自 “楊雲” 博客,请务必保留此出处http://yangrong.blog.51cto.com/6945369/1542271

  • 本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    回复

    使用道具 举报

    2220

    主题

    2484

    帖子

    7227

    积分

    论坛元老

    Rank: 8Rank: 8

    积分
    7227
    Wilbscusly 发表于 2017-5-28 14:09:36 | 显示全部楼层
    Buying free shipping isotretinoin isotrex best website  Purchase Accutane Amoxil Bon Cialis Viagra En France  Nolvadex Tamoxifen 20mg Xenical 120mg Forum Achat Cialis  Order Clomiphene Torsemide Vente De Cialis Sans Ordonnance  How To Get Antabuse Generika Cialis Kamagra Viagra 100mg Preis Apotheke  Generic Amoxil Buy Effetto Viagra Sulle Donne Zyvox Amoxicillin  Buy Zithromax Usa Order Prednisone Overnight Last Longer In Bed Tonight  Tamoxifen Pct Finasteride Arginina Propecia Levitra Information  Online Xenical Cialis Senza Ricetta In Italia Levitra Funziona Sempre  Doxycycline 100mg Amoxicillin And Lab Tests Commande Cialis 20  Generic For Inderal Free Shipping Fluoxetine Fysionorm Cash On Delivery Viagra Pillola Rossa  Order Levitra Online Apotheke Kamagra Bestellen Misotrol No Prescription  Cheapest Vibramycin Online Buy Kamagra Dublin Buy Cytotec Online  Buy Generic Nolvadex Online Can I Buy Nexium Online Cialis Frei Erhaltlich Lander  Cheap Prozac No Rx Buy Zithromax Online Uk Viagra Und Poppers  Generic Clomid Buy Amoxicillin 500 Tablets The minimum required payment will be deducted from your bank account.Doing so will give you more legal standing if the borrower defaults she says. payday advance the lay odds are nearly always higher.Triamcinolone  Generic For Strattera Finasteride Propecia Cialis Nachteile  Misoprostol Generic Amoxicillin And Pediatric Dosage Risultati Finasteride Propecia  Propecia Pill Itching Caused By Amoxicillin Cialis 60  Oratane Acquisto Cialis Senza Ricetta Viagra Da 100 Mg Prezzo  Purchase Lasix Cheap Viagra Jelly Uk Propecia Generic Equivalent  Accutane 20mg Over The Counter Diabetic Medicine Amoxicillin Clav Side Effects  Buy Propecia Does Amoxicillin Cause Increase Thirts Buy Generic Prevacid Online  Vibramycin Prices Anafranil Pills Best Prices For Motillum  Propecia Help Forum Farmaco Generico Cialis Amoxicillin Tr  Cytotec Usa Comprare Cialis Online Forum Cialis Viagra From Canada  Cost Propecia Cialis Nedeland Antibiotic S Euro Med  Low Price Amoxil Blacl Market Viagra Comprar Cialis Viagra  Medication Antabuse Viagra Trotz Herzinfarkt Viagra Et Generique  Buy Oratane Vente Baclofen 10mg Amoxicillin Drug Interaction  Mail Order Vibramycin Buy Diflucan Cheap No Prescription But Lexapro Without A Script  Generic Of Propecia Will Cephalexin Cure Staph Amoxicillin For Uti  Nolvadex 40mg Viagra Generique Pas Viagra Bestellen Bankuberweisung  Dapoxetine Online Purchase Minoxidil Buying Cialis Tadalafil  How To Order Clomid Spese Levitra In Farmacia Renova Price  Buy Online Zoloft Suhagra 100 Cialis Le Moin Cher  By Cheap Clomiphene Generic Progesterone Without Dr Approval Buy Generic Lasix Online  Vibramycin 100mg Amoxicillin Normal Dose Cheap Kamagra Viagra  Buy Doxycycline Priligy Does It Work Priligy Foro  Order Antabuse Priligy 60 Mg Filmtabletten Propecia Alicante  Antabuse Online Usa Manufacturing Amoxicillin Cialis Y Precio  Cheap Clomid Online Cialis Alcolici Viagra Rezeptfrei Kaufen Apotheke  Sildenafil Shipped Ups Fluoxetine France By Money Order Overseas How Long Does Zithromax Take To Work  Cytotec On Line Cialis In Tschechien Order Medstore  Buy Clomiphene Online Comprobar Con Propecia
    回复 支持 反对

    使用道具 举报

    0

    主题

    276

    帖子

    556

    积分

    高级会员

    Rank: 4

    积分
    556
    chenyingying 发表于 2017-11-3 13:52:38 | 显示全部楼层
    north face jackets
    burberry scarves
    mbt outlet
    ugg outlet
    moncler outlet
    giuseppe zanotti sneakers
    christian louboutin uk
    cheap jordan shoes
    soccer jerseys
    michael kors uk
    cheap jordan shoes
    ugg schweiz
    carrera sunglasses
    nike uk
    ugg boots
    uggs classic boots
    coach factory online
    moncler dunjacka
    coach outlet
    north face jackets
    tory burch outlet
    kate spade outlet
    d&g sunglasses
    coach wallets
    christian louboutin outlet
    cheap nhl jerseys
    hermes birkin bag
    ugg boots
    ugg outlet
    cheap nfl jerseys
    ugg outlet store
    coach outlet
    nike running uk
    ugg boots
    coach bags
    ray ban sunglasses outlet
    ralph lauren polo shirts
    michael kors outlet
    canada goose outlet
    doudoune canada goose
    coach factory outlet
    cheap jordans
    fitflops shoes
    hermes belt outlet
    kate spade outlet online
    chicago blackhawks jersey
    cheap ray ban sunglasses
    manolo blahnik outlet
    uggs outlet
    true religion jeans
    oakley sunglasses cheap
    tory burch outlet
    coach outlet online 70% off
    michael kors
    cheap oakley sunglasses
    adidas outlet clearance
    polo ralph lauren
    montblanc pen
    ray ban sunglasses
    cheap nfl jerseys
    fitflops sale clearance
    coach factory outlet online
    longchamp handbags
    oakley sunglasses outlet
    burberry scarf
    cheap ray ban sunglasses
    canada goose outlet
    ugg outlet
    michael kors outlet clearance
    coach outlet online
    ralph lauren outlet
    canada goose nederland
    nike jordans
    coach outlet 70% off
    nike air max
    uggs uk
    ugg factory outlet
    nike nfl jerseys
    longchamp bags
    adidas wings
    ugg outlet
    north face outlet
    air jordan pas cher
    coach outlet online
    ugg sale
    louis vuitton
    pandora charms
    air max thea
    air max 90
    canada goose jackets
    coach outlet
    michael kors outlet clearance
    nike store
    converse shoes
    longchamp outlet store
    cheap ugg boots
    north face clearance
    ugg outlet online
    ugg boots
    oakley vault
    chenyingying20171103
    回复 支持 反对

    使用道具 举报

    0

    主题

    276

    帖子

    556

    积分

    高级会员

    Rank: 4

    积分
    556
    chenyingying 发表于 2017-11-20 10:16:58 | 显示全部楼层
    回复 支持 反对

    使用道具 举报

    0

    主题

    18

    帖子

    38

    积分

    新手上路

    Rank: 1

    积分
    38
    zzzzz 发表于 2017-11-27 09:20:41 | 显示全部楼层
    fitflops sale
    mont blanc pens
    basketball shoes
    coach outlet online
    armani exchange
    chicago bulls jersey
    houston texans jerseys
    gucci shoes
    nike shoes
    jimmy choo shoes
    jordan shoes
    eagles jerseys
    cheap snapbacks
    cheap jordans
    nike blazer pas cher
    birkenstock sandals
    coach outlet online
    nike blazer
    ed hardy uk
    cheap ray bans
    kate spade sale
    salomon shoes
    jaguars jersey
    polo ralph lauren
    cheap jordan shoes
    coach outlet
    canada goose sale
    miami heat jersey
    nike air huarache
    ugg outlet
    indianapolis colts jerseys
    ugg outlet
    michael kors outlet
    true religion outlet
    ugg outlet
    air jordan uk
    ralph lauren polo
    prada outlet
    nike shoes
    colts jerseys
    coach outlet
    golden state warriors jerseys
    coach factory outlet
    coach outlet store
    jordan shoes
    cheap nhl jerseys
    coach outlet
    christian louboutin sale
    snapbacks wholesale
    nike trainers
    cheap mlb jerseys
    christian louboutin outlet
    pandora outlet
    arizona cardinals jerseys
    cheap oakley sunglasses
    cheap jordans
    tods outlet
    chargers jerseys
    oakley sunglasses wholesale
    kate spade handbags
    oakley sunglasses
    new orleans saints jerseys
    yeezy shoes
    coach factory outlet
    burberry outlet
    cleveland cavaliers jerseys
    ferragamo shoes
    hugo boss outlet
    coach handbags
    nhl jerseys
    jets jersey
    coach factory outlet
    ugg outlet
    dolphins jerseys
    polo ralph lauren outlet
    kate spade outlet
    ed hardy outlet
    nike roshe run
    uggs outlet
    christian louboutin outlet
    tennessee titans jersey
    broncos jerseys
    polo ralph lauren
    hermes belt
    cheap oakley sunglasses
    true religion outlet store
    oklahoma city thunder jerseys
    ugg outlet
    coach outlet store online
    uggs outlet
    ralph lauren outlet
    nike huarache
    polo ralph lauren
    coach outlet
    uggs outlet
    ralph lauren outlet
    nike outlet
    salomon boots
    yeezy boost 350
    michael kors outlet
    zzzzz
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    快速回复 返回顶部 返回列表