Bitcoin Forum
December 09, 2016, 11:50:56 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [Phoenix Addon] Simple export hashrate and accepted/rejected to a text file  (Read 3032 times)
shivansps
Sr. Member
****
Offline Offline

Activity: 346


View Profile
July 11, 2011, 02:06:34 AM
 #1

Hi, i posted the code in the phoenix tropic, but i place it here. I done this to help me monitor my miners.

What this mod do is add a new command line argument ( -l ), this allow you to set a output filename for the status.

Examples:
Quote
./phoenix.py -u http://user:pass@server:port -k kernel device=x WORKSIZE=128 VECTORS AGGRESSION=12 BFI_INT FASTLOOP=FALSE -l hashrate.txt
That one will output the file to the phoenix folder.

Quote
sudo ./phoenix.py -u http://user:pass@server:port -k kernel device=x WORKSIZE=128 VECTORS AGGRESSION=12 BFI_INT FASTLOOP=FALSE -l /usr/hashrate.txt
That one will place the file intro the /usr folder, sudo is required for permision.

I use .txt as a example, the extension does not matter. You can call it index.html and place intro the apache web folder it you want.

The output is something like this, in a single line, no attachments.
Quote
[400.31 Mhash/sec] [0 Accepted] [0 Rejected] [RPC]

You need to edit the code in phoenix.py and ConsoleLogger.py.

phoenix.py

Search for:
Code:
self.queue = None
Put this below:
Code:
       self.queue = None
       self.logtotext = None

Search for:
Code:
       parser.add_option("-a", "--avgsamples", dest="avgsamples", type="int",
            default=10,
            help="how many samples to use for hashrate average")
reemplace with:
Code:
       parser.add_option("-a", "--avgsamples", dest="avgsamples", type="int",
            default=10,
            help="how many samples to use for hashrate average"),
        parser.add_option("-l", "--logtotext", dest="logtotext", default="none",
            help="-l filename.txt log hashrate to text option, disabled by default")

Search for:
Code:
self.logger = ConsoleLogger(miner,self.parsedSettings.verbose)
Reemplace with this:
Code:
self.logger = ConsoleLogger(miner,self.parsedSettings.verbose,self.parsedSettings.logtotext)


ConsoleLogger.py

Search for:
Code:
   def __init__(self, miner, verbose=False):
        self.verbose = verbose
        self.miner = miner
        self.lastUpdate = time() - 1
        self.rate = 0
        self.accepted = 0
        self.invalid = 0
        self.lineLength = 0
        self.connectionType = None
Reemplace with this:
Code:
   def __init__(self, miner, verbose=False, logtotext="none"):
        self.verbose = verbose
        self.miner = miner
        self.logtotext = logtotext
        self.lastUpdate = time() - 1
        self.rate = 0
        self.accepted = 0
        self.invalid = 0
        self.lineLength = 0
        self.connectionType = None

Search for:
Code:
self.say(status)
self.lastUpdate = time()
Reemplace with this:
Code:
           self.say(status)
            if self.logtotext != "none":
                try:
                        f = open(self.logtotext,"w")
                        f.write(status)
                        f.close()
                except IOError as e:
                        print("({})".format(e))
           self.lastUpdate = time()

All credits are for jedi95, its his miner, i just did a small addon for it.  Wink

1NEvmZTwLhqBgr3h7LwZap1sEHsyf3QFuv
1481284256
Hero Member
*
Offline Offline

Posts: 1481284256

View Profile Personal Message (Offline)

Ignore
1481284256
Reply with quote  #2

1481284256
Report to moderator
1481284256
Hero Member
*
Offline Offline

Posts: 1481284256

View Profile Personal Message (Offline)

Ignore
1481284256
Reply with quote  #2

1481284256
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481284256
Hero Member
*
Offline Offline

Posts: 1481284256

View Profile Personal Message (Offline)

Ignore
1481284256
Reply with quote  #2

1481284256
Report to moderator
1481284256
Hero Member
*
Offline Offline

Posts: 1481284256

View Profile Personal Message (Offline)

Ignore
1481284256
Reply with quote  #2

1481284256
Report to moderator
fpgaminer
Hero Member
*****
Offline Offline

Activity: 546



View Profile WWW
July 11, 2011, 03:47:09 AM
 #2

Very useful feature! A small quibble: Why are you opening and closing the file every time? That's very wasteful.


I was too lazy to modify phoenix when I discovered a need for logging, so I use a script like this (poclbm is the example here):

Code:
./poclbm.py --verbose blahblahmoreargs -d $1 > ~/miner_log_$1.txt 2>&1

And then I can execute ./miner.sh 0 & or ./miner.sh 1 &, etc to bring up all my miners. I use tail -f ~/miner_log_0.txt to monitor the log, and do so remotely over SSH with multitail Smiley

Anyway, I'm glad someone took the time to put some file logging into phoenix!

shivansps
Sr. Member
****
Offline Offline

Activity: 346


View Profile
July 11, 2011, 06:40:08 AM
 #3

I could open it at begining and them just attach, but i like to have no need for parsing the file to get the last hashrate. Single line make it easy to use it later, and i like that the file will never increase in size.

Personally i have no problems with opening/closing the file, as im using a temp folder on mem, that folder its actually the apache 2 root folder, so i can access those text file from my server, making a php web page with a updated hash rate and temps of every miner i have, it maybe wastefull but even writting on a pendrive has no issues for the miner, of course, you will destroy the pendrive if you store the file in it Tongue

Thats makes monitoring my miners very very easy. Im using that method you explained to export to text file the temperatures of my cards, those file are also uploaded to the same folder.

Also, i have some single vga rigs using my minerpe, under Windows based operative system you cant do that with phoenix... you end with a file of over a 1gb in size in 2 hours lol, and its very very difficult to parse.

Im not a Python programer, im C/C++, so there maybe some way to do so whiout opening the file everytime, in c i could just move the pointer to the begining of the file everytime.

1NEvmZTwLhqBgr3h7LwZap1sEHsyf3QFuv
shotgun
Member
**
Offline Offline

Activity: 98



View Profile
July 13, 2011, 10:01:43 PM
 #4

Great work! It's all good except the error here:

Code:
            self.lastUpdate = time()e
needs to be

Code:
            self.lastUpdate = time()

<luke-jr> Catholics do not believe in freedom of religion.
shivansps
Sr. Member
****
Offline Offline

Activity: 346


View Profile
July 14, 2011, 12:29:30 AM
 #5

ups, it must be a typo Tongue thanks for reporting.

1NEvmZTwLhqBgr3h7LwZap1sEHsyf3QFuv
grue
Global Moderator
Legendary
*
Offline Offline

Activity: 1932



View Profile
July 15, 2011, 01:46:58 AM
 #6

ups, it must be a typo Tongue thanks for reporting.
oh the irony!

It is pitch black. You are likely to be eaten by a grue.

Tired of annoying signature ads? Ad block for signatures
thejfk
Newbie
*
Offline Offline

Activity: 9


View Profile
July 15, 2011, 06:44:09 AM
 #7

I think my solution using XML-RPC is a bit more elegant: http://forum.bitcoin.org/index.php?topic=23308.0
grue
Global Moderator
Legendary
*
Offline Offline

Activity: 1932



View Profile
July 15, 2011, 06:39:30 PM
 #8

can someone compile this to a windows .exe? i got python installed, but executing .py files is really screwing up my scripts

It is pitch black. You are likely to be eaten by a grue.

Tired of annoying signature ads? Ad block for signatures
disq
Jr. Member
*
Offline Offline

Activity: 41



View Profile
July 16, 2011, 11:37:34 AM
 #9

I've modified this patch (when you first posted it to the Phoenix thread) to also include a timestamp in the file. It's distributed with the "Rug Monitor" package. Link: https://github.com/disq/bitcoin-rug-monitor/blob/master/logtotext-1.48.diff

1LFWHcXqRAfq6GiS3s7disq1p7iKkinshp <-- just to show off my address, who tips to forum signatures anyway?

Rug Monitor - Monitor your mining rigs, generate useful if not pretty charts.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!