nmap 探测局域网有没有 dhcp server

家里有时候会有多个 dhcp server,探测 dhcpserver 把没用的关掉

nmap --script broadcast-dhcp-discover
Starting Nmap 6.40 ( http://nmap.org ) at 2019-11-17 16:43 CST
Pre-scan script results:
| broadcast-dhcp-discover:
|   IP Offered: 192.168.1.60
|   DHCP Message Type: DHCPOFFER
|   Server Identifier: 192.168.1.123
|   IP Address Lease Time: 0 days, 0:02:00
|   Renewal Time Value: 0 days, 0:01:00
|   Rebinding Time Value: 0 days, 0:01:45
|   Subnet Mask: 255.255.255.0
|   Broadcast Address: 192.168.1.255
|   Router: 192.168.1.123
|   Domain Name Server: 192.168.1.123
|_  Domain Name: lan
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 3.37 seconds

判断 zookeeper 健康状态

echo stat | nc localhost 2181 | grep Mode
You will get the response if the node is acting as a leader:

Mode: leader
If it is a follower, you will see:

Mode: follower
Alternatively, you can use the zkServer.sh located in /opt/zookeeper/bin:

./zkServer.sh status

[root@misc010-prod ~]# echo mntr |nc  10.16.1.60 2181
zk_version	3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency	0
zk_max_latency	2
zk_min_latency	0
zk_packets_received	36275
zk_packets_sent	36274
zk_num_alive_connections	2
zk_outstanding_requests	0
zk_server_state	leader
zk_znode_count	488
zk_watch_count	3
zk_ephemerals_count	4
zk_approximate_data_size	40646
zk_open_file_descriptor_count	33
zk_max_file_descriptor_count	65536
zk_followers	2
zk_synced_followers	2
zk_pending_syncs	0

[root@misc010-prod ~]# echo mntr |nc  10.16.1.21 2181
zk_version	3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency	0
zk_max_latency	10
zk_min_latency	0
zk_packets_received	685
zk_packets_sent	686
zk_num_alive_connections	1
zk_outstanding_requests	0
zk_server_state	follower
zk_znode_count	488
zk_watch_count	0
zk_ephemerals_count	4
zk_approximate_data_size	40646
zk_open_file_descriptor_count	30
zk_max_file_descriptor_count	1048576
[root@misc010-prod ~]# echo mntr |nc  10.16.1.22 2181
zk_version	3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
zk_avg_latency	0
zk_max_latency	13
zk_min_latency	0
zk_packets_received	73614
zk_packets_sent	73622
zk_num_alive_connections	3
zk_outstanding_requests	0
zk_server_state	follower
zk_znode_count	488
zk_watch_count	37
zk_ephemerals_count	4
zk_approximate_data_size	40646
zk_open_file_descriptor_count	32
zk_max_file_descriptor_count	1048576

在 leader 输出中
zk_followers 2
zk_synced_followers 2
zk_pending_syncs 0
表示 zk 正常