grctest / GRC-Netdata

Netdata charts for Gridcoin
MIT License
7 stars 6 forks source link

Gaps in charts -> Timing issue. #3

Closed grctest closed 7 years ago

grctest commented 7 years ago

There are gaps appearing in the charts, this is likely caused by the netdata chart refreshing every 5 seconds whilst the stats.sh script refreshing less frequently & potentially netdata querying whilst stats.sh is writing to the file?

Some timing rebalancing should fix this.

NickAnEngineer commented 7 years ago

Think this might be solved by changing the netdata process priority up to nice (see here). Or the upgrade to ubuntu 17.04 might have fixed it, did both at the same time and forgot to check netdata until after the upgrade.

iFoggz commented 7 years ago

umm i saw the gaps and i didnt like it what i saw in stats.sh is when "grc getinfo >" is run it'll clear the file for the new data and not always does the daemon reply in a timely fashion so for a short time the file is 0 in size. I modified the lines differently to accommodate that thou its not most pretty solution but works for me and has 3 extra files.

grc getinfo > /home/gridcoin/.GridcoinResearch/getinfo.tmp && /bin/cp -f /home/gridcoin/.GridcoinResearch/getinfo.tmp /home/gridcoin/.GridcoinResearch/getinfo.json grc getstakinginfo > /home/gridcoin/.GridcoinResearch/getstakinginfo.tmp && /bin/cp -f /home/gridcoin/.GridcoinResearch/getstakinginfo.tmp /home/gridcoin/.GridcoinResearch/getstakinginfo.json grc getdifficulty > /home/gridcoin/.GridcoinResearch/difficulty.tmp && /bin/cp -f /home/gridcoin/.GridcoinResearch/difficulty.tmp /home/gridcoin/.GridcoinResearch/difficulty.json

now i make it put the reply from daemon to a .tmp file instead and then && /bin/cp -f .tmp .json. the && means that if A is successful execute B essentially. in doing that the .json file always has data for the charts so if its in between an update while the daemon hasn't supplied a reply it'll have something to keep the chart smooth.

for me it wasn't netdata having a problem it was simply that there was nothing in the file and it came back with no data for chart.

just configured up the rest of my netdata behind a webserver but you can see its smooth from here on out http://vancouver01.gridcoin.ifoggz-network.xyz

iFoggz commented 7 years ago

This morning I was having a coffee and I was thinking to myself. "Why would you make another inode structure when you could just rename the inode structure." After all it won't pass the && till its successfully done command A. So I've modified the code to the following and made it smaller to not include the /bin/.

Renaming the inode is faster then making a new one so it even more decreases the chance of a gap further. So with cp -f replaced by mv -f

grc getinfo > /home/gridcoin/.GridcoinResearch/getinfo.tmp && mv -f /home/gridcoin/.GridcoinResearch/getinfo.tmp /home/gridcoin/.GridcoinResearch/getinfo.json grc getstakinginfo > /home/gridcoin/.GridcoinResearch/getstakinginfo.tmp && mv -f /home/gridcoin/.GridcoinResearch/getstakinginfo.tmp /home/gridcoin/.GridcoinResearch/getstakinginfo.json grc getdifficulty > /home/gridcoin/.GridcoinResearch/difficulty.tmp && mv -f /home/gridcoin/.GridcoinResearch/difficulty.tmp /home/gridcoin/.GridcoinResearch/difficulty.json

mv is faster on a local filesystem.

Edit: This will also make it so there wont always be 6 files in the directory also.

iFoggz commented 7 years ago

Ive made another change to my stats.sh as the excessive repeating of path shouldn't be needed at all. Let's clean it up??

GRCPATH='/home/gridcoin/.GridcoinResearch/'
grc getinfo > "$GRCPATH"/getinfo.tmp && mv -f "$GRCPATH"/getinfo.tmp "$GRCPATH"/getinfo.json
grc getstakinginfo > "$GRCPATH"/getstakinginfo.tmp && mv -f "$GRCPATH"/getstakinginfo.tmp "$GRCPATH"/getstakinginfo.json
grc getdifficulty > "$GRCPATH"/difficulty.tmp && mv -f "$GRCPATH"/difficulty.tmp "$GRCPATH"/difficulty.json
NickAnEngineer commented 7 years ago

@Foggyx420 do you want to update the gridcoin_netdata_stats.sh file in the service folder too? It can all be merged in one then. I can't at the moment but that script is just a mirror or the stats.sh with all the timing stuff ripped out.

iFoggz commented 7 years ago

there is a gridcoin_netdata_stats.sh file? hrm i wasn't aware of that. have stats.sh running with source and modifications to that has been whats affected the output on the charts for me.

NickAnEngineer commented 7 years ago

I added out in my last PR. In the getinfo/service directory. Not sure why i buried it in there.

On 22 Apr 2017 8:47 p.m., "Foggyx420" notifications@github.com wrote:

there is a gridcoin_netdata_stats.sh file? hrm i wasn't aware of that. have stats.sh running with source and modifications to that has been whats affected the output on the charts for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/grctest/GRC-Netdata/issues/3#issuecomment-296397043, or mute the thread https://github.com/notifications/unsubscribe-auth/AAoorBvu3v1HV5xno6rb10vLph143NKHks5ryllagaJpZM4MuRI6 .

iFoggz commented 7 years ago

ah i haven't seen that directory lol I just followed the installation steps and did the stats.sh and gridcoin.chart.sh file ;p i'm gonna have a gander now

iFoggz commented 7 years ago

also explains why i couldn't request changes on her myself as in total wrong area

iFoggz commented 7 years ago

my bad it doesn't cause an issue but change GRCPATH='/home/gridcoin/.GridcoinResearch/' to GRCPATH='/home/gridcoin/.GridcoinResearch'

iFoggz commented 7 years ago

Pull request #10

iFoggz commented 7 years ago

this should be good to close with pull request #11 merged