[docker] single physical machine-multiple physical machines Centralized-Monitoring [ansible-cmdb/netdata/Serverstatus]

Keywords: Nginx Attribute Ruby yum

netdata-monitoring single vm

It is suitable for resource monitoring of single physical machine.

github

docker run -d --cap-add SYS_PTRACE \
           -v /proc:/host/proc:ro \
           -v /sys:/host/sys:ro \
           -p 19999:19999 titpetric/netdata

Serverstatus - Monitor multiple VMS (cs mode - psutil)

Disadvantage: Both the server and the client need to be configured. It does not conform to the large-area use scenario and can be used in different physical machines.

Principle: The server opens a PORT-THE client uses the pstuil script to push and monitor who goes to the server. Then it generates html and puts these html in the nginx directory for users to consult.

  • #### 1. Server Installation
git clone https://github.com/tenyue/ServerStatus.git
cd ServerStatus/server
make

//Attachment:
yum -y install gcc+ gcc-c++
  • 1.2. Modify the server configuration file
{"servers":
    [
        {
            "username": "no132",            # User names and passwords need to be configured on the client side
            "name": "node132.ma.com",       # Node Name: Feels like a tag alias for the host name. 
            "type": "kvm",                  # Virtualization type, Openvs?KVM?Xen?
            "host": "GenericServerHost123", # host name
            "location": "Shenzhen",         # In Los Angeles? New York?
            "password": "123456"            
        },
        {
            "username": "bs01",
            "name": "Backupserver 1",
            "type": "Virtual Server",
            "host": "GenericVPSHost123",
            "location": "Switzerland",
            "password": "some-harder-to-guess-copy-paste-password"
        }
    ]
}
  • 1.3 Run a nginx, put the server's web program in the directory, I ran a docker
mkdir -p /data/nginx-html

docker run  -d \
    --net=host \
    --restart=always \
    -v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \
    -v /etc/localtime:/etc/localtime:ro \
    -v /data/nginx-html:/usr/share/nginx/html \
    --name nginx \
nginx
cp -r ServerStatus/web/* /data/nginx-html
  • 1.4 Start the server (91 for communicating with the client)
./sergate --config=/data/ServerStatus/server/config.json --web-dir=/data/nginx-html/ --port=91



nohup ./sergate --config=/data/ServerStatus/server/config.json --web-dir=/data/nginx-html/ --port=91 &> /dev/null & 
  • ### 2. Installing Client
yum -y install epel-release
yum -y install python-pip
yum clean all
yum -y install gcc
yum -y install python-devel
pip install psutil

And win's client

  • Configuring Client
wget https://raw.githubusercontent.com/tenyue/ServerStatus/master/clients/client-psutil.py
vim client-psutil.py
...
  8 SERVER = "127.0.0.1"
  9 PORT = 91
 10 USER = "no132"
 11 PASSWORD = "123456"
 12 INTERVAL = 1 # update interval
...
  • Start the client
python client-psutil.py

nohup python client-psutil.py &> /dev/null &

ansible-cmdb monitors multiple VMS

Benefits: More detailed, you can see what services are running on each vm. Slip docking with ansible.

Principle: Use ansible to collect machine indicators, generate html, and put it into nginx directory for users to access.

Installation reference

github

Posted by dhruvasagar on Sat, 09 Feb 2019 21:27:18 -0800