Zabbix monitoring the process log configuration process

Source: Internet
Author: User
Tags local time

Monitoring log is an essential part of the daily life of the operation and maintenance personnel, and the log is a process execution of the most important, because the log records the program to eat and drink to run all events, so in troubleshooting, combined with the log to find obstacles is essential! And we're going to take the initiative to be reminded of some key words in the log, such as "error! "Like," warinig!. "Like," alarm!. ", such as" Women's volleyball girl Good you really give the country, see these women's volleyball girls really like a big long leg beauty plus D cup. And Zabbix as a good monitoring software, you can when the above several keywords appear in the first time of the log or alarm or record.


For example, suppose we want to monitor a process log, this process is called Mrs, do not waste time to Baidu this Mrs, this is my company internal use is a program. And the goal is when the error in this mrs.log log, it is necessary to call the police, notify the tragic transport and development of Pl.


First we create an item,

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/86/47/wKioL1e6yIaBKKlFAABq0HD0QFg352.png-wh_500x0-wm_3 -wmp_4-s_1136070319.png "title=" 1.png "alt=" Wkiol1e6yiabkklfaabq0hd0qfg352.png-wh_50 "/>

Note that the type here is activebecause the server being monitored is required to proactively send logs to the server side. And key is written by Log[/mnt/hswx/mrs/logs/mrs.log,error,,,,], I'm here to say a little bit more.


The format for log key is this: Log[file,<regexp>,<encoding>,<maxlines>,<mode>,<output>], The meanings are as follows:

File: file name, write absolute path;

RegExp: to match the regular expression of the content, or directly write what you want to retrieve is also possible, for example, I want to retrieve the record with the error keyword;

Encoding: Coding related, left blank;

Maxlines: The maximum number of rows submitted at a time, this parameter overrides the configuration file zabbxi_agentd.conf in the ' Maxlinespersecond ', we can also leave blank;

Mode: The default is all, or it can be Skip,skip will skip the old data;

Output: Data that is exported to Zabbix server. Can be \1, \2 has been \9,\1 to indicate that the first regular expression matches the content, \2 that the second regular expression matches the wrong content.


Because here we just need to pick out the ERROR statement, the back of those 7788 are not used, so just write log[/mnt/hswx/mrs/logs/mrs.log,error,,,,] just fine.


Log format Select "Log", update every 10 seconds, save 90 days, these are the old adage talk about. As for the log time format written YYYY-MM-DD Hh:mm:ss is a specification of the recording of the timing, we use the format is "year-month-day: Hours-minutes-seconds", you will see the effect.


After writing, save, return to monitoring---lastest Data, find the item we just created,

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/86/47/wKioL1e6yf7wXDRDAABseu2MdjY418.png-wh_500x0-wm_3 -wmp_4-s_2111548442.png "title=" 1.png "alt=" Wkiol1e6yf7wxdrdaabseu2mdjy418.png-wh_50 "/>

Click on the history on the right to see the content.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/47/wKioL1e61rSgVzmUAADQO9CO8i8250.png "title=" 1.png " alt= "Wkiol1e61rsgvzmuaadqo9co8i8250.png"/>

The local time here is the one that we set item to, which is also recorded in the format "year-month-day: hour-minute-second".


We can see that value in the 18:39:53 has an error log, then log on to this server, go to the server mrs.log to see if there is such a log content?

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/48/wKiom1e619mDupIWAABUxMN7xHc690.png "title=" 1.png " alt= "Wkiom1e619mdupiwaabuxmn7xhc690.png"/>

You can see the content is exactly the same, so we have achieved the purpose of monitoring the log!


Then it is based on this item set trigger and action, these things to see personal specific needs I will not repeat.


Of course, some people will have questions, log files in the actual production time is often required to be cut, such as this mrs.log, will not be endless preservation, but will be on time/size cut into Mrs.log.1, mrs.log.2 ..., since this how to do? Then use LOGRT this key, this key is to support the regular expression, in view of the above situation we only need to change the original key to "logrt[/absolute path/mrs.log.*,error,,,,]" can be.


Note, however, that LOGRT can only add regular expressions to the file, which is not supported for the path ~ ~

This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1841193

Zabbix monitoring the process log configuration process

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.