首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取AMQ存储值的脚本

获取AMQ存储值的脚本
EN

Unix & Linux用户
提问于 2019-01-23 20:43:52
回答 1查看 24关注 0票数 -1

我做的剧本。

代码语言:javascript
复制
#!/bin/bash

amqBaseURL="http://10.199.199.199:8080"

/usr/bin/wget --http-user=admin --http-password=admin $amqBaseURL/admin/ -O amq1.html

store=`cat amq1.html |sed -n '/Store/{n;p}'|grep -o "[0-9]*"`

echo -e "$store"

脚本输出

代码语言:javascript
复制
--2019-01-23 21:25:13--  http://10.199.199.199:8080/admin/
Connecting to 10.199.199.199:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Reusing existing connection to 10.199.199.199:8080.
HTTP request sent, awaiting response... 200 OK
Length: 7363 (7.2K) [text/html]
Saving to: “amq1.htmlâ€‌

100%[==========================================================================================================>] 7,363       --.-K/s   in 0s      

2019-01-23 21:25:13 (251 MB/s) - “amq1.htmlâ€‌ saved [7363/7363]

0

我只需要得到输出值。与每次运行脚本时的整个长度不同,输出只会是。

代码语言:javascript
复制
100

我正在为这个脚本运行一个外部调度程序(Zabbix),这个工具只接受数字。

EN

回答 1

Unix & Linux用户

发布于 2019-01-23 22:28:32

张贴答案,以使问题可以被标记为结束。归功于DopeGhoti。为了抑制完整的wget会话输出,可以使用-q--quiet标志运行该命令。从文件中:

-q --quiet Turn off Wget's output.

或者,要获得最小的输出(例如错误),请使用-nv--no-verbose标志。从文件中:

-nv --no-verbose Turn off verbose without being completely quiet (use -q for that), which means that error messages and basic information still get printed.

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/496322

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档