zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。Zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
使用邮件发送一些我们关心的zabbix数据图表到邮箱,首先需要从数据库里查询出来我们需要的图形参数:
相应的数据库我们来查询一下:
mysql> desc screens;+------------+---------------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+------------+---------------------+------+-----+---------+-------+| screenid | bigint(20) unsigned | NO | PRI | NULL | || name | varchar(255) | NO | | NULL | || hsize | int(11) | NO | | 1 | || vsize | int(11) | NO | | 1 | || templateid | bigint(20) unsigned | YES | MUL | NULL | |+------------+---------------------+------+-----+---------+-------+####查询ATOP_Report 对应的id####mysql> select screenid from screens where name='ATOP_Report';+----------+| screenid |+----------+| 20 |+----------+###查询该Screens里面的监控图表的id###mysql> select resourceid from screens_items where screenid='20';+------------+| resourceid |+------------+| 692 || 690 || 691 || 689 || 639 || 628 || 625 || 693 || 694 |+------------+
看一则Url例子
http://www.ipython.me/chart2.php?graphid=692&screenid=20&width=500&height=100&legend=1&updateProfile=1&profileIdx=web.screens&profileIdx2=20&period=3600&stime=20141103095819&sid=3ff91ed1192fc59f###为了方便看,它分解后应该是这样的####http://www.ipython.me/chart2.php?graphid=692& graphid --- 对应了前面数据库里查出来的IDscreenid=20& screenid --- 对应了 ATOP_Report 的IDwidth=500& width --- 宽height=100& height --- 高legend=1&updateProfile=1&profileIdx=web.screens&profileIdx2=20&period=3600&stime=20141103095819&sid=3ff91ed1192fc59f
时间关系很粗略的写了一个小脚本来完成邮件发送….代码里面有html….我转了”<”代码就乱了,让程序转 缩进就没了…放文末做附件吧…监控图差不多是这样的