Zabbix Customizing Item monitoring items

Source: Internet
Author: User
Tags character set create database

Now many companies like to use Zabbix to do monitoring, in the actual use, we have a lot of program content to monitor, such as I need to monitor the company user registration amount, and the template does not have the relevant item, so that beginners can not start, So today I'm going to show you how to use Zabbix to monitor the customization of item.

1. Then monitor the total number of users registered, is the monitoring end of the host in the database to store the user ID in this table, then create the relevant test database, here is a simple list

CREATE DATABASE ' demotest ' CHARACTER SET UTF8 COLLATE utf8_general_ci; #创建数据库

CREATE TABLE ' demotest '. ' User ' (' id ' int (6) Not NULL auto_increment, ' userid ' int () ', ' username ' VARCHAR '), ' password ' INT (n), PRIMARY KEY (' id ')) engine=innodb Charset=utf8 collate=utf8_general_ci; #创建表, as shown below


2. Open the Allow monitoring file path entry in the monitoring side zabbix_server.conf, in the Share folder under the Zabbix installation path



3. Enable custom monitoring entries in the monitored end zabbix_agentd.conf



4. Create the monitor footstep file getcountfromuser.sh in the path specified in the monitored side, that is, the Footstep file path in step 1. This uses the shell.

#!/bin/bash
Mysql= ' which MySQL '
Mysql_host=localhost
Mysql_user=root
mysql_password= "Admin"
mysql_port=3306
Ia= ' $MYSQL-H $MYSQL _host-u $MYSQL _user-p$mysql_password-p$mysql_port-e "Select COUNT (*) Fromdemotest.user" '
echo $IA | awk ' {print $} '


5. Edit the monitored end zabbix_agent.conf configuration file, add the following at the end of the text, where Script.getcountfromuser is item key.


Unsafeuserparameters=1
userparameter=script.getcountfromuser,/usr/local/share/zabbix/sh/getcountfromuser.sh


6. Create the item on the web side and create the related graphs.

Create Item


Create graphs



7. View the chart and monitor the total number of tables, in other words, monitor the user's growth process.





。 In this Zabbix, the custom monitoring is complete,


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.