-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathesxi_collector.sh
executable file
·22 lines (19 loc) · 1.08 KB
/
esxi_collector.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# workdir refers to the directory where 60_esxi_*.sh scripts reside.
workdir=.
# community refers to the "community string" in snmpcmd
community="COMMUNITY_STRING"
# targets refers to the "AGENT" array in snmpcmd
targets=( example1.com example2.com )
# httpprex refers to the open-falcon agent that can receive json.
httpprex=127.0.0.1:1988
for host in "${targets[@]}"
do
curl -s -X POST -d "$($workdir/60_esxi_cpu.sh $community "${host}" | python -m json.tool)" "$httpprex/v1/push" &
curl -s -X POST -d "$($workdir/60_esxi_df.sh $community "${host}" | python -m json.tool)" "$httpprex/v1/push" &
curl -s -X POST -d "$($workdir/60_esxi_if_in.sh $community "${host}" | python -m json.tool)" "$httpprex/v1/push" &
curl -s -X POST -d "$($workdir/60_esxi_if_out.sh $community "${host}" | python -m json.tool)" "$httpprex/v1/push" &
curl -s -X POST -d "$($workdir/60_esxi_memory.sh $community "${host}" | python -m json.tool)" "$httpprex/v1/push" &
curl -s -X POST -d "$($workdir/60_esxi_user.sh $community "${host}" 2>/dev/null | python -m json.tool)" "$httpprex/v1/push" &
sleep 1
done