Monitoring system based on nuxt.js

background

A monitoring system built by pure nodejs.

rely

client

  • shelljs
  • node-schedule
  • socket.io-client

server

  • nuxt
  • also
  • element-ui
  • mongoose
  • echarts
  • socket.io

client

By configuring timed tasks, execute shell execution, and then send monitoring information (websocket) to the server.

Collected data

cpu

Collect cpu usage.

Using topinstruction.

Specific instructions:top -b -n 1 | grep Cpu | awk '{print $2}'|cut -f 1

RAM

Including: total memory, used memory, free memory, buffer, cache

Using freeinstruction.

Specific instructions:free -wm | grep "Mem" | awk '{print $2,$3,$4,$6,$7}' OFS=","

Log information

Mainly by monitoring file changes, sending logs to the server.

Mainly based fsinstruction.

The internet

Mainly monitor the download bandwidth and upload bandwidth of the network.

Using iftopinstruction.

Specific instructions:iftop -Pp -Nn -t -L 100 -s 1 -B|grep "Total send rate:"|awk '{print $4}'

Basic situation of the system

Mainly monitor currentTime, runningTime, users and other information.

Using uptimeinstruction.

Specific instructions: uptime

Monitor the status of the running program

The main monitoring is the cpu occupancy rate and memory occupancy of the monitor program.

Specific instructions:top -b -n 1 |grep ${programName}|awk '{print $6,$9}' OFS=","

server

The main function

dashboard

Display client real-time information (data uploaded by websocket in real time).

Node configuration

Mainly configure the client information, the IP information of the client that needs to be monitored.

history record

Mainly record the history of the dashboard

Log

The log log of the main recording program

DOC

Monitoring indicators

  • The amount of PV and UV for accessing a specific domain name
  • The hardware of the machine (CPU, memory, disk, etc.)
  • Information about the number of requests and response time for each URL under a specific domain name

Core functions

  • Collect information, there are programs dedicated to collecting information to collect information
  • Store information, store the collected information in the mongo database
  • Display information, use echarts to graph the information
  • Clear information, no need to clear long-term stored information regularly

Access to information

Nginx information acquisition uses the open source project OpenResty

Partial screenshot

Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here

github address

client: https://github.com/bosscheng/node-monitor-client

server: https://github.com/bosscheng/node-monitor-server

Guess you like

Origin blog.csdn.net/wancheng815926/article/details/105627619