Author

Topic: Cacti template for CGMINER monitoring (Read 9899 times)

newbie
Activity: 7
Merit: 0
March 02, 2014, 12:14:47 PM
#31
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! Cheesy

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!
newbie
Activity: 60
Merit: 0
January 27, 2014, 04:24:06 AM
#30
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"
newbie
Activity: 1
Merit: 0
January 26, 2014, 05:03:45 AM
#29
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?
full member
Activity: 133
Merit: 100
September 08, 2013, 01:35:53 PM
#28

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?

sr. member
Activity: 467
Merit: 250
September 06, 2013, 07:44:13 PM
#27

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.

newbie
Activity: 57
Merit: 0
June 13, 2013, 07:42:08 AM
#26
Then the issue on my end should be seen on bfgminer thread.
Thanks for everything though! Grin
sr. member
Activity: 350
Merit: 250
June 13, 2013, 07:39:23 AM
#25
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
newbie
Activity: 57
Merit: 0
June 13, 2013, 07:19:33 AM
#24
If you notice the rpc output i put its around 1433. So ther could be something wierd with my bfhminer.
sr. member
Activity: 350
Merit: 250
June 13, 2013, 07:16:31 AM
#23
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
newbie
Activity: 57
Merit: 0
June 13, 2013, 07:15:07 AM
#22
Im not using spine.
I used this install guide for the pi
http://n00blab.com/cacti-pi/
sr. member
Activity: 350
Merit: 250
June 13, 2013, 07:11:49 AM
#21
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 Cheesy 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 Cheesy
newbie
Activity: 57
Merit: 0
June 13, 2013, 07:00:50 AM
#20
Im also using 1 cm1
sr. member
Activity: 350
Merit: 250
June 13, 2013, 02:30:23 AM
#19
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 Cheesy

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 Wink
I know ztex can regularly push this on over clock....im only using cm1's
newbie
Activity: 57
Merit: 0
June 12, 2013, 08:19:45 PM
#18
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
)
full member
Activity: 133
Merit: 100
June 12, 2013, 06:42:27 PM
#17
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.
newbie
Activity: 57
Merit: 0
June 12, 2013, 06:39:06 PM
#16
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
full member
Activity: 133
Merit: 100
June 12, 2013, 01:00:00 PM
#15
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.

sr. member
Activity: 350
Merit: 250
June 12, 2013, 11:05:36 AM
#14
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.....
full member
Activity: 133
Merit: 100
June 12, 2013, 10:19:54 AM
#13
Just wanted to add this works v. nicely on an rPi running fpga rigs too...

Nice work Wink


[edit]
Just tested this it works for bfgminer too Wink

Good to know. Thanks for the update!
sr. member
Activity: 350
Merit: 250
June 12, 2013, 06:46:10 AM
#12
Just wanted to add this works v. nicely on an rPi running fpga rigs too...

Nice work Wink


[edit]
Just tested this it works for bfgminer too Wink
full member
Activity: 133
Merit: 100
April 26, 2012, 06:25:53 PM
#11

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.
sr. member
Activity: 467
Merit: 250
April 26, 2012, 10:41:51 AM
#10

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

legendary
Activity: 4354
Merit: 3614
what is this "brake pedal" you speak of?
April 19, 2012, 05:38:43 AM
#9
this looks great!

soon as I have some free time (next week I hope) Ill give it a go.
full member
Activity: 133
Merit: 100
April 17, 2012, 11:47:29 AM
#8
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....
full member
Activity: 133
Merit: 100
April 17, 2012, 11:42:33 AM
#7
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.

full member
Activity: 186
Merit: 100
April 16, 2012, 06:18:16 PM
#6
Will do some preliminary testing as soon as I have the time! Grand thanks to the author!
hero member
Activity: 742
Merit: 500
April 16, 2012, 04:28:54 PM
#5
Very cool.  I was looking at doing something similar until I started using BAMT.
full member
Activity: 133
Merit: 100
April 16, 2012, 04:03:43 PM
#4
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.
full member
Activity: 133
Merit: 100
April 15, 2012, 02:46:46 PM
#3
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.
full member
Activity: 186
Merit: 100
April 13, 2012, 06:20:41 AM
#2
This is absolutely awesome, keep it up and let us know when we can test it out!
full member
Activity: 133
Merit: 100
April 12, 2012, 11:22:51 PM
#1
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.
Jump to: