In the below dev-netpro.sh script 'curl' does not post anything if my $FWK (i.e. '8fwk3_dev 2fwk0_dev' - could be up to 9 words) and $CON (in the example it is series of digits:'72 43 172 28021 8261 14015 325 24 524') get more than one word
[Expert@WAL-NEW-VSX-02:0]# cat dev-netpro.sh
#!/bin/bash
while true; do
FWK=$(top -b -n 1 | egrep 'fwk' | awk '{print $9 $NF}')
CON=$(vsx stat -l | egrep 'number' | awk '{print $3}')
TIME=`date +"%T"`
echo $HOSTNAME, $TIME, $FWK, $CON
echo '{"WAL-VSX-02": "['"$TIME"','"$FWK"','"$CON"']"}'
curl -ik -H "Accept: application/json" -H "Content-type: application/json" -d '{"WAL-VSX-02": "['"$TIME"','"$FWK"','"$CON"']"}' -X POST "https://10.199.107.11:8880/test"
sleep 2
done
[Expert@WAL-NEW-VSX-02:0]#
See the output below:
[Expert@WAL-NEW-VSX-02:0]# ./dev-netpro.sh
WAL-NEW-VSX-02, 12:53:17, 8fwk3_dev 2fwk0_dev, 72 43 172 28021 8261 14015 325 24 524
{"WAL-VSX-02": "[12:53:17,8fwk3_dev
2fwk0_dev,72
43
172
28021
8261
14015
325
24
524]"}
......nothing