设为首页 收藏本站
查看: 6275|回复: 2

[经验分享] 使用zabbix监控db2配置Leverage Zabbix to Monitor DB2

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-3-31 09:39:26 | 显示全部楼层 |阅读模式

Zabbix-logo.png

Recently I have been building and configuring an open source product by the name of Zabbix. Zabbix is an enterprise level software designed for monitoring availability and  performance of IT infrastructure components.

One of our customers would like to use Zabbix to monitor an IBM DB2 database with minimal configuration. What is meant by minimal configuration is that the customer would like to utilise an existing Zabbix template for DB2 and hopefully not spend any time developing a custom script for this purpose.

Out of the box Zabbix provides a sizeable number of templates for monitoring different aspects of IT infrastructure such as Windows OS and Linux OS. Each template may contain entities such as items, triggers, graphs and various others. However there was no template for DB2 provided out of the box. As Zabbix is open source it is possible through use of custom scripts to monitor pretty much anything you can think of as long as you are willing to spend a large chunk of time creating scripts.

However, time is a precious commodity to myself and I see no reason to reinvent the wheel if someone has already put the time and effort to create a DB2 template.

A quick Google brought up the following web page:

https://www.zabbix.com/wiki/templates/db2_linux_template

This webpage provided a link to download the template, the link itself is from a out of date Zabbix wiki (the new Wiki does not contain this template). The template was unzipped, imported and the instructions followed to the letter from the accompanying readme.

The template was deployed to the server where the DB2 database resides. It was on viewing the host in the GUI that I realised all was not well in this template.

db2-JSON-problem-edit-no-name.png

From the above image under the “Info” column you can see a red cross, by hovering the mouse on the cross this informs me what the problem is.

JSON-problem.png

The problem is identified as “Value should be a JSON object”. What this means is that the JSON object used to return DB2 objects to Zabbix is malformed. This meant that the discovery was not completing.  By cranking up the Zabbix Agent log to debug level 4 I can view the JSON being passed back to the server.

JSON-problem-in-log.png

After peering for what seemed like an age at this JSON object (but in reality was minutes) I spotted the culprit. There was a “,” (comma) on the line that specified the “{#TSTYPE}” object.

To send the JSON objects back to the server a script was placed on the server where the Zabbix agent that monitors the DB2 database resides. The script was named db2_parser.pl and was part of the DB2 template that was downloaded.

On examining the script in vi, the offending block of code was quickly identified.

code_JSON_error.png

This line:

print “                ”{#TSTYPE}”:”$ts_type”,”;

Needed to be changed to:

print “                ”{#TSTYPE}”:”$ts_type””;

With the comma removed the changes to db2_parser.pl were saved.

On viewing the Zabbix agent log I can see that the JSON object now has the correct format (comma has been removed).

JSON-log-fixed.png

On viewing the host in the GUI I can also see that the red cross is no longer present in the “Info” column.

JSON-fixxed-DB2-template-edit.png Now that the discovery is working I can see the various Items that have been created based on the DB2 tablespaces from the DB2 database.

DB2_items_test-edit.png

Future blogs will explore other monitoring capabilities of Zabbix covering areas such as SNMP and Service Now integration.

https://sourceforge.net/projects/db2bix/


http://www.smartmarmot.com/product/db2bix/


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-198040-1-1.html 上篇帖子: Python调用ZabbixAPI将后台数据展示到百度地图上 下篇帖子: zabbix 监控 Tomcat 监控

尚未签到

发表于 2017-11-19 23:56:10 | 显示全部楼层
你好,你发的这个网站访问不了了,能否将你说的压缩包发一份呢,万分感谢!邮箱:457504208@qq.com

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

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

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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