zabbix监控rds

问题:使用zabbix监控rds,用之前的脚本,执行总是会有密码安全提示:
[root@iZ25m1box8cZ alertscripts]# sh rds.sh Uptime
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
8784465
这样
解决方案【按照一下直接修改脚本即可】:
 
1、使用mysql_config_editor
先创建一个login-path:
[root@iZ25m1box8cZ mysql]# mysql_config_editor set --login-path=rds --user=bzpt --password -hrm-2zee412l7n1r4air8.mysql.rds.aliyuncs.com -P3306
Enter password:
创建好后,.mylogin.cnf将保存在用户的家目录下,此处我用的是RHEL6,即/home/op下。
该文件是不可读的,它类似于选项组,包含单个身份的验证信息。
 
使用原来的方式,还是会有密码安全提示:
[root@iZ25m1box8cZ mysql]# mysqladmin -ubzpt -pI9sGSa5IdJT6 -hrm-2zee412l7n1r4air8.mysql.rds.aliyuncs.com -P3306 status
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Uptime: 8784486  Threads: 22  Questions: 132212856  Slow queries: 2012  Opens: 175271  Flush tables: 1  Open tables: 599  Queries per second avg: 15.050
 
指定创建的login-path名,就没有密码安全提示了:
[root@iZ25m1box8cZ mysql]# mysqladmin --login-path=rds status
Uptime: 8784531  Threads: 22  Questions: 132213030  Slow queries: 2012  Opens: 175271  Flush tables: 1  Open tables: 599  Queries per second avg: 15.050
 
mysql_config_editor用法:
 
2、错误输出重定向 2>/dev/null
 
[root@iZ25m1box8cZ mysql]# mysqladmin -ubzpt -pI9sGSa5IdJT6 -hrm-2zee412l7n1r4air8.mysql.rds.aliyuncs.com -P3306 status 2>/dev/null|cut -f2 -d":"|cut -f1 -d"T"
 8784844

转载于:https://www.cnblogs.com/lizhi221/p/6814083.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值