Skip to main content

monitors

Build Status PyPI PyPI - Python Version GitHub top language Downloads GitHub stars https://blog.csdn.net/flower_drop

仓库地址:

背景介绍

专项测试,桌面端应用程序使用过程中,对CPU,内存,磁盘使用率,网络流量进行监控并展现.

解决方案

需求梳理

  1. 简单方便 傻瓜式操作
  2. 数据持久化,数据可保存
  3. 数据可视化,清晰明了

解决方案来了,如下

minitor作为监控服务,influxdb做为数据收集,Grafana图表可视化展示,干就完了!

前提准备

  1. 你需要安装好 influxdb
  2. 你还需要安装好 grafana

看到这,你是不是又慌乱了,怎么还需要这么多准备工作。莫慌,教程都给你准备好了,乖,张开嘴,吃~

安装服务

pip install -U monitors

启动服务

# -*- coding: utf-8 -*-
"""
@Project :monitors 
@File    :monitor.py
@Author  :lijiawei
@Date    :2021/9/6 4:13 下午 
"""

from monitors.monitor_set import Settings as ST
import argparse


parser = argparse.ArgumentParser(description='manual to this script')
parser.add_argument("-name", type=str)

args = parser.parse_args()
name = args.name

# 服务端ip
ST.host = '127.0.0.1'
# influxdb 端口
ST.port = 8086
# influxdb 账号
ST.password = '*********'
# influxdb 数据库
ST.database = 'test_database'
# Grafana apikey
ST.apikey = '********'
# influxdb 表
ST.table = name

from monitors.monitor_util import monitor_on

monitor_on()

注意:脚本内容禁止任何修改!

运行命令

python monitor.py -name=test_monitor

参数说明:name 必须为唯一值

查看结果

打开 Grafana url 登录后 查看监控图表

Grafana账号密码:test/test

停止监控

按下 CTRL + C,监控服务已停止!

后续方案

在推广使用过程中,发现尽管已经做的如此简单,还是有同学不会使用,一步三个坑,后续我计划把【minitors】监控服务,打包成可执行文件,有完整的页面交互,防止大家掉坑!

视频分析

          点击应用图标              弹窗1   关闭弹窗1     欢迎页     滑动欢迎页    弹窗2    关闭弹窗2   首页
              ^                     ^                   ^                     ^                  ^ 
              |                     |                   |                     |                  |
              |---------logo1-------|-------logo2-------|--------.......------|------......------|

稳定阶段(个): 2         1          1         1          1                     1                  2

              |                     |                   |                     |                  |
              v                     v                   v                     v                  v
              A                     B                   C                     D                  E

以上便是 monitors 的基本用法介绍。

如果您有发现错误,或者您对 monitors 有任何建议,欢迎到 monitors Issues 发表,非常感谢您的支持。您的反馈和建议非常宝贵,希望您的参与能帮助 monitors 做得更好。

Metadata

Release files for monitors 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for monitors 1.1.2
File Size Uploaded Provenance Actions
monitors-1.1.2.tar.gz 50.4 kB Without provenance Details for monitors-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for monitors 1.1.2
File Interpreter ABI Platform Actions
monitors-1.1.2-py3-none-any.whl Python 3 none any Details for monitors-1.1.2-py3-none-any.whl

Total release size: 109.5 kB

Release files / monitors-1.1.2.tar.gz

Download URL monitors-1.1.2.tar.gz
Size 50.4 kB
Tags Source
SHA-256 checksum
How to use checksums
510571e985acd172344e864b8495e46b7a494ea629a21146d94fcceeca87fc8c
BLAKE2b-256 checksum
How to use checksums
8b5dbdcb16ba6681a10184a14f789de23110dab940c876d12d3dd4d4a2dc6f2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / monitors-1.1.2-py3-none-any.whl

Download URL monitors-1.1.2-py3-none-any.whl
Size 59.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3547363632ded3481101623c76c60b999d07a2425943e181649183457dfabd7
BLAKE2b-256 checksum
How to use checksums
78db7e69dc7df509553ecd040c15c50550d970c1c58d7b6db3ee2034ff5a015d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for monitors 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page