Git Product home page Git Product logo

server-info-influxdb's Introduction

needkk  server-info-influxdb 

动态展示服务器cpu,内存等占用情况
demo: http://server-info.needkk.com

server-info

1.Acknowledgements

2.使用说明

  • node版本 > v13
  • golang版本 >= v1.16
  • java版本 > jdk1.8
  • influxdb版本 1.x

2.1.influxdb安装

2.2.influxdb-java安装

cd influxdb-java
mvn clean 
mvn install

2.3.influxdb-go安装

cd influxdb-go
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go env -w CGO_ENABLED=0
go mod tidy
go build -o server .

2.4.server-info-web安装

cd server-info-web
npm install
npm run serve

3.技术选型

  • golang:用 Gin 快速搭建基础restful风格API,通过单独的携程每5s将服务器信息存入influxdb
  • java:通过springboot搭建restful风格API,通过定时任务和线程池异步将服务器信息存入influxdb
  • web:通过vue2+elementui+echarts构建简单的图表页面

4.完善

golang读取服务器信息详情信息 ===>

完整参数

参数解读 
goos: 操作系统 
numCpu: CPU逻辑处理器数
compiler: GCC编译器
goVersion: golang版本
numGoroutine: 当前goroutine数量
cpus: 各CPU核心使用情况
cores: CPU内核
ram:内存
    usedMb: 使用内存数MB
    totalMb: 总内存大小MB
    usedPercent: 内存使用占比
disk
    usedMb: 当前磁盘使用MB
    usedGb: 当前磁盘使用GB
    totalMb: 当前磁盘总MB
    totalGb: 当前磁盘总GB
    usedPercent: 当前磁盘使用占比
{
  "os": {
    "goos": "windows",
    "numCpu": 16,
    "compiler": "gc",
    "goVersion": "go1.16.2",
    "numGoroutine": 1
  },
  "cpu": {
    "cpus": [
      0,
      0,
      7.142857142857142,
      0,
      21.428571428571427,
      0,
      21.428571428571427,
      0,
      0,
      0,
      0,
      7.142857142857142,
      0,
      0,
      7.142857142857142,
      7.142857142857142
    ],
    "cores": 8
  },
  "ram": {
    "usedMb": 10514,
    "totalMb": 32678,
    "usedPercent": 32
  },
  "disk": {
    "usedMb": 188519,
    "usedGb": 184,
    "totalMb": 339465,
    "totalGb": 331,
    "usedPercent": 55
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.