Detailed explanation of zabbix executing scripts or instructions on remote hosts

Detailed explanation of zabbix executing scripts or instructions on remote hosts

Scenario Requirements

1. We can use the script function of the zabbix_server web interface to remotely shut down the host where zabbix_agent is installed without manually logging in and entering the shutdown command.

2,. We can start, shut down and restart a service through the script function of the zabbix_server web interface

Experimental configuration process

1. Create a script

Open the zabbix_server web configuration interface, select Management, then select the Script option in the blue navigation bar, and finally click Create Script.

[External link image transfer failed. The source site may have an anti-hotlink mechanism. It is recommended to save the image and upload it directly (img-NkHO93RH-1584329271250)

insert image description here

Script name: Custom

Type: If it is a window or Linux host type, select script. IPMI type (not discussed yet)

There are three types of execution:

(1) Zabbix client, indicating that the created script will be run on the host where the Zabbix client is installed.
(2) zabbix_server (agent), indicating that the script will be executed on the zabbix agent.
(3) Zabbix server, indicating that the script will be executed on the server.

Command: You can fill in the system command or the absolute path of a script

Required host permissions: Select the default

Create a script to display the host ip

insert image description here

Important: After the script is created, you must enable the zabbix client to execute remote commands in the zabbix_agent configuration file

insert image description here

Change the default EnableRemoteCommands=0 EnableRemoteCommands=1

Restart the zabbix client to make the configuration take effect

After the script is created, we go to the monitoring in the web interface of zabbix_server, then find the latest data in the blue navigation bar, and find a window host that has already installed the zabbix client to execute it. Because ifconfig is a system command of the Linux host, the test can only be performed on a Linux host with the Zabbix client installed.

insert image description here

Then in the host column, left-click the host name, and some of our custom and built-in scripts will appear. The script that displays the IP is the one we just created.

insert image description here

Execution Results

insert image description here

Normally displays the IP address of the Linux host where the Zabbix client is installed

Summarize

This is the end of this article about Zabbix executing remote host scripts or instructions. For more relevant Zabbix execution remote host content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Zabbix monitors Linux hosts based on snmp
  • Detailed steps for adding hosts you need to monitor in zabbix
  • Get the IP and host name of all hosts on Zabbix
  • Python gets the host through the zabbix api
  • Detailed explanation of how to call zabbix API to obtain the host
  • How to set up Zabbix to monitor Linux hosts
  • Graphical steps of zabbix monitoring vmware exsi host

<<:  Vue realizes the logistics timeline effect

>>:  Examples of using MySQL pessimistic locking and optimistic locking

Recommend

Perfect solution for JavaScript front-end timeout asynchronous operation

Table of contents What happens if a piece of code...

nginx automatically generates configuration files in docker container

When a company builds Docker automated deployment...

jQuery+Ajax to achieve simple paging effect

This article shares the specific code of jquery+A...

Install and configure MySQL 5.7 under CentOS 7

This article tests the environment: CentOS 7 64-b...

Summary of events that browsers can register

Html event list General Events: onClick HTML: Mous...

More Ways to Use Angle Brackets in Bash

Preface In this article, we will continue to expl...

A record of the pitfalls of the WeChat applet component life cycle

The component lifecycle is usually where our busi...

6 Practical Tips for TypeScript Development

Table of contents 1. Determine the entity type be...

Detailed explanation of the usage of 5 different values ​​of CSS position

The position property The position property speci...

MySQL 5.7.13 installation and configuration method graphic tutorial on Mac

MySQL 5.7.13 installation tutorial for Mac, very ...