Zabbix remote command-Tomcat active/standby switch case

1. Main and standby server information

The main server is windows and the standby server is Linux. The requirement is that when Tomcat on the main server monitored by zabbix stops, switch to Tomcat of Linux to ensure normal business access.

Main server (windows)

Standby server (linux)

Program startup directory\command

10.172.200.155

10.173.220.85

主:D:\apache-tomcat-7.0.103\bin\startup.bat

Prepare: service tomcat7 start

10.172.200.156

10.10.220.37
Main: C:\software\apache-tomcat-7.0.92\bin\startup.bat
Standby: service tomcat7 start
Make the corresponding alarm action notification on the monitoring platform and the command to remotely start the standby server program, when it is detected When there is a problem, the monitoring system will complete the switching program action.
Implementation process description:
1. When the Tomcat or operating system of the main server is monitored is dead, a warning is issued.
2. The Tomcat of the standby machine is started.
3. After the monitoring of the main server Tomcat is restored, a notification has been issued
4. Personnel check to confirm the restoration. Manually shut down the standby Tomcat

The main and standby server down alarm and Tomcat stop running notification action:
Zabbix remote command-Tomcat active/standby switch case

2. Alarm sending and remote start program command:

The following is an example of remote command operation of 156-middleware backup server, and the rest of the notification actions are similar:

In the configuration-action-click 156-tomcat-alarm,
Zabbix remote command-Tomcat active/standby switch case
Zabbix remote command-Tomcat active/standby switch case
Zabbix remote command-Tomcat active/standby switch case

When it is checked that the program of the main server is running normally, the content of the recovery notification is sent to remind the administrator to switch the program manually.
Zabbix remote command-Tomcat active/standby switch case
Zabbix remote command-Tomcat active/standby switch case

3. Remotely execute commands:

The collection server remotely logs in to the agent through SSH, sends the command line set in the command box, and executes the corresponding operation.
Zabbix remote command-Tomcat active/standby switch case

Judge the host is down: By combining the agent client + ICMP method, first judge that the agent client has not collected data within a certain time frame, and the host IP cannot be pinged by the collection server, then the host is judged to be down.
Zabbix remote command-Tomcat active/standby switch case

If it is judged that the Tomcat program has not collected data within the set time range and the port 8080 for remote access is unavailable, it is judged that the program stops running, triggers the alarm action in step 2 and remotely starts the standby program command.

In order to avoid false alarms and false triggering of remote commands due to network problems, it is recommended to change the trigger time to within 2 minutes to 5 minutes. For example, if the update interval of the monitoring item is 60s, the trigger should be set to check twice and twice If no data is checked, an alarm notification is sent and a remote command is executed.

Guess you like

Origin blog.51cto.com/14483703/2542908