Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,运行脚本报错 #2

Open
CaySky opened this issue Aug 2, 2019 · 7 comments
Open

你好,运行脚本报错 #2

CaySky opened this issue Aug 2, 2019 · 7 comments

Comments

@CaySky
Copy link

CaySky commented Aug 2, 2019

你好,在运行脚本的时候显示不可转换,使用snmp_quries.sh可以正常收集,报错后可以收集到数据但是不完整,详细报错如下:
image
配置文件如下:
image
agent日记如下:
image
监控数据如下:
image
如果有幸被作者查阅,请您帮忙看看,谢谢。QQ:744566389

@humorless
Copy link
Owner

看起來像是某個 60_esxi_*.sh 沒有順利抓到完整的 json 。

要不要試試 sh -x 60_esxi_*.sh 來看看詳細的運作過程?

@CaySky
Copy link
Author

CaySky commented Aug 5, 2019

看起来像是某个60_esxi_*.sh没有顺利抓到完整的json。

要不要试试sh -x 60_esxi_*.sh来看看详细的运作过程?
你好,我通过排查只有60_esxi_df.sh这个脚本无法转换。
下面为单独只运行了60_esxi.df这个脚本图:
image

下面为运行图:
image

其他的脚本都注释,只留了60_esxi_df_sh脚本。
麻烦帮忙看看,谢谢。

@humorless
Copy link
Owner

可以附上,你執行 snmp_quries.sh 的結果嗎?

@CaySky
Copy link
Author

CaySky commented Aug 5, 2019

可以附上,执行你snmp_quries.sh的查询查询结果吗?

image
image

@humorless
Copy link
Owner

我看這樣子的結果,是很有機會修正的。因為 snmpdf 可以成功地拿到資料。

那請你再跑一下 sh -x 60_esxi_df.sh $community $host

應該就是錯在這個 60_esxi_df.sh 裡

@CaySky
Copy link
Author

CaySky commented Aug 6, 2019

你好,我通过sh -x 60_esxi_df.sh $community $host 会显示报错,所以我修改了60_esxi_df.sh,把社区识别码(communlity)和host直接写入执行了,提示结果如下:
`# sh -x 60_esxi_df.sh

  • community=Stnts.8048
  • host=172.16.1.240
  • version=2c
    ++ date +%s
  • date=1565080300
  • count=0
    ++ snmpdf -v 2c -c Stnts.8048 172.16.1.240
  • list='Description size (kB) Used Available Used%
    /vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0 292688 214088 78600 73%
    /vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b 255716 8 255708 0%
    /vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0 4192960 15296 4177664 0%
    /vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3 255716 144556 111160 56%
    /vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0 460849152 20993024 439856128 4%
    Real Memory 201212700 138063100 63149600 68%'
  • echo '['
    [
  • read -r line
  • (( 0 != 0 ))
  • count=1
  • read -r line
  • (( 1 != 0 ))
  • (( 1 > 1 ))
    ++ echo /vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0 292688 214088 78600 73%
    ++ awk '{print $1}'
  • index=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0
    ++ xargs
    ++ echo /vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0
  • index=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0
    ++ echo /vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0 292688 214088 78600 73%
    ++ awk '{print $2}'
  • size=292688
    ++ echo 292688
    ++ xargs
  • size=292688
    ++ echo /vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0 292688 214088 78600 73%
    ++ awk '{print $5}'
  • used=73%
    ++ echo 73%
    ++ xargs -d%
    ++ xargs
  • used=73
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 292688, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 292688, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 73, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b32e-290e20a0-d331-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 73, "counterType": "GAUGE", "step" : 60}
  • count=2
  • read -r line
  • (( 2 != 0 ))
  • (( 2 > 1 ))
  • echo -n ,
    ,++ echo /vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b 255716 8 255708 0%
    ++ awk '{print $1}'
  • index=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b
    ++ xargs
    ++ echo /vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b
  • index=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b
    ++ awk '{print $2}'
    ++ echo /vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b 255716 8 255708 0%
  • size=255716
    ++ echo 255716
    ++ xargs
  • size=255716
    ++ echo /vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b 255716 8 255708 0%
    ++ awk '{print $5}'
  • used=0%
    ++ echo 0%
    ++ xargs -d%
    ++ xargs
  • used=0
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 255716, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 255716, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 0, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/e61e1c79-30ad02db-61cd-98422062b20b", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 0, "counterType": "GAUGE", "step" : 60}
  • count=3
  • read -r line
  • (( 3 != 0 ))
  • (( 3 > 1 ))
  • echo -n ,
    ,++ echo /vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0 4192960 15296 4177664 0%
    ++ awk '{print $1}'
  • index=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0
    ++ xargs
    ++ echo /vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0
  • index=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0
    ++ awk '{print $2}'
    ++ echo /vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0 4192960 15296 4177664 0%
  • size=4192960
    ++ echo 4192960
    ++ xargs
  • size=4192960
    ++ echo /vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0 4192960 15296 4177664 0%
    ++ awk '{print $5}'
  • used=0%
    ++ echo 0%
    ++ xargs -d%
    ++ xargs
  • used=0
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 4192960, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 4192960, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 0, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b360-6076b3ed-aea2-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 0, "counterType": "GAUGE", "step" : 60}
  • count=4
  • read -r line
  • (( 4 != 0 ))
  • (( 4 > 1 ))
  • echo -n ,
    ,++ echo /vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3 255716 144556 111160 56%
    ++ awk '{print $1}'
  • index=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3
    ++ echo /vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3
    ++ xargs
  • index=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3
    ++ awk '{print $2}'
    ++ echo /vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3 255716 144556 111160 56%
  • size=255716
    ++ echo 255716
    ++ xargs
  • size=255716
    ++ echo /vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3 255716 144556 111160 56%
    ++ awk '{print $5}'
  • used=56%
    ++ echo 56%
    ++ xargs -d%
    ++ xargs
  • used=56
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 255716, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 255716, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 56, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5fc50f7a-3bf19c40-6d73-fd6914d32af3", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 56, "counterType": "GAUGE", "step" : 60}
  • count=5
  • read -r line
  • (( 5 != 0 ))
  • (( 5 > 1 ))
  • echo -n ,
    ,++ echo /vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0 460849152 20993024 439856128 4%
    ++ awk '{print $1}'
  • index=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0
    ++ echo /vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0
    ++ xargs
  • index=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0
    ++ awk '{print $2}'
    ++ echo /vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0 460849152 20993024 439856128 4%
  • size=460849152
    ++ echo 460849152
    ++ xargs
  • size=460849152
    ++ echo /vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0 460849152 20993024 439856128 4%
    ++ awk '{print $5}'
  • used=4%
    ++ echo 4%
    ++ xargs -d%
    ++ xargs
  • used=4
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 460849152, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : 460849152, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 4, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=/vmfs/volumes/5d26b35f-27bcb687-2454-ac1f6b9625e0", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 4, "counterType": "GAUGE", "step" : 60}
  • count=6
  • read -r line
  • (( 6 != 0 ))
  • (( 6 > 1 ))
  • echo -n ,
    ,++ echo Real Memory 201212700 138063100 63149600 68%
    ++ awk '{print $1}'
  • index=Real
    ++ echo Real
    ++ xargs
  • index=Real
    ++ awk '{print $2}'
    ++ echo Real Memory 201212700 138063100 63149600 68%
  • size=Memory
    ++ echo Memory
    ++ xargs
  • size=Memory
    ++ echo Real Memory 201212700 138063100 63149600 68%
    ++ awk '{print $5}'
  • used=63149600
    ++ echo 63149600
    ++ xargs -d%
    ++ xargs
  • used=63149600
  • echo '{ "endpoint" : "172.16.1.240", "tags" : "mount=Real", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : Memory, "counterType": "GAUGE", "step" : 60}'
    { "endpoint" : "172.16.1.240", "tags" : "mount=Real", "timestamp" : 1565080300, "metric" : "esxi.df.size.kilobytes", "value" : Memory, "counterType": "GAUGE", "step" : 60}
  • echo ',{ "endpoint" : "172.16.1.240", "tags" : "mount=Real", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 63149600, "counterType": "GAUGE", "step" : 60}'
    ,{ "endpoint" : "172.16.1.240", "tags" : "mount=Real", "timestamp" : 1565080300, "metric" : "esxi.df.used.percentage", "value" : 63149600, "counterType": "GAUGE", "step" : 60}
  • count=7
  • read -r line
  • echo ']'
    ]
    `

@humorless
Copy link
Owner

從這個 log 看起來的話,60_esxi_df.sh 在你進行測試的開發環境上,似乎也是有跑出 json 的結果?我看並沒有什麼問題。

還是沒有線索的話,我會建議,往生產環境與開發環境的差異點去找 bug 的原因。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants