Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: JinTu on April 13, 2012, 04:22:51 AM



Title: Cacti template for CGMINER monitoring
Post by: JinTu on April 13, 2012, 04:22:51 AM
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 (https://bitcointalk.org/index.php?topic=23406.0) and AMD GPU (https://bitcointalk.org/index.php?topic=48828.0) Cacti templates.


Sample graphs from my 6990-based GPU miner:

Summary Totals

Total Average Hash Rate (from MHS av)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-average-hash-rate.png

Total Hash Rate (computed from Total MH)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-hash-rate.png

Total Utility
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-utility.png

Total Work
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-work.png

Total Efficiency (computed from Accepted and Getworks)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-efficiency.png

Total Errors
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-total-errors.png

Devs

5s Average Hash Rate
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-5s-average-hash-rate-GPU2.png

Average Hash Rate
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-average-hash-rate-GPU2.png

Fan Percent
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-fan-percent-GPU2.png

Fan Speed
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-fan-speed-GPU2.png

GPU Activity
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-GPU-activity-GPU2.png

GPU Clock
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-GPU-clock-GPU2.png

GPU Voltage
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-GPU-voltage-GPU2.png

Hash Rate
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-hash-rate-GPU2.png

Memory Clock
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-memory-clock-GPU2.png

Temperature
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-temperature-GPU2.png

Utility
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-utility-GPU2.png

Work
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-work-GPU2.png

Pools

Work (primary pool)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-work-btcguild.com.png

Work (secondary pool)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-work-api.bitcoin.cz.png

Errors (primary pool)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-errors-btcguild.com.png

Errors (secondary pool)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-errors-api.bitcoin.cz.png

Efficiency (primary pool)
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-efficiency-btcguild.com.png

Efficiency (secondary pool) Looks like I may have more work to do here
http://www.praecogito.com/bitcoin/cgminer/cacti-template/sample-images/cgminer-pool-efficiency-api.bitcoin.cz.png



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 (http://www.praecogito.com/bitcoin/cgminer/cacti-template/packages/).
  • 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 (http://www.linuxweblog.com/perl-modules-install) 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 (http://code.activestate.com/ppm/) form for ActiveState (http://www.activestate.com)'s ActivePerl (http://www.activestate.com/activeperl) on Windows, but as I don't run Windows I can't verify the details.


Title: Re: Cacti template for CGMINER monitoring
Post by: The LT on April 13, 2012, 11:20:41 AM
This is absolutely awesome, keep it up and let us know when we can test it out!


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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.


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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.


Title: Re: Cacti template for CGMINER monitoring
Post by: Red Emerald on April 16, 2012, 09:28:54 PM
Very cool.  I was looking at doing something similar until I started using BAMT.


Title: Re: Cacti template for CGMINER monitoring
Post by: The LT on April 16, 2012, 11:18:16 PM
Will do some preliminary testing as soon as I have the time! Grand thanks to the author!


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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.



Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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....


Title: Re: Cacti template for CGMINER monitoring
Post by: vapourminer on 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.


Title: Re: Cacti template for CGMINER monitoring
Post by: dlasher on 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



Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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.


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 12, 2013, 11:46:10 AM
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 ;)


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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!


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 12, 2013, 04:05:36 PM
Actually just spotted a tiny prob with bfgminer...

Quote
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 :-
Quote
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.....


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on June 12, 2013, 06:00:00 PM
Actually just spotted a tiny prob with bfgminer...

Quote
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 :-
Quote
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.



Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on 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


Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on 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.


Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on 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.
Code:
~/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
)


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 13, 2013, 07:30:23 AM
Quote
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 :D

no ive not seen this on cgminer....yet


Quote
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


Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on June 13, 2013, 12:00:50 PM
Im also using 1 cm1


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 13, 2013, 12:11:49 PM
mmm only dynamic clocker is voodoo then...how v. odd
My avg hash rate on the cacti sits happy at 878.2M
I did get a huge spike on pga1 this am to 14.24M, but id guess that was a silly easy nounce :D and I am on 220 overclock bitstream...

shaw are you using cmd.php or have you added spine to cacti...
Im asking as im using spine on the pi, wondering if it makes a diff :D


Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on June 13, 2013, 12:15:07 PM
Im not using spine.
I used this install guide for the pi
http://n00blab.com/cacti-pi/


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 13, 2013, 12:16:31 PM
yeah its a good one, I followed that too..
it has the spine how-to as well...but tbh its not saving much on task speed


Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on June 13, 2013, 12:19:33 PM
If you notice the rpc output i put its around 1433. So ther could be something wierd with my bfhminer.


Title: Re: Cacti template for CGMINER monitoring
Post by: evilscoop on June 13, 2013, 12:39:23 PM
yeah, cacti is just gonna use the same val tbh....

mine comes out fine :-
Reply was 'STATUS=S,When=1371127189,Code=11,Msg=Summary,Description=bfgminer 3.0.99|SUMMARY,Elapsed=17012,MHS av=878.277

v. v. odd


Title: Re: Cacti template for CGMINER monitoring
Post by: shawtux on June 13, 2013, 12:42:08 PM
Then the issue on my end should be seen on bfgminer thread.
Thanks for everything though! ;D


Title: Re: Cacti template for CGMINER monitoring
Post by: dlasher on September 07, 2013, 12:44:13 AM

hoping there's an update or two soon to recognize ASIC miners...my individual miner graphs have gone blank since I pulled out the GPU's and plugged in the ASIC.



Title: Re: Cacti template for CGMINER monitoring
Post by: JinTu on September 08, 2013, 06:35:53 PM

hoping there's an update or two soon to recognize ASIC miners...my individual miner graphs have gone blank since I pulled out the GPU's and plugged in the ASIC.



I have seen some abnormalities with the individual miner stats as well, but they show some data. You aren't seeing anything at all?



Title: Re: Cacti template for CGMINER monitoring
Post by: hawaiianguy on January 26, 2014, 10:03:45 AM
Hey guys, I am trying this out on cgminer 3.7.2 but am running into this problem:

rig@home:/usr/local/share/cacti/scripts$ ./query_cgminer_stats.pl 192.168.1.110 summary
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at ./query_cgminer_stats.pl line 65

does anyone know what might be wrong here?


Title: Re: Cacti template for CGMINER monitoring
Post by: fishyfishy on January 27, 2014, 09:24:06 AM
Hey guys, I am trying this out on cgminer 3.7.2 but am running into this problem:

rig@home:/usr/local/share/cacti/scripts$ ./query_cgminer_stats.pl 192.168.1.110 summary
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at ./query_cgminer_stats.pl line 65

does anyone know what might be wrong here?

Be sure to start cgminer with below parameters:

 --api-listen --api-network --api-allow "your_server_ip"


Title: Re: Cacti template for CGMINER monitoring
Post by: euphoria360 on March 02, 2014, 05:14:47 PM
Thanks for your scripts, especially the Perl one. I had some issues with templates but i was able to start from your perl script and get to nice and beautiful graphs.

Finally I know what the hell is happening in those damn rigs! :D

I have a question, which can be a suggestion.

Using cgminer's own miner.php, I can see a parameter in the summary tab called "Weighted Utility". It's an important parameter which is calculated from "total Diff1 works accepted per minute".
This is simply what pool sees and can give us the hash rates we see on pool's page.

As it's available on miner.php means it is readable via cgminer's API. now, can I ask you to implement it in your perl file, so I can use it for the final graph? Unfortunately I have no knowledge of scripting and API's.

And again, thanks for sharing this script, you made a lazy miner, learn how to use cacti!