JinTu (OP)
|
|
April 13, 2012, 04:22:51 AM Last edit: April 17, 2012, 04:29:57 PM by JinTu |
|
Hi folks, I have had this on my todo list for months, but finally got a few cycles to get started. These templates provide graphs for the stats available from cgminer >=2.1.0 (>=2.3.2 for PGA support) JSON API to compliment my earlier work on pool and AMD GPU Cacti templates. Sample graphs from my 6990-based GPU miner: Summary Totals
Total Average Hash Rate (from MHS av) Total Hash Rate (computed from Total MH) Total Utility Total Work Total Efficiency (computed from Accepted and Getworks) Total Errors Devs
5s Average Hash Rate Average Hash Rate Fan Percent Fan Speed GPU Activity GPU Clock GPU Voltage Hash Rate Memory Clock Temperature Utility Work Pools
Work (primary pool) Work (secondary pool) Errors (primary pool) Errors (secondary pool) Efficiency (primary pool) Efficiency (secondary pool) Looks like I may have more work to do here
Release History - v0.01 4/15/2012
First working version. Supports cgminer >=2.1.0 API JSON format (>=2.3.2 for PGA support). Supports stats from summary, pools and devs responses. Only tested with GPU support as no PGA or CPU miners were available at the time of release (caveat emptor).
Prerequisites - Installed and operational instance of Cacti (Spine and cmd.php pollers both work fine)
- Perl 5.8.5 or later
- HTTP::Request Perl module
- LWP Perl module
- JSON Perl module
- JSON::XS Perl module
Install procedure - Grab latest script/templates package from here.
- Unzip the archive
- Move cgminer_devs_stats.xml and cgminer_pools_stats.xml into your script_queries directory (i.e. cacti/resource/script_queries/)
- Move query_cgminer_stats.pl into your scripts directory (i.e. cacti/scripts/)
- Ensure query_cgminer_stats.pl runs (perl query_cgminer_stats.pl generates the help text). If this doesn't work (you see an error about something missing) see the troubleshooting section for resolving Perl issues.
- Ensure query_cgminer_stats.pl can connect to your CGMINER host, and has read access to the API (perl query_cgminer_stats.pl HOSTNAME summary). If this doesn't work, check your CGMINER options for API access to ensure the requesting host has the appropriate (read-only or read-write) rights.
- Import the cacti_host_template_cgminer_host.xml host template from the Cacti web GUI.
- Create a new host in Cacti, selecting the CGMINER Host host template. Set the hostname to your CGMINER hostname or IP. Be sure to disable Downed Host Detection and SNMP unless you have SNMP operational on your host.
Trouble Shooting Perl issues - The most common Perl issue is missing modules. Have a look at this link for assistance in setting up CPAN and testing for missing modules.
- If you have a Redhat-based distro (RHEL, CentOS, etc), and would prefer to use the RPMs instead of mucking about with CPAN, the perl-libwww-perl RPM (from upstream provider) contains HTTP::Request and other LWP modules. perl-JSON, perl-JSON-XS and perl-Cache-Memcached RPMs are available on RPM Forge and/or EPEL
- These modules are also available in PPM form for ActiveState's ActivePerl on Windows, but as I don't run Windows I can't verify the details.
|
|
|
|
The LT
|
|
April 13, 2012, 11:20:41 AM |
|
This is absolutely awesome, keep it up and let us know when we can test it out!
|
|
|
|
JinTu (OP)
|
|
April 15, 2012, 07:46:46 PM |
|
I made significant progress on the devs API support over the past 24 hours and expect to post some additional sample graphs after I have a full 24 hours of data collected.
I don't have access to a cgminer supported PGA, or have CPU mining enabled on my rigs so there might be a few bugs in those areas. If anyone has either of these, would you mind posting the API output from the devs API call, e.g. php api-example.php devs it would help out immensely.
|
|
|
|
JinTu (OP)
|
|
April 16, 2012, 09:03:43 PM |
|
Initial version posted. Graphs for pool stats are forthcoming. - v0.01 4/15/2012
First working version. Supports cgminer >=2.1.0 API JSON format (>=2.3.2 for PGA support). Supports stats from summary, pools and devs responses. Only tested with GPU support as no PGA or CPU miners were available at the time of release (caveat emptor).
Have at it and let me know if anything looks amiss.
|
|
|
|
Red Emerald
|
|
April 16, 2012, 09:28:54 PM |
|
Very cool. I was looking at doing something similar until I started using BAMT.
|
|
|
|
The LT
|
|
April 16, 2012, 11:18:16 PM |
|
Will do some preliminary testing as soon as I have the time! Grand thanks to the author!
|
|
|
|
JinTu (OP)
|
|
April 17, 2012, 04:42:33 PM |
|
Very cool. I was looking at doing something similar until I started using BAMT.
BAMT is pretty cool and has it's place. This is more for folks who run mining farms and want aggregate their monitoring, who prefer to run other OS/platform combinations than are supported by BAMT or want to extend/enhance their monitoring capabilities beyond what is possible in BAMT alone. Since Cacti and CGMINER are both multi-platform you can easily support mixed environments of Linux and Windows.
|
|
|
|
JinTu (OP)
|
|
April 17, 2012, 04:47:29 PM |
|
I just added some sample pool graphs from two of the mining pools my rigs use.
The Efficiency numbers are calculated from (Accepted/Getworks) * 100 and don't appear to be working properly for anything other than the active pool. More research is needed here....
|
|
|
|
vapourminer
Legendary
Offline
Activity: 4494
Merit: 4067
what is this "brake pedal" you speak of?
|
|
April 19, 2012, 10:38:43 AM |
|
this looks great!
soon as I have some free time (next week I hope) Ill give it a go.
|
|
|
|
dlasher
|
|
April 26, 2012, 03:41:51 PM |
|
just wanted to say.. well done...
downloaded, followed the directions, and it just -- worked --
Thanks, for this, and the other scripts of yours I'm running. /clap
|
|
|
|
JinTu (OP)
|
|
April 26, 2012, 11:25:53 PM |
|
just wanted to say.. well done...
downloaded, followed the directions, and it just -- worked --
Thanks, for this, and the other scripts of yours I'm running. /clap
Glad to hear it! Let me know if you see anything weird.
|
|
|
|
evilscoop
|
|
June 12, 2013, 11:46:10 AM Last edit: June 12, 2013, 03:11:28 PM by evilscoop |
|
Just wanted to add this works v. nicely on an rPi running fpga rigs too... Nice work [edit] Just tested this it works for bfgminer too
|
|
|
|
JinTu (OP)
|
|
June 12, 2013, 03:19:54 PM |
|
Just wanted to add this works v. nicely on an rPi running fpga rigs too... Nice work [edit] Just tested this it works for bfgminer too Good to know. Thanks for the update!
|
|
|
|
evilscoop
|
|
June 12, 2013, 04:05:36 PM Last edit: June 12, 2013, 04:22:03 PM by evilscoop |
|
Actually just spotted a tiny prob with bfgminer... perl /var/www/cacti/scripts/query_cgminer_stats.pl 127.0.0.1 devs get MHS_5s PGA1, output: 400.77840077.8
I figure this is related to :- print shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); Might be an idea to add a check for second . and drop anything after it... Think that way it should work for both miners Ive done a temp hack (im no coder, just a sys admin) and added :- elsif (($ARGV[3] eq "Utility") || ($ARGV[3] eq "MHS_5s") || ($ARGV[3] eq "MHS_av") || ($ARGV[3] eq "Temperature")) { #print shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); my $thingy = shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); print substr $thingy, 0, 4; }
This has fixed the graphing for now, but its dirty.....
|
|
|
|
JinTu (OP)
|
|
June 12, 2013, 06:00:00 PM |
|
Actually just spotted a tiny prob with bfgminer... perl /var/www/cacti/scripts/query_cgminer_stats.pl 127.0.0.1 devs get MHS_5s PGA1, output: 400.77840077.8
I figure this is related to :- print shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); Might be an idea to add a check for second . and drop anything after it... Think that way it should work for both miners Ive done a temp hack (im no coder, just a sys admin) and added :- elsif (($ARGV[3] eq "Utility") || ($ARGV[3] eq "MHS_5s") || ($ARGV[3] eq "MHS_av") || ($ARGV[3] eq "Temperature")) { #print shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); my $thingy = shiftdec($json_text->{uc($command)}->[$pga{$ARGV[4]}]->{add_spaces($ARGV[3])}, 2); print substr $thingy, 0, 4; }
This has fixed the graphing for now, but its dirty..... Hmm, that's not good. Can you send me an excerpt of the original JSON from the cgminer/bfgminer API for MHS_5s on PGA1? I need to see if it has something to do with how the number is being parsed by my script or is something inherent in cgminer/bfgminer. Also, it would be good to know if the issue only manifests in bfgminer and not cgminer.
|
|
|
|
shawtux
Newbie
Offline
Activity: 57
Merit: 0
|
|
June 12, 2013, 11:39:06 PM |
|
how can i help? also doing it with bfgminer. Av. Hash Rate is double to the real one. minning with FPGA. Should be aprox 800 MH/s but reads 1400 MH/s
|
|
|
|
JinTu (OP)
|
|
June 12, 2013, 11:42:27 PM |
|
how can i help? also doing it with bfgminer. Av. Hash Rate is double to the real one. minning with FPGA. Should be aprox 800 MH/s but reads 1400 MH/s
As with the previous issue, I need the JSON output to see if it is in fact a parsing issue with the script, or something in bfgminer.
|
|
|
|
shawtux
Newbie
Offline
Activity: 57
Merit: 0
|
|
June 13, 2013, 01:19:45 AM |
|
how do i do this? bfgminer-rpc call? or in cacti? edit: remove the .. on the Code label. ~/bfgminer $ bfgminer-rpc Reply was 'STATUS=S,When=1371086607,Code=11,Msg=Summary,Description=bfgminer 3.0.99|SUMMARY,Elapsed=73273,MHS av=1433.28,Found Blocks=0,Getworks=1598,Accepted=13654,Rejected=40,Hardware Errors=39,Utility=11.18,Discarded=3184,Stale=27,Get Failures=1,Local Work=80381,Remote Failures=0,Network Blocks=182,Total MH=105021094.3176,Work Utility=11.27,Difficulty Accepted=13654.20834668,Difficulty Rejected=40.00061036,Difficulty Stale=27.00041199,Best Share=8641|' [STATUS] => ( [STATUS] => S [When] => 1371086607 [..Code] => 11 [Msg] => Summary [Description] => bfgminer 3.0.99 ) [SUMMARY] => ( [0] => SUMMARY [Elapsed] => 73273 [MHS av] => 1433.28 [Found Blocks] => 0 [Getworks] => 1598 [Accepted] => 13654 [Rejected] => 40 [Hardware Errors] => 39 [Utility] => 11.18 [Discarded] => 3184 [Stale] => 27 [Get Failures] => 1 [Local Work] => 80381 [Remote Failures] => 0 [Network Blocks] => 182 [Total MH] => 105021094.3176 [Work Utility] => 11.27 [Difficulty Accepted] => 13654.20834668 [Difficulty Rejected] => 40.00061036 [Difficulty Stale] => 27.00041199 [Best Share] => 8641 )
|
|
|
|
evilscoop
|
|
June 13, 2013, 07:30:23 AM |
|
root@raspberrypi:~/cm1/cgminer# php api-example.php devs pga0 devs returned 'STATUS=S,When=1371108071,Code=9,Msg=0 GPU(s) - 2 PGA(s),Description=bfgminer 3.0.99|PGA=0,Name=ICA,ID=0,ProcID=0,Enabled=Y,Status=Alive,MHS av=397.310,MHS 5s=473.026,Accepted=8,Rejected=0,Hardware Errors=0,Utility=2.081,Last Share Pool=0,Last Share Time=1371108049,Total MH=91629.2762,Diff1 Work=8,Difficulty Accepted=8.00012207,Difficulty Rejected=0.00000000,Last Share Difficulty=1.00001526,Last Valid Work=1371108049|PGA=1,Name=ICA,ID=1,ProcID=0,Enabled=Y,Status=Alive,MHS av=398.541,MHS 5s=472.715,Accepted=8,Rejected=0,Hardware Errors=0,Utility=2.081,Last Share Pool=0,Last Share Time=1371108055,Total MH=91913.1709,Diff1 Work=8,Difficulty Accepted=8.00012207,Difficulty Rejected=0.00000000,Last Share Difficulty=1.00001526,Last Valid Work=1371108055|'
cgminer api php against bfgminer running raw json is beyond my understanding....if you can give me a quick script ill run it. I do feel this is a minor issue, and should be fixable without having to make another template, as bfgminer and cgminer are v.v.v. similar...tbh, truncating the replay to 3 decimals should fix this, we dont need that much precision on fpga no ive not seen this on cgminer....yet Av. Hash Rate is double to the real one. minning with FPGA. Should be aprox 800 MH/s but reads 1400 MH/s
Now thats interesting, what fpga are you using.... I can spike to 1.5G/s due to bfgminer doing its auto overclocking spread and going to 220mhz.....cgminer does not have this ability... Probably why fpga users tend to prefer bfgminer I know ztex can regularly push this on over clock....im only using cm1's
|
|
|
|
shawtux
Newbie
Offline
Activity: 57
Merit: 0
|
|
June 13, 2013, 12:00:50 PM |
|
Im also using 1 cm1
|
|
|
|
|