性能监控之Telegraf+InfluxDB+Grafana window服务器安装使用

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
简介: 【6月更文挑战13天】性能监控之Telegraf+InfluxDB+Grafana window服务器安装使用

一、前言

本文主要介绍 Telegraf 在 window 上安装及监控入门

二、安装&部署

1.找到下载地址:https://portal.influxdata.com/downloads/

image.png

2.创建目录 C:\Program Files\Telegraf(如果安装在其他位置,请指定 -config 具有所需位置的参数)
3.解压软件包,将文件 telegraf.exetelegraf.conf 文件放入 C:\Program Files\Telegraf

image.png

4.要将服务安装 到Windows 服务管理器中,以管理员身份在 CMD 中运行以下命令。如有必要,可以用双引号将文件目录中的任何空格换行 "<file directory>"

C:\"Program Files"\Telegraf\telegraf.exe --service install

或者

C:\Program Files\Telegraf>telegraf.exe --service install

image.png

5.编辑 telegraf.conf 配置文件以满足要求。

###############################################################################
#                                  INPUTS                                     #
###############################################################################

# Windows Performance Counters plugin.
# These are the recommended method of monitoring system metrics on windows,
# as the regular system plugins (inputs.cpu, inputs.mem, etc.) rely on WMI,
# which utilize more system resources.
#
# See more configuration examples at:
#   https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters

[[inputs.win_perf_counters]]
  [[inputs.win_perf_counters.object]]
    # Processor usage, alternative to native, reports on a per core.
    ObjectName = "Processor"
    Instances = ["*"]
    Counters = [
      "% Idle Time",
      "% Interrupt Time",
      "% Privileged Time",
      "% User Time",
      "% Processor Time",
      "% DPC Time",
    ]
    Measurement = "win_cpu"
    # Set to true to include _Total instance when querying for all (*).
    IncludeTotal=true

  [[inputs.win_perf_counters.object]]
    # Disk times and queues
    ObjectName = "LogicalDisk"
    Instances = ["*"]
    Counters = [
      "% Idle Time",
      "% Disk Time",
      "% Disk Read Time",
      "% Disk Write Time",
      "Current Disk Queue Length",
      "% Free Space",
      "Free Megabytes",
    ]
    Measurement = "win_disk"
    # Set to true to include _Total instance when querying for all (*).
    #IncludeTotal=false

  [[inputs.win_perf_counters.object]]
    ObjectName = "PhysicalDisk"
    Instances = ["*"]
    Counters = [
      "Disk Read Bytes/sec",
      "Disk Write Bytes/sec",
      "Current Disk Queue Length",
      "Disk Reads/sec",
      "Disk Writes/sec",
      "% Disk Time",
      "% Disk Read Time",
      "% Disk Write Time",
    ]
    Measurement = "win_diskio"

  [[inputs.win_perf_counters.object]]
    ObjectName = "Network Interface"
    Instances = ["*"]
    Counters = [
      "Bytes Received/sec",
      "Bytes Sent/sec",
      "Packets Received/sec",
      "Packets Sent/sec",
      "Packets Received Discarded",
      "Packets Outbound Discarded",
      "Packets Received Errors",
      "Packets Outbound Errors",
    ]
    Measurement = "win_net"

  [[inputs.win_perf_counters.object]]
    ObjectName = "System"
    Counters = [
      "Context Switches/sec",
      "System Calls/sec",
      "Processor Queue Length",
      "System Up Time",
    ]
    Instances = ["------"]
    Measurement = "win_system"
    # Set to true to include _Total instance when querying for all (*).
    #IncludeTotal=false

  [[inputs.win_perf_counters.object]]
    # Example query where the Instance portion must be removed to get data back,
    # such as from the Memory object.
    ObjectName = "Memory"
    Counters = [
      "Available Bytes",
      "Cache Faults/sec",
      "Demand Zero Faults/sec",
      "Page Faults/sec",
      "Pages/sec",
      "Transition Faults/sec",
      "Pool Nonpaged Bytes",
      "Pool Paged Bytes",
      "Standby Cache Reserve Bytes",
      "Standby Cache Normal Priority Bytes",
      "Standby Cache Core Bytes",

    ]
    # Use 6 x - to remove the Instance bit from the query.
    Instances = ["------"]
    Measurement = "win_mem"
    # Set to true to include _Total instance when querying for all (*).
    #IncludeTotal=false

  [[inputs.win_perf_counters.object]]
    # Example query where the Instance portion must be removed to get data back,
    # such as from the Paging File object.
    ObjectName = "Paging File"
    Counters = [
      "% Usage",
    ]
    Instances = ["_Total"]
    Measurement = "win_swap"

6.要验证它是否有效,请运行:

C:\"Program Files"\Telegraf\telegraf.exe --config C:\"Program Files"\Telegraf\telegraf.conf --test

或者

C:\Program Files\Telegraf>telegraf.exe --config telegraf.conf --test

要开始收集数据,请运行:

net start telegraf

7.其他操作
telegraf 可以通过 --service 管理自己的服务:

telegraf.exe --service install        #安装服务
telegraf.exe --service uninstall    #删除服务
telegraf.exe --service start        #启动服务
telegraf.exe --service stop            #停止服务

三、集成Influxdb

找到 OUTPUTS 配置项

###############################################################################
#                                  OUTPUTS                                    #
###############################################################################

# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple URLs can be specified for a single cluster, only ONE of the
  ## urls will be written to each interval.
  # urls = ["unix:///var/run/influxdb.sock"]
  # urls = ["udp://127.0.0.1:8089"]
  urls = ["http://172.16.14.111:8086"]

  ## The target database for metrics; will be created as needed.
  database = "bigscreen"

  ## If true, no CREATE DATABASE queries will be sent.  Set to true when using
  ## Telegraf with a user without permissions to create databases or when the
  ## database already exists.
  # skip_database_creation = false

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.  Only takes effect when using HTTP.
  # retention_policy = ""

  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
  ## Only takes effect when using HTTP.
  # write_consistency = "any"

  ## Timeout for HTTP messages.
  timeout = "5s"

  ## HTTP Basic Auth
   username = "telegraf"
   password = "telegraf"

  ## HTTP User-Agent
  # user_agent = "telegraf"

  ## UDP payload size is the maximum packet size to send.
  # udp_payload = "512B"

  ## Optional TLS Config for use on HTTP connections.
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## HTTP Proxy override, if unset values the standard proxy environment
  ## variables are consulted to determine which proxy, if any, should be used.
  # http_proxy = "http://corporate.proxy:3128"

  ## Additional HTTP headers
  # http_headers = {"X-Special-Header" = "Special-Value"}

  ## HTTP Content-Encoding for write request body, can be set to "gzip" to
  ## compress body or "identity" to apply no encoding.
  # content_encoding = "identity"

  ## When true, Telegraf will output unsigned integers as unsigned values,
  ## i.e.: "42u".  You will need a version of InfluxDB supporting unsigned
  ## integer values.  Enabling this option will result in field type errors if
  ## existing data has been written.
  # influx_uint_support = false

验证数据库

[root@localhost tools]# sudo influx
Connected to http://localhost:8086 version 1.7.4
InfluxDB shell version: 1.7.4
Enter an InfluxQL query
> use bigscreen
Using database bigscreen
> SHOW MEASUREMENTS
name: measurements
name
----
bigscreen
nvidia_smi
win_cpu
win_disk
win_diskio
win_mem
win_net
win_perf_counters
win_swap
win_system
> SELECT * FROM "win_cpu" limit 1
name: win_cpu
time                Percent_DPC_Time Percent_Idle_Time Percent_Interrupt_Time Percent_Privileged_Time Percent_Processor_Time Percent_User_Time  host            instance objectname
----                ---------------- ----------------- ---------------------- ----------------------- ---------------------- -----------------  ----            -------- ----------
1552012501000000000 0                81.72647857666016 0                      4.6642279624938965      9.824928283691406      4.6642279624938965 DESKTOP-MLD0KTS 0        Processor

四、集成Grafana Dashboard

访问 https://grafana.com/dashboards?dataSource=influxdb&collector=Telegraf&search=window 下载一个合适的 Dashboard 模版

image.png

Grafana 导入 Dashboard 模版

具体请参考 [性能监控之Telegraf+InfluxDB+Grafana服务器实时监控]

五、监控效果

Grafana Dashboard 最终效果如下:
image.png

相关资料:

相关实践学习
通过可观测可视化Grafana版进行数据可视化展示与分析
使用可观测可视化Grafana版进行数据可视化展示与分析。
目录
相关文章
|
3月前
|
监控 Java 时序数据库
性能监控之Telegraf+InfluxDB+Grafana实现JMX实时监控
【6月更文挑战15天】性能监控之Telegraf+InfluxDB+Grafana实现JMX实时监控
135 6
性能监控之Telegraf+InfluxDB+Grafana实现JMX实时监控
|
1月前
|
存储 Linux 数据库
性能工具之JMeter + Grafana + InfluxDB 性能平台搭建
【8月更文挑战第7天】性能工具之JMeter + Grafana + InfluxDB 性能平台搭建
56 1
性能工具之JMeter + Grafana + InfluxDB 性能平台搭建
|
1月前
|
Prometheus 监控 Cloud Native
性能监控之 node_exporter+Prometheus+Grafana 实现主机监控
【8月更文挑战第3天】性能监控之 node_exporter+Prometheus+Grafana 实现主机监控
143 0
|
1月前
|
数据采集 监控 Unix
性能监控之Telegraf+InfluxDB+Grafana实现结构化日志实时监控
【8月更文挑战第1天】性能监控之Telegraf+InfluxDB+Grafana实现结构化日志实时监控
191 0
|
3月前
|
Prometheus 监控 Cloud Native
性能监控神器Prometheus、Grafana、ELK 在springboot中的运用
【6月更文挑战第27天】在 Spring Boot 应用中,监控和日志管理是确保系统稳定性和性能的重要手段。
151 4
|
3月前
|
监控 Oracle 关系型数据库
性能监控之Telegraf+InfluxDB+Grafana+Python实现Oracle实时监控
【6月更文挑战14天】性能监控之Telegraf+InfluxDB+Grafana+Python实现Oracle实时监控
69 2
|
17天前
|
Cloud Native Java 编译器
将基于x86架构平台的应用迁移到阿里云倚天实例云服务器参考
随着云计算技术的不断发展,云服务商们不断推出高性能、高可用的云服务器实例,以满足企业日益增长的计算需求。阿里云推出的倚天实例,凭借其基于ARM架构的倚天710处理器,提供了卓越的计算能力和能效比,特别适用于云原生、高性能计算等场景。然而,有的用户需要将传统基于x86平台的应用迁移到倚天实例上,本文将介绍如何将基于x86架构平台的应用迁移到阿里云倚天实例的服务器上,帮助开发者和企业用户顺利完成迁移工作,享受更高效、更经济的云服务。
将基于x86架构平台的应用迁移到阿里云倚天实例云服务器参考
|
15天前
|
编解码 前端开发 安全
通过阿里云的活动购买云服务器时如何选择实例、带宽、云盘
在我们选购阿里云服务器的过程中,不管是新用户还是老用户通常都是通过阿里云的活动去买了,一是价格更加实惠,二是活动中的云服务器配置比较丰富,足可以满足大部分用户的需求,但是面对琳琅满目的云服务器实例、带宽和云盘选项,如何选择更适合自己,成为许多用户比较关注的问题。本文将介绍如何在阿里云的活动中选择合适的云服务器实例、带宽和云盘,以供参考和选择。
通过阿里云的活动购买云服务器时如何选择实例、带宽、云盘
|
14天前
|
弹性计算 运维 安全
阿里云轻量应用服务器和经济型e实例区别及选择参考
目前在阿里云的活动中,轻量应用服务器2核2G3M带宽价格为82元1年,2核2G3M带宽的经济型e实例云服务器价格99元1年,对于云服务器配置和性能要求不是很高的阿里云用户来说,这两款服务器配置和价格都差不多,阿里云轻量应用服务器和ECS云服务器让用户二选一,很多用户不清楚如何选择,本文来说说轻量应用服务器和经济型e实例的区别及选择参考。
阿里云轻量应用服务器和经济型e实例区别及选择参考
|
15天前
|
机器学习/深度学习 存储 人工智能
阿里云GPU云服务器实例规格gn6v、gn7i、gn6i实例性能及区别和选择参考
阿里云的GPU云服务器产品线在深度学习、科学计算、图形渲染等多个领域展现出强大的计算能力和广泛的应用价值。本文将详细介绍阿里云GPU云服务器中的gn6v、gn7i、gn6i三个实例规格族的性能特点、区别及选择参考,帮助用户根据自身需求选择合适的GPU云服务器实例。
阿里云GPU云服务器实例规格gn6v、gn7i、gn6i实例性能及区别和选择参考