Grafana, COLLECTD and InfluxDB create cool surveillance Systems (iv) Introduction to common plug-ins and custom data articles

Source: Internet
Author: User
Tags curl urlencode grafana influxdb

First, the introduction of common plug-ins

Gets the connection status of the specified port established, close_wait, listen, etc.

Tcpconns:

<plugin tcpconns>

Listeningports false

LocalPort "80"

RemotePort "80"

</Plugin>


Get the status of Nginx

Nginx:

<plugin nginx>

URL "Http://test.tt.com/NginxStatus"

</Plugin>



Ping:

<plugin ping>

Host "172.18.2.125"

Interval 10.0

Timeout 1.0

</Plugin>


Get the traffic for the NIC

Interface

<plugin interface>

Interface "Eth0"

</Plugin>


The following plugin directly cancels the comment

Cpu

Load

Memory

Processes




Ii. operating the database via the HTTP API of INFLUXDB
1. Create a database
#curl-G http://172.18.1.113:8086/query--data-urlencode "Q=create DATABASE mydb"

2. Inserting data
#插入单条数据
#curl-I-xpost ' http://172.18.1.113:8086/write?db=mydb '--data-binary ' cpu_load_short,host=server01,region=us-west value=0.66 '

#一次插入多条数据提高效率
#curl-I-xpost ' http://172.18.1.113:8086/write?db=mydb '--data-binary ' Cpu_load_short,host=server02 value=0.67
Cpu_load_short,host=server02,region=us-west value=0.55
Cpu_load_short,direction=in,host=server01,region=us-west value=2.0 '

#将数据写入文件一次性插入
#curl-I-xpost ' http://172.18.1.113:8086/write?db=mydb '--data-binary @test. txt
#cat Test.txt
Cpu_load_short,host=server02 value=0.67
Cpu_load_short,host=server02,region=us-west value=0.75
Cpu_load_short,direction=in,host=server01,region=us-west value=7.0

3. Querying data
#curl-G ' http://172.18.1.113:8086/query?pretty=true '--data-urlencode "Db=mydb"--data-urlencode "Q=select value from Cpu_load_short WHERE region= ' us-west ' "

Querying using the command line

#influx > Show databases;name:databases---------------name_internalcollectdgrafanamydb> use COLLECTD; Using database collectd> SELECT * From/load/where host= ' t125 ' limit 2;name:load_longterm-------------------timehost Typevalue1456453923000000000t125load01456453933000000000t125load0name:load_ Midterm------------------Timehosttypevalue1456453923000000000t125load01456453933000000000t125load0name:load_ ShortTerm--------------------timehosttypevalue1456453923000000000t125load01456453933000000000t125load0


Third, custom monitoring data

Example: Monitoring the response time of a site

#!bin/bashtime= ' Curl-o/dev/null-s-w%{time_connect}:%{time_starttransfer}:%{http_code}--connect-timeout http:/ /www.baidu.comtime_connect= ' echo $time |cut-d ': '-f1 ' time_starttransfer= ' echo $time |cut-d ': '-f2 ' http_code= ' echo $ Time|cut-d ': '-f3 ' response_time= ($ (echo $time _starttransfer-$time _connect|bc)) curl-i-xpost ' http://127.0.0.1:8086 /write?db=collectd '--data-binary ' oss_web,url=$1,type=response_time value= $response _timeoss_web,url=$1,type=time _connect value= $time _connectoss_web,url=$1,type=time_starttransfer value= $time _starttransfeross_web,url=$1,type= Http_code value= $http _code "

Join the scheduled task one minute to execute. Then go to the Grafana drawing

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7D/19/wKiom1bf44iCyTa1AAEpBjfTU04364.png "title=" Qq20160309164823.png "alt=" Wkiom1bf44icyta1aaepbjftu04364.png "/>

This article is from the "No Technology Madness" blog, please be sure to keep this source http://s8576.blog.51cto.com/9510968/1749196

Grafana, COLLECTD and InfluxDB create cool surveillance Systems (iv) Introduction to common plug-ins and custom data articles

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.