On RHEL, there is a possibility that bash hostmonitor fails to get interface name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
masakari-monitors |
Invalid
|
Undecided
|
takahara.kengo |
Bug Description
[Bug]
Currently, bash hostmonitor gets the interface name which specifies as option of tcpdump from output of ifconfig.
But the output of ifconfig differs between RHEL and Ubuntu.
Therefore, on RHEL, there is a possibility that bash hostmonitor fails to get interface.
[Cause]
Line 299 of masakarimonitor
----------
...
271 get_mcast_nic () {
...
299 MCAST_NIC=`cat -n ${TMP_IFCONFIG_
...
----------
The output of ifconfig differs between RHEL and Ubuntu as follows.
----------
* Ubuntu
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:50127469 errors:0 dropped:0 overruns:0 frame:0
TX packets:50127469 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:3390780924 (3.3 GB) TX bytes:3390780924 (3.3 GB)
* RHEL
lo: flags=73<
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 40637770 bytes 2178749630 (2.0 GiB) # *Possibility of hit to grep search*
RX errors 0 dropped 0 overruns 0 frame 0 # *Possibility of hit to grep search*
TX packets 40637770 bytes 2178749630 (2.0 GiB) # *Possibility of hit to grep search*
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
----------
As above, on RHEL, packets and bytes are followed by space instead of ":".
So there is a possibility of hit to grep search " ${S_LINE}" .
[Amendment]
In get_mcast_nic(), it should get the interface name by using ip route command instead of ifconfig as follow:
----------
get_mcast_nic () {
BIND_
sudo ip route > ${TMP_IP_
if [ `grep "${BIND_NET_ADDR}" ${TMP_IP_
return 1
fi
MCAST_NIC=`grep "${BIND_NET_ADDR}" ${TMP_IP_
return 0
}
----------
Changed in masakari-monitors: | |
assignee: | nobody → takahara.kengo (takahara.kengo) |
status: | New → In Progress |
Have pushed a patch. /review. openstack. org/#/c/ 560324/
https:/