Advertisement
Guest User

Untitled

a guest
Apr 28th, 2020
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #change to directory holding bash script
  4. cd /srv/18ff8cb7-1878-42d2-954d-90d62ec9aef5/AppData/cron/smart
  5. #output smart status into smart.txt
  6. snapraid smart > smart.txt
  7. #parse the smart.txt file for drives names sda-sdd and output in 2.txt
  8. grep -o '/dev/sd[a-d]' smart.txt > 2.txt
  9. #add cumulative failure rate word to 2.txt
  10. echo cumulative >> 2.txt
  11. #parse out the failure rates and output to 4.txt
  12. grep -o [0-9]*[0-9]% smart.txt > 4.txt
  13. #combine all four text files together
  14. paste -d "" 1.txt 2.txt 3.txt 4.txt > /srv/18ff8cb7-1878-42d2-954d-90d62ec9aef5/AppData/cron/upload.txt
  15. #remove % signs from file
  16. sed -i 's/%//g' /srv/18ff8cb7-1878-42d2-954d-90d62ec9aef5/AppData/cron/upload.txt
  17. #upload to manual database in influxdb
  18. curl -i -XPOST 'http://192.168.99.160:8086/write?db=manual' --data-binary @upload.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement