Collectd 和 InfluxDB 的部署和使用
更新软件包
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo reboot
安装influxdb
hanwei@ubuntu-lab:~$ wget https://dl.influxdata.com/influxdb/releases/influxdb_1.2.4_amd64.deb
--2017-06-14 16:37:09-- https://dl.influxdata.com/influxdb/releases/influxdb_1.2.4_amd64.deb
Resolving dl.influxdata.com (dl.influxdata.com)... 52.84.167.167, 52.84.167.39, 52.84.167.178, ...
Connecting to dl.influxdata.com (dl.influxdata.com)|52.84.167.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17305080 (17M) [application/x-debian-package]
Saving to: ‘influxdb_1.2.4_amd64.deb’
influxdb_1.2.4_amd64.deb 100%[========================================================>] 16.50M 875KB/s in 19s
2017-06-14 16:37:29 (874 KB/s) - ‘influxdb_1.2.4_amd64.deb’ saved [17305080/17305080]
hanwei@ubuntu-lab:~$ sudo dpkg -i influxdb_1.2.4_amd64.deb
[sudo] password for hanwei:
Selecting previously unselected package influxdb.
(Reading database ... 63342 files and directories currently installed.)
Preparing to unpack influxdb_1.2.4_amd64.deb ...
Unpacking influxdb (1.2.4-1) ...
Setting up influxdb (1.2.4-1) ...
Created symlink from /etc/systemd/system/influxd.service to /lib/systemd/system/influxdb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/influxdb.service to /lib/systemd/system/influxdb.service.
Processing triggers for man-db (2.7.5-1) ...
hanwei@ubuntu-lab:~$ service influxdb start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'influxdb.service'.
Authenticating as: hanwei,,, (hanwei)
Password:
==== AUTHENTICATION COMPLETE ===
hanwei@ubuntu-lab:~$ service influxdb status
● influxdb.service - InfluxDB is an open-source, distributed, time series database
Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2017-06-14 16:50:05 CST; 4s ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 2156 (influxd)
Tasks: 7
Memory: 4.9M
CPU: 49ms
CGroup: /system.slice/influxdb.service
└─2156 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
修改influxdb配置文件
hanwei@ubuntu-lab:~$ vim /etc/influxdb/influxdb.conf
[admin]
# Determines whether the admin service is enabled.
# enabled = false
# The default bind address used by the admin service.
# bind-address = ":8083"
# Whether the admin service should use HTTPS.
# https-enabled = false
修改成
enabled = true
bind-address = ":8083"
在infuxdb创建数据库Collectd
两种方式CLI或者web ui
http://192.168.206.144:8086/query?q=CREATE+DATABASE+%22collectd%22&db=collectd
或者用web ui
安装 Collectd
$ sudo apt-get install collectd
配置 Collectd 为客户端,收集到数据后直接发给 InfluxDB
$ sudo vi /etc/collectd/collectd.conf
...
LoadPlugin network
...
<Plugin network>
Server "192.168.2.183" "25826"
</Plugin>
...
重启 Collectd:
$ sudo /etc/init.d/collectd restart
配置 InfluxDB 自带的 Collectd 插件
InfluxDB 自带的 Collectd 插件默认是关闭的,需要手动配置打开 enabled = true,并填上 database = “collectd” 这一行,这里的 “collectd” 就是我们上面创建的那个数据库,更改配置后记得重启 InfluxDB
$ sudo vim /etc/influxdb/shared/influxdb.conf
...
# Configure the collectd api
[input_plugins.collectd]
enabled = true
# address = "0.0.0.0" # If not set, is actually set to bind-address.
# port = 25826
database = "collectd"
# types.db can be found in a collectd installation or on github:
# https://github.com/collectd/collectd/blob/master/src/types.db
# typesdb = "/usr/share/collectd/types.db" # The path to the collectd types.db file
...
hanwei@ubuntu-lab:~$ sudo service influxdb restart
检查一下服务器上打开的端口就会发现 influxdb 插件启动了一个 25826 端口,如果发现 InfluxDB 数据库里没有(收集到)数据,务必检查这个 25826 端口是否正常启动了
hanwei@ubuntu-lab:~$ sudo netstat -tupln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1649/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1308/sshd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1437/postgres
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1740/0
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 10471/1
tcp6 0 0 :::8083 :::* LISTEN 10490/influxd
tcp6 0 0 :::8086 :::* LISTEN 10490/influxd
tcp6 0 0 :::22 :::* LISTEN 1308/sshd
tcp6 0 0 :::8088 :::* LISTEN 10490/influxd
tcp6 0 0 ::1:5432 :::* LISTEN 1437/postgres
tcp6 0 0 ::1:6010 :::* LISTEN 1740/0
tcp6 0 0 ::1:6011 :::* LISTEN 10471/1
udp 0 0 0.0.0.0:53466 0.0.0.0:* 10239/collectd
udp 0 0 192.168.122.1:53 0.0.0.0:* 1649/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1649/dnsmasq
udp 0 0 0.0.0.0:68 0.0.0.0:* 1250/dhclient
udp6 0 0 :::25826 :::* 10490/influxd
检查InfluxDB是否有Collectd 传来的数据
InfluxDB 已经准备好接受和处理 Collectd 传来的数据了。用命令行或者 Web 管理界面验证一下数据库里是否有数据
hanwei@ubuntu-lab:~$ influx
Connected to http://localhost:8086 version 1.2.4
InfluxDB shell version: 1.2.4
> show databases;
name: databases
name
----
_internal
mydb
> use collectd
Using database collectd
> show measurements
name: measurements
name
----
cpu_value
df_value
disk_io_time
disk_read
disk_value
disk_weighted_io_time
disk_write
entropy_value
interface_rx
interface_tx
irq_value
load_longterm
load_midterm
load_shortterm
memory_value
processes_value
swap_value
users_value
> SELECT * from cpu_value
...
7435180464451600 ubuntu-lab.localdomain 0 cpu nice 722
1497435180464452775 ubuntu-lab.localdomain 0 cpu interrupt 0
1497435180464454083 ubuntu-lab.localdomain 0 cpu softirq 339
1497435180464454592 ubuntu-lab.localdomain 0 cpu steal 0
1497435180464455103 ubuntu-lab.localdomain 0 cpu idle 592750
1497435190462593838 ubuntu-lab.localdomain 0 cpu user 4281
1497435190462598610 ubuntu-lab.localdomain 0 cpu system 5599
1497435190462600580 ubuntu-lab.localdomain 0 cpu wait 7799
1497435190462602296 ubuntu-lab.localdomain 0 cpu nice 722
1497435190462603649 ubuntu-lab.localdomain 0 cpu interrupt 0
1497435190462604905 ubuntu-lab.localdomain 0 cpu softirq 339
1497435190462605510 ubuntu-lab.localdomain 0 cpu steal 0
1497435190462606004 ubuntu-lab.localdomain 0 cpu idle 593745
1497435200463552177 ubuntu-lab.localdomain 0 cpu user 4285
1497435200463557277 ubuntu-lab.localdomain 0 cpu system 5608
1497435200463558626 ubuntu-lab.localdomain 0 cpu wait 7799
1497435200463560045 ubuntu-lab.localdomain 0 cpu nice 722
1497435200463561496 ubuntu-lab.localdomain 0 cpu interrupt 0
1497435200463562866 ubuntu-lab.localdomain 0 cpu softirq 339
...
或者web ui
转自:https://www.backendcloud.cn/2017/06/15/collectd-influxdb/
Collectd 和 InfluxDB 的部署和使用的更多相关文章
- 使用 Grafana、collectd 和 InfluxDB 打造现代监控系统
想打造 New Relic 那样漂亮的实时监控系统我们只需要 InfluxDB/collectd/Grafana 这三个工具,这三个工具的关系是这样的: 采集数据(collectd)-> 存储数 ...
- 【监控】使用 Grafana、collectd 和 InfluxDB 打造现代监控系统
参考资料:Grafana 是 Graphite 和 InfluxDB 仪表盘和图形编辑器:http://www.oschina.net/p/grafana 使用 Grafana.collectd 和 ...
- collectd+logstash+influxdb+grafana构建windows服务器应用监控系统
一.背景介绍 本监控方案支持对Windows Server服务器集群的全面监控,方案提供丰富的图表展示, 以及对异常问题进行邮件的实时报警. 本系统由Collectd(操作系统数据搜集).logsta ...
- Influxdb安装部署
1.下载Influxdb并解压 2.下载上图中的nssm(辅助性工具) 3. 在安装目录执行cmd 输入 nssm install influxdb,其中Path选择安装文件中的influxd,Ar ...
- influxDB安装部署及入门
1.下载安装包,本文使用1.7.7版本 https://portal.influxdata.com/downloads/ 2.安装 yum localinstall influxdb-1.7.7.x8 ...
- InfluxDB、grafana、collect部署监控(centos6.8)
collect部署 1.安装 yum install collectd -y 2.配置/etc/collectd.conf LoadPlugin network <Plugin network& ...
- InfluxDB+Grafana大数据监控系列之基础环境部署(一)
一.单节点环境部署 机器节点信息及 InfluxDB.Grafana 版本选择: 节点 Linux版本 部署服务 10.223.1.198 Centos 6.8 InfluxDB 1.7.7 10.2 ...
- 使用collectd+influxdb+grafna监控进程的健康状态
一,前言 本文将介绍如何使用collectd+influxdb+grafna进行进程的监控,监控项为:进程健康状态. 思路为:使用collectd的processes插件进行程序进程的监控,储存到in ...
- Springboot2 Metrics之actuator集成influxdb, Grafana提供监控和报警
到目前为止,各种日志收集,统计监控开源组件数不胜数,即便如此还是会有很多人只是tail -f查看一下日志文件.随着容器化技术的成熟,日志和metrics度量统计已经不能仅仅靠tail -f来查看了,你 ...
随机推荐
- Bzoj 2818: Gcd(莫比乌斯反演)
2818: Gcd Time Limit: 10 Sec Memory Limit: 256 MB Description 给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的 数对 ...
- 如何使用git把本地代码上传到github
Git Bash Here git init git add . git commit -m '说明' git remote add origin https://github.com//.git g ...
- Pytest权威教程13-Fixture方法及测试用例的参数化
目录 Fixture方法及测试用例的参数化 @pytest.mark.parametrize:参数化测试函数 基本的pytest_generate_tests例子 更多示例 返回: Pytest权威教 ...
- win10系统中对本地端口进行简单分析
突然有事情涉及到本地端口,对相关内容进行了了解,这部分知识应该偏向运维,有些不好理解,查起来也零零散散的,理解的可能也有误……只记录一部分东西 想要查看本地端口的情况,在cmd下使用 netstat ...
- CF1209题解
E 每列都可以沿下滚动若干次,使得各行最大值之和最大 对每列的元素计算最大值,降序排,显然取前\(min(n,m)\)个列处理即可 比较巧妙的动规,设\(f(i,S)\)为前\(i\)列,已经确定最大 ...
- 【caffe I/O】数据变换器(图像的预处理部分) 代码注释
caffe.proto中TransformationParameter部分 // Message that stores parameters used to apply transformation ...
- django celery 异步执行任务遇到的坑
部署后,任务没有持久化,所有用supervisor 进行进程管理 安装 pip install supervisor 创建 配置文件 [program:testplatform-flower] com ...
- 深度学习面试题27:非对称卷积(Asymmetric Convolutions)
目录 产生背景 举例 参考资料 产生背景 之前在深度学习面试题16:小卷积核级联卷积VS大卷积核卷积中介绍过小卷积核的三个优势: ①整合了三个非线性激活层,代替单一非线性激活层,增加了判别能力. ②减 ...
- 前端 MV*框架的意义
早期前端都是比较简单,基本以页面为工作单元,内容以浏览型为主,也偶尔有简单的表单操作,基本不太需要框架. 随着 AJAX 的出现,Web2.0的兴起,人们可以在页面上可以做比较复杂的事情了,然后前端框 ...
- 【json/regex】将简单对象生成的json文进行内部排序后再输出
有这样一个实体类: package com.hy; public class Emp { private int id; private int age; private String name; p ...