In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The company initializes the expansion server automatically through script, but there is a problem. After the expansion, zabbix cannot automatically add the host to the server, and it needs to be added manually, so it is slow and error-prone, so it wants to add host monitoring automatically through API. You can solve this problem by looking at the interface. Https://www.zabbix.com/documentation/4.0/zh/manual/api
Before adding an API, you need to log in, get the login token, then get the token, and then add the server. The script is as follows:
#! / bin/bashhostname='192.168.0.219' # monitored host name ip='192.168.0.219' # monitored host IPport=10050 # monitored host zabbix_agentd port templateid=10001 # template IDgroupid=2 # server group zabbixhost=' http://www to join .zabbix.com'# zabbix host address header='Content-Type:application/json'request_data=' {"jsonrpc": "2.0" "method": "user.login", "params": {"user": "admin", "password": "zabbix"} "id": 1} 'result=$ (curl-s-XPOST-H ${header}-d "${request_data}" ${zabbixhost} / api_jsonrpc.php) token=$ (echo $result | sed's result.\ + "result": "([0-9a-z]\ +\)" save_request_data=' {"jsonrpc": "2.0", "method": "host.create", "params": {"host": "${hostname}'" "interfaces": [{"type": 1, "main": 1, "useip": 1, "ip": "${ip}'", "dns": "", "port": "${port}'"}], "groups": [{"groupid": "${groupid}"}], "templates": [{"templateid": "${templateid}'"}]}, "auth": "${token}'" "id": 1} 'curl-s-XPOST-H ${header}-d "${save_request_data}" ${zabbixhost} / api_jsonrpc.php
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.