# linux_collection **Repository Path**: 7474748g/linux_collection ## Basic Information - **Project Name**: linux_collection - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-11 - **Last Updated**: 2025-10-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 开发 ## 安装uv ``` pip install uv ``` ## 同步依赖 ``` uv sync --reinstall ``` ## 打包采集脚本 PS:需要针对不同系统打包 ``` uv run pyinstaller build.spec ``` # 示例信息 ## 采集json示例 1、静态信息:[static_info_demo.json](static_info_demo.json) 2、动态信息:[dynamic_info_demo.json](dynamic_info_demo.json) ## 配置文件示例 ``` { "organization": "DefaultOrg", # 组织结构 "collection_interval": 30, # 采集间隔(秒) "kafka_host": ["39.96.165.141:9092"], # kafka地址(删除该字段则不投递消息) "topic": "monitor-data-topic", # 消息投递的topic "log_directory": "./logs" # 落盘日志文件夹路径 } ``` # 使用方法 ## 信息采集依赖的linux工具 请确保使用此工具的linux系统中包含如下的工具 1、dmidecode 2、lshw 3、iproute ## 注册服务 ### 设置执行权限 ``` chmod +x service_manager.sh ``` ### 1. 安装无参数的服务(不推荐使用,此方式会使用默认的config.json作为配置文件) ``` sudo ./service_manager.sh install gpu-monitor ./sysmonitor ``` ### 2. 安装带单个参数的服务 ``` sudo ./service_manager.sh install gpu-monitor ./sysmonitor --config-file /root/config.json ``` ### 5. 查看服务状态 ``` sudo ./service_manager.sh status gpu-monitor ``` ### 6. 查看服务日志 ``` sudo ./service_manager.sh logs gpu-monitor ``` ### 7. 卸载服务 ``` sudo ./service_manager.sh uninstall gpu-monitor ```