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

Solve the problem of "standard in must be a tty" when getting client data from zabbix_get of zabbix

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

(1) as shown in the question, there is a script on my zabbix client:

[root@mpdb01 scripts] # vim / usr/local/zabbix/scripts/paycompletion12.sh

Its contents are as follows:

#! / bin/bashecho "/ home/oracle/scripts/paymentcompletion.sh" | su-oracle

The meaning of the above script is very simple, which is to execute a statistical script as the oracle user

(2) modify the zabbix_agentd configuration file to add a "UserParameter":

[root@prx01 scripts] # vim / usr/local/zabbix/etc/zabbix_agentd.conf

The following has been added:

UserParameter=paycompletion12,/usr/local/zabbix/scripts/paycompletion12.sh

(3) then, when I tested and obtained the data on zabbix_server, I exposed the error shown in the question:

Thinking about [root@nmp01] # / usr/local/zabbix/bin/zabbix_get-s 10.110.80.117-k paycompletion12standard in must be a tty

For this problem, zabbix's mistake is that "the rule must be a tty". I think the reason for the problem is this: / usr/local/zabbix/scripts/paycompletion12.sh I tested this script with root users, so naturally I don't have to enter a password when su-oracle, but zabbix uses zabbix when executing this script, so I need to enter a password when executing su-oracle according to the normal process. But it is obvious that it is impossible for zabbix_get to get the data to provide you with an interactive interface to enter your password, so you report an error.

Problem solving

Everything else remains the same, just modify the zabbix_agentd configuration file and set "AllowRoot" to 1. In this way, the zabbix_agentd has root permissions, so you can naturally execute scripts to get the data. The specific operations are as follows:

[root@prx01 scripts] # vim / usr/local/zabbix/etc/zabbix_agentd.conf

Modify the following:

AllowRoot=1

If you use zabbix_get to obtain data again, you will obviously not make an error. The effect is as follows:

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

Database

Wechat

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

12
Report