How to Implement the device monitoring module
After one month of efforts, the FZAQ device monitoring module was finally completed. I am responsible for the design, implementation, and testing of this project, so I have a better understanding of the implementation process. I will share with you the Implementation ideas here, hoping to help you make progress.
First, you need to prepare two servers (each with at least three NICS) and one laptop. One server acts as Database Server 1, the other as Database Server 2, and the notebook acts as a display terminal.
Configure the IP address. For Database Server 1, configure the local connection as 172.22.51.171, set the local connection as 172.22.51.172, and configure the local connection as 10.0.0.1. Local Connection 1 and 2 are used to allow external programs to access the local database program. Local Connection 3 is the heartbeat port and is used to monitor the status of Database Server 2. In Database Server 2, set the local connection IP address to 172.22.51.173, set the local connection IP address to 172.22.51.174, and configure the local connection IP address to 10.0.0.2.
Run the daemon, ESB, C ++, and server information retrieval programs on the two database servers. The daemon process is used to monitor the running status of the database server of the other party. It starts to set Database Server 1 as the host and database server 2 as the backup machine. If Database Server 1 experiences a single network disconnection, Database Server 1 writes the fault to the database. If Database Server 1 experiences a dual network disconnection, Database Server 1 cannot write records to the database, at this time, the daemon on Database Server 1 sends fault information to the daemon on Database Server 2, the daemon on Database Server 2 sends the WorkState to the ESB on the local machine as 2 (2 indicates that the network is disconnected and 3 indicates that the device is down). The ESB puts the fault information of Database Server 1 into the database, at the same time, the message is pushed to the terminal care program. The Terminal Care Program receives the fault information pushed by the ESB, modifies the terminal's WCF address, and restarts the terminal program.
On the database server display page, use Timer to refresh the running status of the device from the database. If the device exists but is not running, the device color is gray. If the device is disconnected from the network, the device color is yellow. If the device is powered off or the network is disconnected, the device color is red.
Test method: Start the daemon process, ESB, C ++, and Server Information Acquisition Module on Database Server 1 and database server 2 respectively. Database Server 1 acts as the host, database Server 2 is a slave.
Test result: disconnect a network cable from Database Server 1. The icon "Database Server 1" on the page turns yellow and green after being inserted. Disconnect two network cables from Database Server 1. The daemon on Database Server 1 shows switching from Master to slave, and the daemon on Database Server 2 shows switching from slave to master, the Database Server 1 icon on the page turns red.