Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of executing remote Host script or instruction in zabbix

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shares with you the content of sample analysis of executing remote host scripts or instructions in zabbix. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Scene requirement

1. We can realize the remote shutdown of the installed zabbix_agent host through the script function of the web interface of zabbix_server without having to log in manually and enter the shutdown instructions.

2, . We can enable the startup, shutdown and restart of a service through the scripting function of zabbix_server 's web interface

Experimental configuration process

1. Create script

Open the web configuration interface of zabbix_server, select manage, then select the script option in the blue navigation bar, and finally click create script.

[external link image transfer failed. The origin server may have hotlink protection mechanism. It is recommended to save the image and upload it directly (img-NkHO93RH-1584329271250).

Script name: customization

Type: if the host type is window or linux, it is a selection script. IPMI type (not discussed for the time being)

There are three types of execution in:

(1) zabbix client, indicating that the script created will 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: just choose the default

Create a script that displays the host ip

Important: after the script is created, it must be opened in the configuration file of zabbix_agent to allow the zabbix client to execute remote commands

Change the default EnableRemoteCommands=0 to EnableRemoteCommands=1

Restart the zabbix client for the configuration to take effect

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

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

Execution result

Normally shows the ip of the linux host with the zabbix client installed

Thank you for reading! This is the end of this article on "sample analysis of executing remote host scripts or instructions in zabbix". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report