Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: slimcoin on January 03, 2014, 11:35:33 PM



Title: Advanced CGMiner-Monitor and Commander: Remote Access to CGMiner without SSH
Post by: slimcoin on January 03, 2014, 11:35:33 PM
CGMiner-Monitor and Commander

Advanced monitoring and commanding python script with console display, http server, and email alerts.
Enables cgminer to be controlled remotely without ssh by using encrypted emails with specific subjects and bodies to communicate from the commander script to the monitor script. This script is also extremely configurable, allowing for every aspect of it to be modified to the user's liking.

Works on GNU/Linux, may need some modification to work on other platforms.

https://github.com/JSmith-BitFlipper/cgminer-monitor (https://github.com/JSmith-BitFlipper/cgminer-monitor)
Tested with python 2.7.3 and cgminer 3.7.2.
Additional crypto modules for the email encryption may be needed.

CGMiner-Monitor script
cgminer-monitor.py

 - Supports multi-gpu setups
 - Checks for incoming commands from the Commander script as a system for remote commanding of miner without ssh
 - Supports Email encryption (AES) for added security
 - Monitors cgminer by checking critical values
 - Emails if something is wrong
 - Checks the Internet connection periodically
 - Restarts cgminer if the GPU is sick or dead
 - Runs a dead simple http server that only serves a page with the results of the monitor (identical to the console output with a nice display)
 - Monitors MMFCE pools and display the current balance in their currencies
 - CTRL+C to stop the script
 - Extremely configurable allowing all aspects to be changed to the user's liking

Usage for the Cgminer-Commander Script
cgminer-commander.py

 - If configured correctly, handles all of the formating and encryption of emails
 - When sending command emails, specific format must be followed
 - The commands are from cgminer's API, a list of the commands can be found in cgminer's API-README file
        Format: command, parameter1, parameter2, etc;
                Example:
                        gpu, 0;
                        gpuintensity, 0, 13;
                        status;
                        quit;

 - API commands executed from top to bottom
 - Replies from cgminer's API will be emailed back

Credits
CGMinerClient class based on  WyseNynja's gist https://gist.github.com/WyseNynja/1500780
cgminer-monitor.py based on https://github.com/shazbits/cgminer-monitor

Comments
I know there are plenty of monitors for miners, yet none suited my needs. I improved this monitor from shazbits' to be able to command my miner remotely. I also added some more customization and created an entire commander script that does the formating and encryption. This monitor/commander bundle is a simple alternative to ssh'ing and is easier to setup. It is fairly lightweight and small in size, and there is no need for compilation. It still does not compensate the security factor.

Setup
1. Install python-pip in order to install the necessary modules (replace apt-get with your distro installation manager)
        sudo apt-get install python-pip
2. Install the python development headers needed to install the crypto modules
        sudo apt-get install python-dev
3. Install crypto modules
        sudo pip install pycrypto
4. Open cgminer-monitor.py in an editor and set the user configurations at the top
5. Open cgminer-commander.py in an editor and set the user configurations at the top
6. Run the scripts
        sudo python cgminer-monitor.py
                Starts the monitor, run this on the mining rig
        python cgminer-commander.py
                Starts the commander, run this on the commanding computer

*Note*
In order for the script to use the cgminer's api, '--api-listen --api-allow W:127.0.0.1' must be included in the cgminer command or configuration file


Title: Re: CGMiner-Monitor and Commander: Advanced monitoring and commanding python tools.
Post by: Pt0x on January 04, 2014, 02:00:30 AM
I will try this as soon as I can!

Looks very promising!



Title: Re: Advanced CGMiner-Monitor and Commander: Remote Access to CGMiner without SSH
Post by: Doomsby on January 28, 2014, 01:28:06 AM
Sorry I am new to Linux/python, I need a little help setting it up.
I am using linux BAMT with 4 Sapphire Toxic 280x.
I did this:

        sudo apt-get install python-pip

        sudo apt-get install python-dev

        sudo pip install pycrypto

4. Open cgminer-monitor.py in an editor and set the user configurations at the top
5. Open cgminer-commander.py in an editor and set the user configurations at the top

Now what?? I feel like I am missing something.

Are these files suposed to be in a specific place: cgminer-monitor.py , cgminer-commander.py ?


Title: Re: Advanced CGMiner-Monitor and Commander: Remote Access to CGMiner without SSH
Post by: slimcoin on February 02, 2014, 09:40:56 PM

Now what?? I feel like I am missing something.


Here is how to run the scripts:

        'sudo python cgminer-monitor.py'
                Starts the monitor, run this on the mining rig
        'python cgminer-commander.py'
                Starts the commander, run this on the commanding computer, ie the off-site computer

I will be pushing a new release of the monitor script to Github that will not require the sudo privileges