- This topic has 14 replies, 7 voices, and was last updated 7 years, 5 months ago by Urs Wirthmueller.
-
AuthorPosts
-
February 23, 2015 at 4:41 am #1421shogunxParticipant
Hi All,
I operate node #11000001 in Daytona Beach, FL. I recently upgraded the firmware in this node to version 110. I also downloaded Pixel_K’s graphing script, but alas, it required a few more edits than just the relevant paths to get working with my firmware version. Also, I did not want to run from cron. I wound up with a small wrapper script that samples the data every 60 seconds, and several edits to the code itself. Here is the wrapper script:
#!/bin/sh radd(){ /home/shogunx/Pix.sh sleep 60 radd } radd
And here is the edited script. Note that data, graph and perhaps other paths will need to be updated for your local environment. As you can see, I simply placed these in a home directory, with the entire path defined in the variable. The IP address of the UradMonitor will need to be corrected for your network. I also changed the aspect ratio and size of the graph to better suit my needs, as well as outputting a temperature graph as well. Interestingly, the “cut” arguments specified the wrong data fields in my UradMonitor’s JSON output, so that had to be corrected as well.
#!/bin/sh URL=http://192.168.23.72/j rrdpath="/usr/bin" rrddata="/home/shogunx/data/uRadMonitor" rrdscript="/home/shogunx/script" rrdgraph="/home/shogunx/graph/uRadMonitor" rrdfmt="--font AXIS:9: --font TITLE:9: --font UNIT:9: --font LEGEND:7: --font-render-mode mono --color ARROW#000000 --color GRID#8C8C8C --color MGRID#000000 -v \"cpm\" --alt-y-mrtg --width 1000 --height 600" jsondata=$( /usr/bin/curl -s $URL ); v_cpm=$( echo $jsondata | cut -f 4 -d "," | cut -f 2 -d ":" ) v_temp=$( echo $jsondata | cut -f 5 -d "," | cut -f 2 -d ":" ) echo CPM : $v_cpm echo Temperature : $v_temp if ! [ -f $rrddata/uRadMonitor.rrd ]; then $rrdpath/rrdtool create $rrddata/uRadMonitor.rrd -s 60 \ DS:cpm:GAUGE:300:0:U \ DS:temp:GAUGE:300:-100:100 \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 \ RRA:MAX:0.5:24:775 \ RRA:MAX:0.5:288:797 echo fichier $rrddata/uRadMonitor.rrd cree fi $rrdpath/rrdtool updatev $rrddata/uRadMonitor.rrd N:$v_cpm:$v_temp $rrdpath/rrdtool graph --imgformat PNG $rrdgraph/rad-day.png --start -86400 --end -600 --title "Radiation daily" $rrdfmt \ DEF:cpm=$rrddata/uRadMonitor.rrd:cpm:AVERAGE \ AREA:cpm#00CCCC:"Count Per Minute\g" \ GPRINT:cpm:MAX:" Maximum \: %5.1lf " \ GPRINT:cpm:AVERAGE:" Average \: %5.1lf " \ GPRINT:cpm:LAST:" Current \: %5.1lf \l" $rrdpath/rrdtool graph --imgformat PNG $rrdgraph/rad-week.png --start -604800 -z --title "Radiation weekly" $rrdfmt \ DEF:cpm=$rrddata/uRadMonitor.rrd:cpm:AVERAGE \ AREA:cpm#00CCCC:"Count Per Minute\g" \ GPRINT:cpm:MAX:" Maximum \: %5.1lf " \ GPRINT:cpm:AVERAGE:" Average \: %5.1lf " \ GPRINT:cpm:LAST:" Current \: %5.1lf \l" $rrdpath/rrdtool graph --imgformat PNG $rrdgraph/rad-month.png --start -2592000 -z --title "Radiation monthly" $rrdfmt \ DEF:cpm=$rrddata/uRadMonitor.rrd:cpm:AVERAGE \ AREA:cpm#00CCCC:"Count Per Minute\g" \ GPRINT:cpm:MAX:" Maximum \: %5.1lf " \ GPRINT:cpm:AVERAGE:" Average \: %5.1lf " \ GPRINT:cpm:LAST:" Current \: %5.1lf \l" $rrdpath/rrdtool graph --imgformat PNG $rrdgraph/rad-year.png --start -31536000 -z --title "Radiation yearly" $rrdfmt \ DEF:cpm=$rrddata/uRadMonitor.rrd:cpm:AVERAGE \ AREA:cpm#00CCCC:"Count Per Minute\g" \ GPRINT:cpm:MAX:" Maximum \: %5.1lf " \ GPRINT:cpm:AVERAGE:" Average \: %5.1lf " \ GPRINT:cpm:LAST:" Current \: %5.1lf \l" $rrdpath/rrdtool graph --imgformat PNG $rrdgraph/temp-day.png --start -86400 --end -600 --title "Temperature daily" $rrdfmt \ DEF:cpm=$rrddata/uRadMonitor.rrd:temp:AVERAGE \ AREA:cpm#00CCCC:"Degrees Celsius\g" \
- This topic was modified 9 years, 8 months ago by uRADMonitor.
February 23, 2015 at 8:22 pm #1424uRADMonitorKeymasterGreat stuff, I just promoted it to sticky. Thanks for sharing!
February 24, 2015 at 11:44 am #1428Bjorn RoesbekeParticipantWhere is the rrdscript variable used?
February 24, 2015 at 4:46 pm #1434shogunxParticipantGood eye, Bjorn. It appears to be declared, but unused. I just checked the directory, and there is no output to it. Perhaps Pixel had intended a use for it, but never implemented the function.
February 24, 2015 at 7:28 pm #1435Pixel_KParticipantNice work, yes the value position shifted in the latest firmware (which added a missing comma), hence the additional modifications.
you can delete the rrdscript line, it’s a leftover from earlier script version.
I would use a while loop instead a recursive call, which is a bad practice in this case.
February 24, 2015 at 11:53 pm #1436shogunxParticipantHi Pixel_K. Thank you, nice work yourself. Ack on the rrdscript line, and I understand the versioning problem on the cut arguments. Sure, while loop is cleaner. Cron is cleaner too, actually. I just wanted to leave the shell attached to an xterm, so I could watch the data as it comes in. Having scratched my itch, I decided that was good enough. Want to use this thread like a version control system, with the latest code revisions in the most recent posts?
Ideally we could have the script act like an installer on the first run as well, asking the user what ip address the urad is on, where to store the data, etc. It could even test for curl and rrdtool on debian based derivatives (and likely others) and prompt an apt-get install of those if not present. I only say this because there will be a great many not so technical users, and we want to be able to collect data from their devices as well.
February 26, 2015 at 8:40 pm #1444uRADMonitorKeymastershogunx, for something as useful as this, let me know if you would like to do the version control in a blog post instead.
March 5, 2015 at 7:41 am #1486shogunxParticipantThat is probably a good idea.
March 5, 2015 at 11:49 am #1487Pixel_KParticipantI still have to update mine to #111, but that’s a great idea, so the script can live it’s own life.
March 5, 2015 at 9:51 pm #1488uRADMonitorKeymasterScott, your account should now be able to write blog posts. Feel free to give it a try!
July 16, 2015 at 7:55 pm #2058cristianst85 (nox)ModeratorMeanwhile I’ve done my own implementation but written in Perl.
Some key features are:
– automatic conversion to uSv/h when generating the graphs (the conversion is done using the appropriate factor for the detector present in the device);
– works with model A2 (pressure graphs).You can find it on GitHub.
Also you can view the live graphs from my uRADMonitor device readings here.
July 17, 2015 at 9:01 am #2060uRADMonitorKeymasterHi Nox, that’s another excellent contribution, thanks for sharing!
As offered to the other guys, would you be interested in presenting your SW setup in a blog article, with backlinks to your website, I can update your account accordingly. Let me know.
September 4, 2016 at 2:28 pm #3471Nicolas_DalyParticipantHi,
Excellent post. I used to be mad about graphing everything and this is a good excuse to get back to it.
I’ve gone for a 60 second step and added a trend of 2 Hours on the daily graph
CDEF:trend_cpm=cpm,7200,TREND \ AREA:cpm#00CCCC:"Count Per Minute\g" \ GPRINT:cpm:MAX:" Maximum \: %5.1lf " \ GPRINT:cpm:AVERAGE:" Average \: %5.1lf " \ GPRINT:cpm:LAST:" Current \: %5.1lf \l" \ LINE2:trend_cpm#000000:"Count Per Minute Trend 2 Hour\g"
September 6, 2016 at 2:30 am #3472Nicolas_DalyParticipantExcuse the double post. I’ve found the odd time when curl requests hang so may I suggest changing
jsondata=$( /usr/bin/curl -s $URL );
to
jsondata=$( /usr/bin/curl -s $URL --max-time 5 --retry 10 --retry-delay 1);
June 16, 2017 at 8:10 am #4541Urs WirthmuellerParticipantThe script looks great.
Would it be possible to adapt it to the A3 model?
Also – as I suppose the script does download the data locally. Is it possible to download those data from the uradmonitor server including the credentials in the script?
-
AuthorPosts
- You must be logged in to reply to this topic.