[root@hosts-vm27 ~]# cd /opt/[root@hosts-vm27 opt]# ll
total 135516
drwxr-xr-x 8 root root 294 Oct 2314:06 jdk1.8.0_361
-rw-r--r-- 1 root root 138762230 Oct 2314:05 jdk-8u361-linux-x64.tar.gz
drwxr-xr-x 5 root root 4096 Oct 2222:05 monitor
drwxr-xr-x 4 root root 47 Nov 415:59 rh
drwxr-xr-x 2 root root 106 Nov 1415:16 tar[root@hosts-vm27 opt]# ll monitor/
total 1613284
lrwxrwxrwx 1 root root 15 Oct 2218:51 grafana -> grafana-9.5.10/
drwxr-xr-x 11 root root 227 Oct 2219:00 grafana-9.5.10
-rwxr-xr-x 1 root root 92207343 Oct 2218:49 grafana-enterprise-9.5.10.linux-amd64.tar.gz
-rwxr-xr-x 1 root root 582 Oct 2218:50 install_grafana.sh
-rwxr-xr-x 1 root root 905 Oct 2220:22 install_prome.sh
drwxr-xr-x 2 root root 89 Sep 2920:13 node_exporter-1.3.1.linux-amd64
-rwxr-xr-x 1 root root 9034588 Oct 2218:49 node_exporter-1.3.1.linux-amd64.tar.gz
lrwxrwxrwx 1 root root 29 Oct 2218:52 prometheus -> prometheus-2.37.0.linux-amd64
drwxr-xr-x 5 root root 160 Oct 2221:35 prometheus-2.37.0.linux-amd64
-rwxr-xr-x 1 root root 83782323 Oct 2218:49 prometheus-2.37.0.linux-amd64.tar.gz
-rw-r--r-- 1 root root 1466964485 Oct 2219:45 prometheus26.tar.gz
[root@hosts-vm27 opt]#
2.配置ssh互信
[root@hosts-vm27 opt]# ssh-keygen
Generating public/private rsa key pair.
Enter fileinwhich to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dkkN5HoLFA3w3e0gjaCKJgr6sq8CF2kL76IWU9RJJwA root@hosts-vm27
The key's randomart image is:
+---[RSA 2048]----+
| E..+ooo++o |
| . ooo =.* . |
| .. . o * = . |
|. +o . . o o o |
|o++o. S + . |
|==+ . + . |
|+oo . |
|+o. |
|B*o |
+----[SHA256]-----+
[root@hosts-vm27 opt]#
[root@hosts-vm27 opt]# ssh-copy-id 192.168.1.26
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.26's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.1.26'"
and check to make sure that only the key(s) you wanted were added.
[root@hosts-vm27 opt]#[root@hosts-vm27 opt]# ssh-copy-id 192.168.1.25
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.25's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.1.25'"
and check to make sure that only the key(s) you wanted were added.
[root@hosts-vm27 opt]# ssh-copy-id 192.168.1.24
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.24's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.1.24'"
and check to make sure that only the key(s) you wanted were added.
[root@hosts-vm27 opt]#[root@hosts-vm27 opt]# ssh-copy-id 192.168.1.66
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.66's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.1.66'"
and check to make sure that only the key(s) you wanted were added.
[root@hosts-vm27 opt]#[root@hosts-vm27 opt]#[root@hosts-vm27 opt]# ll /etc/ansible/hosts
-rw-r--r-- 1 root root 1162 Nov 1315:51 /etc/ansible/hosts
[root@hosts-vm27 opt]#[root@hosts-vm27 opt]# tail /etc/ansible/hosts## db-[99:101]-node.example.com[mysql-servers]192.168.1.24
192.168.1.25
192.168.1.26
192.168.1.66
[root@hosts-vm27 opt]#
3.测试网络互通
[root@hosts-vm27 opt]# ansible mysql-servers -m ping[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.66 | SUCCESS =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": false,
"ping":"pong"}192.168.1.25 | SUCCESS =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": false,
"ping":"pong"}192.168.1.26 | SUCCESS =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": false,
"ping":"pong"}192.168.1.24 | SUCCESS =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": false,
"ping":"pong"}
4.创建目录并拷贝node-exporter安装包和脚本
[root@hosts-vm27 opt]# ansible mysql-servers -m command -a "ls -lh /opt"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.66 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 99 Nov 1315:59 tar192.168.1.26 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 99 Nov 1316:03 tar192.168.1.25 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 99 Nov 1316:03 tar192.168.1.24 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 3 root root 27 Nov 1416:50 rh
drwxr-xr-x. 2 root root 203 Nov 1418:09 tar[root@hosts-vm27 opt]#[root@hosts-vm27 opt]# cd monitor/[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m command -a "mkdir -p /opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
[WARNING]: Consider using the file module with state=directory rather than running 'mkdir'. If you need to use command because file is insufficient you can add'warn: false' to this command task or set'command_warnings=False'in ansible.cfg to get rid of this message.
192.168.1.26 | CHANGED |rc=0>>192.168.1.25 | CHANGED |rc=0>>192.168.1.66 | CHANGED |rc=0>>192.168.1.24 | CHANGED |rc=0>>[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m command -a "ls -lh /opt"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 6 Nov 1714:34 monitor
drwxr-xr-x. 2 root root 99 Nov 1316:03 tar192.168.1.25 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 6 Nov 1714:34 monitor
drwxr-xr-x. 2 root root 99 Nov 1316:03 tar192.168.1.66 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 6 Nov 1714:30 monitor
drwxr-xr-x. 2 root root 99 Nov 1315:59 tar192.168.1.24 | CHANGED |rc=0>>
total 0
drwxr-xr-x. 2 root root 6 Nov 1714:34 monitor
drwxr-xr-x. 3 root root 27 Nov 1416:50 rh
drwxr-xr-x. 2 root root 203 Nov 1418:09 tar[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m copy -a "src=node_exporter-1.3.1.linux-amd64.tar.gz dest=/opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"9f33bb92952a1f7e333d76860703afcb87ce0642",
"dest":"/opt/monitor/node_exporter-1.3.1.linux-amd64.tar.gz",
"gid":0,
"group":"root",
"md5sum":"5d12549751142ffd0725fb4427f211ef",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":9034588,
"src":"/root/.ansible/tmp/ansible-tmp-1700202936.36-14272-49436219706589/source",
"state":"file",
"uid":0}192.168.1.66 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"9f33bb92952a1f7e333d76860703afcb87ce0642",
"dest":"/opt/monitor/node_exporter-1.3.1.linux-amd64.tar.gz",
"gid":0,
"group":"root",
"md5sum":"5d12549751142ffd0725fb4427f211ef",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":9034588,
"src":"/root/.ansible/tmp/ansible-tmp-1700202936.36-14274-87162137666346/source",
"state":"file",
"uid":0}192.168.1.25 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"9f33bb92952a1f7e333d76860703afcb87ce0642",
"dest":"/opt/monitor/node_exporter-1.3.1.linux-amd64.tar.gz",
"gid":0,
"group":"root",
"md5sum":"5d12549751142ffd0725fb4427f211ef",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":9034588,
"src":"/root/.ansible/tmp/ansible-tmp-1700202936.33-14270-35266519335829/source",
"state":"file",
"uid":0}192.168.1.24 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"9f33bb92952a1f7e333d76860703afcb87ce0642",
"dest":"/opt/monitor/node_exporter-1.3.1.linux-amd64.tar.gz",
"gid":0,
"group":"root",
"md5sum":"5d12549751142ffd0725fb4427f211ef",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":9034588,
"src":"/root/.ansible/tmp/ansible-tmp-1700202936.4-14268-98104309874668/source",
"state":"file",
"uid":0}[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m copy -a "src=install_node.sh dest=/opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"45782e2114e1a86c0f1ce36c1a2236ca010f351b",
"dest":"/opt/monitor/install_node.sh",
"gid":0,
"group":"root",
"md5sum":"dd633ca5428c246f731c830dc42020f9",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":597,
"src":"/root/.ansible/tmp/ansible-tmp-1700202974.75-14553-171348241204765/source",
"state":"file",
"uid":0}192.168.1.25 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"45782e2114e1a86c0f1ce36c1a2236ca010f351b",
"dest":"/opt/monitor/install_node.sh",
"gid":0,
"group":"root",
"md5sum":"dd633ca5428c246f731c830dc42020f9",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":597,
"src":"/root/.ansible/tmp/ansible-tmp-1700202974.76-14551-70452038567216/source",
"state":"file",
"uid":0}192.168.1.66 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"45782e2114e1a86c0f1ce36c1a2236ca010f351b",
"dest":"/opt/monitor/install_node.sh",
"gid":0,
"group":"root",
"md5sum":"dd633ca5428c246f731c830dc42020f9",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":597,
"src":"/root/.ansible/tmp/ansible-tmp-1700202974.77-14554-143893062474701/source",
"state":"file",
"uid":0}192.168.1.24 | CHANGED =>{"ansible_facts":{"discovered_interpreter_python":"/usr/bin/python"},
"changed": true,
"checksum":"45782e2114e1a86c0f1ce36c1a2236ca010f351b",
"dest":"/opt/monitor/install_node.sh",
"gid":0,
"group":"root",
"md5sum":"dd633ca5428c246f731c830dc42020f9",
"mode":"0644",
"owner":"root",
"secontext":"system_u:object_r:usr_t:s0",
"size":597,
"src":"/root/.ansible/tmp/ansible-tmp-1700202974.75-14549-88295804853297/source",
"state":"file",
"uid":0}[root@hosts-vm27 monitor]# ansible mysql-servers -m command -a "ls -lh /opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED |rc=0>>
total 8.7M
-rw-r--r--. 1 root root 597 Nov 1714:36 install_node.sh
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.66 | CHANGED |rc=0>>
total 8.7M
-rw-r--r--. 1 root root 597 Nov 1714:32 install_node.sh
-rw-r--r--. 1 root root 8.7M Nov 1714:31 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.25 | CHANGED |rc=0>>
total 8.7M
-rw-r--r--. 1 root root 597 Nov 1714:36 install_node.sh
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.24 | CHANGED |rc=0>>
total 8.7M
-rw-r--r--. 1 root root 597 Nov 1714:36 install_node.sh
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
[root@hosts-vm27 monitor]#
5.解压node-exporter安装包、赋权脚本、创建软连接
[root@hosts-vm27 monitor]# ansible mysql-servers -m raw -a "cd /opt/monitor && chmod 755 *.sh && tar xf node_exporter-1.3.1.linux-amd64.tar.gz "[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.25 | CHANGED |rc=0>>
Shared connection to 192.168.1.25 closed.
192.168.1.66 | CHANGED |rc=0>>
Shared connection to 192.168.1.66 closed.
192.168.1.26 | CHANGED |rc=0>>
Shared connection to 192.168.1.26 closed.
192.168.1.24 | CHANGED |rc=0>>
Shared connection to 192.168.1.24 closed.
[root@hosts-vm27 monitor]# ansible mysql-servers -m command -a "ls -lh /opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.66 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:32 install_node.sh
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:31 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.25 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.24 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m raw -a "cd /opt/monitor && ln -s node_exporter-1.3.1.linux-amd64 node_exporter"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED |rc=0>>
Shared connection to 192.168.1.26 closed.
192.168.1.25 | CHANGED |rc=0>>
Shared connection to 192.168.1.25 closed.
192.168.1.66 | CHANGED |rc=0>>
Shared connection to 192.168.1.66 closed.
192.168.1.24 | CHANGED |rc=0>>
Shared connection to 192.168.1.24 closed.
[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m command -a "ls -lh /opt/monitor"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.26 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
lrwxrwxrwx. 1 root root 31 Nov 1714:42 node_exporter -> node_exporter-1.3.1.linux-amd64
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.25 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
lrwxrwxrwx. 1 root root 31 Nov 1714:42 node_exporter -> node_exporter-1.3.1.linux-amd64
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.66 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:32 install_node.sh
lrwxrwxrwx. 1 root root 31 Nov 1714:38 node_exporter -> node_exporter-1.3.1.linux-amd64
drwxr-xr-x. 234343434128 Nov 1714:39 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:31 node_exporter-1.3.1.linux-amd64.tar.gz
192.168.1.24 | CHANGED |rc=0>>
total 8.7M
-rwxr-xr-x. 1 root root 597 Nov 1714:36 install_node.sh
lrwxrwxrwx. 1 root root 31 Nov 1714:42 node_exporter -> node_exporter-1.3.1.linux-amd64
drwxr-xr-x. 23434343489 Jun 2621:03 node_exporter-1.3.1.linux-amd64
-rw-r--r--. 1 root root 8.7M Nov 1714:35 node_exporter-1.3.1.linux-amd64.tar.gz
[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]#
6.脚本安装node-exporter
[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m raw -a "cd /opt/monitor && ./install_node.sh"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.25 | CHANGED |rc=0>>
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
● node_exporter.service - node_exporter
Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-11-17 14:43:46 CST; 98ms ago
Main PID: 15505(node_exporter)
CGroup: /system.slice/node_exporter.service
└─15505 /opt/monitor/node_exporter/node_exporter --web.listen-addr...
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...e
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...e
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...x
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...s
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...e
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...t
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...s
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...s
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.077Z cal...9
Nov 1714:43:46 hosts-vm25 node_exporter[15505]: ts=2023-11-17T06:43:46.079Z cal...e
Hint: Some lines were ellipsized, use -l to show in full.
Shared connection to 192.168.1.25 closed.
192.168.1.66 | CHANGED |rc=0>>
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
● node_exporter.service - node_exporter
Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-11-17 14:39:58 CST; 91ms ago
Main PID: 29611(node_exporter)
CGroup: /system.slice/node_exporter.service
└─29611 /opt/monitor/node_exporter/node_exporter --web.listen-addr...
Nov 1714:39:58 host62 systemd[1]: Started node_exporter.
Shared connection to 192.168.1.66 closed.
192.168.1.26 | CHANGED |rc=0>>
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
● node_exporter.service - node_exporter
Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-11-17 14:43:46 CST; 91ms ago
Main PID: 27265(node_exporter)
CGroup: /system.slice/node_exporter.service
└─27265 /opt/monitor/node_exporter/node_exporter --web.listen-addr...
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...e
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...e
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...x
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...s
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...e
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...t
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...s
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.651Z cal...s
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.652Z cal...9
Nov 1714:43:46 hosts-vm26 node_exporter[27265]: ts=2023-11-17T06:43:46.653Z cal...e
Hint: Some lines were ellipsized, use -l to show in full.
Shared connection to 192.168.1.26 closed.
192.168.1.24 | CHANGED |rc=0>>
Created symlink from /etc/systemd/system/multi-user.target.wants/node_exporter.service to /usr/lib/systemd/system/node_exporter.service.
● node_exporter.service - node_exporter
Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-11-17 14:43:47 CST; 243ms ago
Main PID: 4206(node_exporter)
CGroup: /system.slice/node_exporter.service
└─4206 /opt/monitor/node_exporter/node_exporter --web.listen-addre...
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...e
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...e
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...x
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...s
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...e
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...t
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...s
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.447Z call...s
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.450Z call...9
Nov 1714:43:47 hosts-vm24 node_exporter[4206]: ts=2023-11-17T06:43:47.452Z call...e
Hint: Some lines were ellipsized, use -l to show in full.
Shared connection to 192.168.1.24 closed.
[root@hosts-vm27 monitor]#
7.检查进程
[root@hosts-vm27 monitor]#[root@hosts-vm27 monitor]# ansible mysql-servers -m raw -a "ps -ef|grep node"[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
192.168.1.25 | CHANGED |rc=0>>
root 155051014:43 ? 00:00:00 /opt/monitor/node_exporter/node_exporter --web.listen-address=:8089
root 1554515374014:44 pts/1 00:00:00 bash-cps -ef|grepnode
root 1555715545014:44 pts/1 00:00:00 grepnode
Shared connection to 192.168.1.25 closed.
192.168.1.24 | CHANGED |rc=0>>
root 42061114:43 ? 00:00:00 /opt/monitor/node_exporter/node_exporter --web.listen-address=:8089
root 42494076014:44 pts/1 00:00:00 bash-cps -ef|grepnode
root 42614249014:44 pts/1 00:00:00 grepnode
Shared connection to 192.168.1.24 closed.
192.168.1.66 | CHANGED |rc=0>>
root 296111114:39 ? 00:00:00 /opt/monitor/node_exporter/node_exporter --web.listen-address=:8089
root 2965829481014:40 pts/1 00:00:00 bash-cps -ef|grepnode
root 2967029658014:40 pts/1 00:00:00 grepnode
Shared connection to 192.168.1.66 closed.
192.168.1.26 | CHANGED |rc=0>>
root 272651014:43 ? 00:00:00 /opt/monitor/node_exporter/node_exporter --web.listen-address=:8089
root 2730627135014:44 pts/1 00:00:00 bash-cps -ef|grepnode
root 2731827306014:44 pts/1 00:00:00 grepnode
Shared connection to 192.168.1.26 closed.
[root@hosts-vm27 monitor]#