I am sure someone else who is more fluent in bash and/or perl or other scripting language might be able to provide more elegant and robust methods, but I wasn't able to find anything on the internet related to using the iTHX-SD with mrtg and external scripts. I went ahead and developed my own version, which has been in operation for a couple of days with reasonable results.
The mrtg.cfg configuration for the ITHX-SD is as follows:
Target[ithxsd1_humidtemp]: `/data/usr/local/bin/get_ithxsd.sh` MaxBytes[ithxsd1_humidtemp]: 100 WithPeak[ithxsd1_humidtemp]: wmy Unscaled[ithxsd1_humidtemp]: dwmy Title[ithxsd1_humidtemp]: ITHX-SD1 PageTop[ithxsd1_humidtemp]: <h1>ITHX-SD1</h1> Options[ithxsd1_humidtemp]: gauge, nopercent, unknaszero YLegend[ithxsd1_humidtemp]: RH(%),Temp(�F) ShortLegend[ithxsd1_humidtemp]: Colours[ithxsd1_humidtemp]: GREEN#00eb0c,BLUE#0000ff,GRAY#AAAAAA,VIOLET#ff00ff Legend1[ithxsd1_humidtemp]: Humidity Legend2[ithxsd1_humidtemp]: Temperature Legend3[ithxsd1_humidtemp]: Peak Value of Humidity Legend4[ithxsd1_humidtemp]: Peak Value of Temperature LegendI[ithxsd1_humidtemp]: RH(%) LegendO[ithxsd1_humidtemp]: Temp(�F)
The script get_ithxsd.sh is as follows:
#!/bin/bash humidity=0 temperature=0 temptest=`{ echo "*SRTF"; sleep 0.2; } | telnet 10.1.4.61 2000 2> /dev/null | egrep "^[0-9]+\.[0-9]+"` humtest=`{ echo "*SRH"; sleep 0.2; } | telnet 10.1.4.61 2000 2> /dev/null | egrep "^[0-9]+\.[0-9]+"` if [[ $humtest =~ [0-9]+\.[0-9]+ ]] then humidity=$humtest else humtest=`{ echo "*SRH"; sleep 0.2; } | telnet 10.1.4.61 2000 2> /dev/null | egrep "^[0-9]+\.[0-9]+"` if [[ $humtest =~ [0-9]+\.[0-9]+ ]] then humidity=$humtest fi fi if [[ $temptest =~ [0-9]+\.[0-9]+ ]] then temperature=$temptest else temptest=`{ echo "*SRTF"; sleep 0.2; } | telnet 10.1.4.61 2000 2> /dev/null | egrep "^[0-9]+\.[0-9]+"` if [[ $temptest =~ [0-9]+\.[0-9]+ ]] then temperature=$temptest fi fi echo $humidity echo $temperature echo 0 echo 0
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.