Skip to content

Commit

Permalink
更新IP地址的获取方式
Browse files Browse the repository at this point in the history
ifconfig 和 route 命令,写绝对路径会导致兼容性不好。
1. Debian系统路径对应: /sbin/ifconfig 和 /sbin/route
2. 原命令获取的IP地址兼容性不好,会带“addr:”在前面。 addr:192.163.10.31
3. 本地配置正确的情况下 `hostname -i`是能拿到正确IP的
  • Loading branch information
higkoo authored Mar 23, 2020
1 parent 408b649 commit b71847f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion etc/collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ logger:
keepHours: 2
identity:
specify: ""
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
shell: hostname -i
sys:
# timeout in ms
# interval in second
Expand Down

0 comments on commit b71847f

Please sign in to comment.