IOT-generating data for integration of system parameters of ictuxen2 to carriots


# cat /root/bin/iot-carriots.sh

#!/bin/bash

#created by Byomkesh on 10-14Feb2018

echo '
v1 now
ictuxen2@byomkesh.byomkesh
' >/root/bin/data/iotdata.txt

/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL|grep -e Temp -e Slot|tr -s '\n' ' '|perl -e '$in=<>; $in =~ /Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*Slot Number: ([^ ]*) .*Drive Temperature :[ ]*([^ ]*)C .*/; print "$1 $2 $3 $4 $5 $6 $7 $8 $9 $10"'|(read a b c d e f g h i j k; echo -n ''$b''$d''$f''$h''$j'';) >>/root/bin/data/iotdata.txt
/usr/sbin/isensor -s -g fan,temp,voltage,current|cut -d "|" -f 5,7|sed -e 's/ //g' -e's/\+//g' -e's/\%//g'|grep -e "C$" -e "V$" -e "A$" -e"RPM$"|tr -s '|' ' '|sed -e "s/C$//" -e "s/V$//" -e "s/A$//" -e"s/RPM$//"|while read a b c ; do a=`echo $a|tr '\.' '_'`; echo -n '<'$a'>'$b''; done >>/root/bin/data/iotdata.txt

echo '

' >>/root/bin/data/iotdata.txt

curl -s --request POST --data-binary @/root/bin/data/iotdata.txt --header "carriots.apikey:6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6" --header "content-type:application/xml" http://api.carriots.com/streams 2>&1 >/dev/null

#curl -s --request POST --data-binary @/root/bin/data/iotdata.txt --header "carriots.apikey:6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx66" --header "content-type:application/xml" http://api.carriots.com/streams

# cat /root/bin/data/iotdata.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.