Skip to content

Commit

Permalink
Rpc monitor data size (#129)
Browse files Browse the repository at this point in the history
[rpc_monitor]
- update cronjob_get_status.sh to get data size of rpc instance
- display data_size
  • Loading branch information
baabeetaa authored Aug 29, 2022
1 parent 4537593 commit 620fa2f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion rpc_monitor/cronjob_get_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ for service_name in $RPC_SERVICES; do
tmp_str=""
while read -r ip_addr || [[ -n $ip_addr ]]; do
status_code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 3 --max-time 3 "http://$ip_addr/healthcheck")
data_size=$(curl -s "http://$ip_addr/data_size" |jq -r .data_size)

# figure out hostname of container
hostname=$(dig +short -x $ip_addr)

if [[ ! -z "$tmp_str" ]]; then
tmp_str="$tmp_str,"$'\n'
fi
tmp_str="$tmp_str"" { \"ip\": \"$ip_addr\", \"hostname\": \"$hostname\", \"status\": \"$status_code\" }"
tmp_str="$tmp_str"" { \"ip\": \"$ip_addr\", \"hostname\": \"$hostname\", \"status\": \"$status_code\", "data_size": "$data_size" }"

done < <(echo "$ips")

Expand Down
6 changes: 3 additions & 3 deletions rpc_monitor/web/public/status.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[ { "service": "cosmoshub", "containers": [ { "ip": "10.0.1.223", "hostname": "cosmoshub.1.topiphhprtlm4e78h1z186m60.cosmosia.", "status": "200" },
{ "ip": "10.0.1.231", "hostname": "cosmoshub.2.lq0d6j6ce17n9gc36tsdd5i0h.cosmosia.", "status": "200" },
{ "ip": "10.0.1.232", "hostname": "cosmoshub.3.kxjcetzqm3qicj5pcgrk6avm8.cosmosia.", "status": "200" } ] },
[ { "service": "cosmoshub", "containers": [ { "ip": "10.0.1.223", "hostname": "cosmoshub.1.topiphhprtlm4e78h1z186m60.cosmosia.", "status": "200", "data_size": "123G" },
{ "ip": "10.0.1.231", "hostname": "cosmoshub.2.lq0d6j6ce17n9gc36tsdd5i0h.cosmosia.", "status": "200", "data_size": "123G" },
{ "ip": "10.0.1.232", "hostname": "cosmoshub.3.kxjcetzqm3qicj5pcgrk6avm8.cosmosia.", "status": "200", "data_size": "123G" } ] },
{ "service": "juno", "containers": [ { "ip": "10.0.1.229", "hostname": "juno.1.622rsqr0zj6oocw9d42cxibkf.cosmosia.", "status": "200" },
{ "ip": "10.0.1.230", "hostname": "juno.2.b59x2cntposv3deq4owjwma85.cosmosia.", "status": "200" } ] },
{ "service": "osmosis", "containers": [ { "ip": "", "hostname": "", "status": "000" } ] },
Expand Down
13 changes: 9 additions & 4 deletions rpc_monitor/web/src/containers/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ const Service = (props) => {
const bgColor = item.status === "200" ? "" : (item.status === "503" ? "#FFC440" : "#D93026");
return (
<List.Item style={{background: bgColor}}>
<Popover content={item.hostname}>
<Icon type="info-circle" />
</Popover>
{item.ip}: <Badge>{item.status}</Badge>
<div style={{width: "100%"}}>
<span style={{float: "left"}}>
<Popover content={item.hostname}>
<Icon type="info-circle" />
</Popover>
{item.ip}
</span>
<span style={{float: "right"}}>{item.data_size}</span>
</div>
</List.Item>
)}
}
Expand Down

0 comments on commit 620fa2f

Please sign in to comment.