Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: jdape on November 30, 2013, 07:21:33 PM



Title: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu, ASIC, &more
Post by: jdape on November 30, 2013, 07:21:33 PM
Tired of finding miners sick, dead, or crashed for long periods of time?  I was!  Here's cgmon, a lightweight, free, and open source script which performs these functions in Linux:

  • Monitors health of all GPU's & ASIC's.  If a GPU crash or problem is detected, reboots the computer and starts mining automatically.
  • Auto restart cgminer when it crashes.
  • Auto restart of computer if cgminer becomes unresponsive.
  • Monitors Accepted Share counts per GPU/ASIC - restart & notify if a GPU/ASIC is not outputting accepted shares.
  • Monitors network connection and mining pools for outages.
  • Email notification of all actions.
  • Now has SMTP AUTH support for gmail and other ISPs*
  • Automated version checking and upgrading
  • Runs via command line in 'screen' so you can access cgminer at anytime.
  • Runs cgminer in the background
  • Can be started/viewed via SSH
  • Supports unlimited GPU's/ASIC's.
  • Supports up to five mining pools.
  • Supports sgminer 4.0.0

Requires: PHP, TCL, and screen.

Compatible with:
cgminer 3.1.1 -> 3.7.2
sgminer 4.0.0
vertminer

Tested in Ubuntu, CentOS, and BAMT.  Should work in all other unix-based operating systems.

I'm sure there are bugs.  Report them in this thread.

Latest version released on 2/16/2014: cgmon 1.0.5
Download: http://www.forked.net/~apex/cgmon/cgmon.tcl (http://www.forked.net/~apex/cgmon/cgmon.tcl)

Installation Instructions
Code:
 
1) Install PHP, TCL and screen.  
 CentOS: yum install php53 tcl screen
 Ubuntu: apt-get install php5 php5-cli tcl screen

 2) Edit the following line with your path to cgmon.tcl and then add it to /etc/crontab. *must run as root for DEAD/SICK GPU/ASIC rebooting.
    */2 * * * * root /home/user/cgmon.tcl >/dev/null 2>&1

 3) chmod +x cgmon.tcl

 4) Fill out the configuration sections in cgmon.tcl and test the script by running it directly: ./cgmon.tcl

 5) Sit back and enjoy a steadier flow of income :)
 

*SMTP AUTH require tcllib and tcl-tls.  See inscruction in cgmon.tcl auth settings.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: pciccone on December 11, 2013, 04:00:39 PM
This really is a great script! ;D Just 2 small problems I found in it:

- HELO command is missing on the socket send in the sendmail function. This is required by most SMTP servers to accept mail. It should be the first thing sent. i.e.
        puts $sockid "HELO $hostname"

- My cgminer (at least 3.7.2 very popular version for scrypt mining) has the PHP API as 'api-example.php' in the directory. Threw me off for a minute, was not sure which was required till I dug in and figured it out.

Phil


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on December 13, 2013, 05:37:56 AM
Wow, glad you like it. :)  

Were your emails not being sent before you added that line?  Mine haven't had that issue.   Perhaps my mail server just isn't that picky  (sendmail)?

I've made a *bunch* of improvements and fixed more bugs, so I'll need to upload a new version soon....


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on December 13, 2013, 06:30:18 AM

New version in the works:

*) Shell script built-in.
*) cgminer API built-in.  No need to mess with that file at all anymore.
*) Checks for miners that are not outputting Accepted shares (i.e. cgminer is running, but not outputting good shares).
*) Timestamps in emails and logfile
*) Improved error reporting
*) Simplified configuration


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: elproducto on December 30, 2013, 06:22:19 AM
Great program.  I was just not sure if it was running or not. It was not.  I issued ./cgmon.tcl after entering all the parameters in the cgmon.tcl file.  Some parameter where wrong and was able to repair with the information outputted from the script.  I needed to install PHP5 guess I missed the dependencies on the first post.  I had a some suggestions since your are working on a new version would the script be able to restart the computer in case it is unable to restart cgminer, also would it be possible to monitor temperature and throttle intensity based on if a GPU reaches a certain temperature.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on December 30, 2013, 05:07:05 PM
The current version will restart the computer if any GPU crashes.  This feature only works if you are running the script as root.   

Alternatively, it should be possible to setuid root the 'shutdown' command  to avoid running the script as root.  I haven't tried this.

If a GPU hits or exceeds cgminers '--temp-overheat' setting, the computer will be restarted.  This is 85 degrees by default.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on December 31, 2013, 02:39:22 AM
New version is out. :)

Changes since last release
  • Built cgminer api into script (easier setup).
  • Timestamps in logfile and email notifications.
  • HELO mail fix.
  • Simplified configuration.
  • Added broadcast message before rebooting server.
  • Moved cgmon-mine.sh to /tmp/ so the script can run as the cgminer user.
  • Moved cgminer api to /tmp/.
  • Secondary mining pool is now optional.

TODO:
  • check for Accepted shares
  • notify on GPU overheat


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: elproducto on January 05, 2014, 06:55:18 AM
The current version will restart the computer if any GPU crashes.  This feature only works if you are running the script as root.   

Alternatively, it should be possible to setuid root the 'shutdown' command  to avoid running the script as root.  I haven't tried this.

If a GPU hits or exceeds cgminers '--temp-overheat' setting, the computer will be restarted.  This is 85 degrees by default.

Thanks for the update.  I have updated my miner to the latest version I will let you know if i find any issue, i doubt I will.  I have yet to receive and emails from the program but have found a miner not responding, but I am still investigating the cause.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 05, 2014, 07:22:38 PM
Check the log file called 'cgmon.log'.  It is updated each time the script runs with the current status of cgminer.  You'll be able to see if it's working, or if there's a problem.

Currently there's no error checking of email notifications.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: tfbpa on January 16, 2014, 04:58:59 PM
Thanks very much for the script. I had to change and add a few settings, but all is working great now. Finally, I can sleep...


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: polde on January 19, 2014, 03:16:01 AM
Thx for that script its relay nice. Just need to test email notification.

Can I use gmail.smtp.com for sending email or i must setup my one smtp?

otherwise script is working nice with small modification; path to cgminer was missing.

Thx again


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: chrisbraddock on January 21, 2014, 09:35:52 PM
Hey jdape - thanks for this. Being a dev myself I started wanting to tinker with it right away. But, I don't know TCL. :)

Long story short I ended up re-implementing cgmon in JavaScript with node.js. I think it's pretty close now: node-cgmon (https://github.com/chrisbraddock/node-cgmon).

Not sure if you know JavaScript but if you ever want to consolidate efforts, let me know.

FYI, I cited cgmon in the credits (https://github.com/chrisbraddock/node-cgmon#credits).


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: suzukii on January 22, 2014, 04:52:16 AM
Wow this sounds just like what the Mining doctor ordered.   ;D

The problem is I'm a Linux virgin. 
My only experience with it is buying the Raspberry Pi Model B with Minepeon version 2.4.3 three weeks ago.

I got the Minepeon image loaded up on it & it has been countless manual reboots ever since whenever 1, 2 or 4 of my 9 erupters go on vacation while my viewing them from a windows browser.

Anyone have idiot proof instructions on how to get this added to my system?

Keep in mind that the only thing Linux I know to do is to load the Putty Windows app to SSH in from my Windows PC & ad the MobileMiner app.

Basically I am asking for hand holding.  It's probably easy for most on here, but not for this old rooky trying to do a little mining in between newborn baby boy feedings & diaper changes.  The wife takes over at night.


Thanks in advance for any help.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Reg1x on January 26, 2014, 07:00:08 PM
This scrip is installed on LTC bamt i think? or not?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 26, 2014, 08:04:49 PM
This scrip is installed on LTC bamt i think? or not?

It will run in BAMT.  You would need to install TCL and screen if they're not already included.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 26, 2014, 08:31:41 PM
Can I use gmail.smtp.com for sending email or i must setup my one smtp?

Gmail SMTP requires authentication, which is not supported in cgmon.tcl.  You could try using your local ISPs smtp server.


Quote
otherwise script is working nice with small modification; path to cgminer was missing.

Thanks.  I've added a test in the latest version that addresses this issue.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 26, 2014, 08:55:56 PM
Uploaded new version:

cgmon 0.1b5
  •    Fixed .sh ownership problem
  •   Added test for cgminer/cgminer path
  •   Split cgminer_cmd into cgminer_path and cgminer_extra_options for ease of use

Download: http://www.forked.net/~apex/cgmon/cgmon.tcl


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 26, 2014, 09:01:40 PM
Hey jdape - thanks for this. Being a dev myself I started wanting to tinker with it right away. But, I don't know TCL. :)

Long story short I ended up re-implementing cgmon in JavaScript with node.js. I think it's pretty close now: node-cgmon (https://github.com/chrisbraddock/node-cgmon).

Not sure if you know JavaScript but if you ever want to consolidate efforts, let me know.

FYI, I cited cgmon in the credits (https://github.com/chrisbraddock/node-cgmon#credits).


Awesome work!  Looks like you added a lot of  features and options too.

Unfortunately, I don't know any JS. :/


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: sbmager on January 27, 2014, 10:22:47 PM
Jdape, great script!  Thanks.

Question - is there any way to configure smtp authentication in the cgmon.tcl script? Gmail and my ISP (verizon) require authentication (ports 465 or 587).  

Thanks  


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 27, 2014, 11:23:31 PM
By any chance would this also support sgminer if I just change the directories and exe files it points to to sgminer?  Looking to use this with BAMT 1.3.  Thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 12:21:42 AM
By any chance would this also support sgminer if I just change the directories and exe files it points to to sgminer?  Looking to use this with BAMT 1.3.  Thanks!


I haven't tested sgminer, but it should work.  Remove '--scrypt' from cgmon.tcl since sgminer doesn't use this option.   i.e:
Code:
set cgminer_option1 "--scrypt"
should be
Code:
set cgminer_option1 ""

If you try it and get an error let me know.  It will probably be easy to fix.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 12:25:51 AM
Jdape, great script!  Thanks.

Question - is there any way to configure smtp authentication in the cgmon.tcl script? Gmail and my ISP (verizon) require authentication (ports 465 or 587).  

Thanks  

I'm glad you find it useful. :)   

Currently there's no support for SMTP auth.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 28, 2014, 04:10:15 AM
How can I know it is working?  Is there a way to say if it drops below xx total hashrate to restart it?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 06:08:07 AM
The log file cgmon.log shows the status every time the script is run.  To see that it's working, you check the end of cgmon.log:

Code:
 tail cgmon.log



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 28, 2014, 12:24:19 PM
Oh, okay.  Silly question though, I'm not very adept at Linux (yet), and where would I find that file?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 03:55:15 PM
Oh, okay.  Silly question though, I'm not very adept at Linux (yet), and where would I find that file?

It will be in the directory you are running cgmon from.  You can also try 'locate cgmon.log' or 'find / -name cgmon.log'.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 28, 2014, 04:17:03 PM
It says, "BAMT miner couldn't find PHP.  Please install it."  When I type apt-get install php5 it says it is already the newest version.  I am on BAMT 1.3, does this matter?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 04:44:07 PM
Do this:

Code:
which php5

Take that result (probably '/usr/bin/php5') and place it into the example command below as appropriate:

Code:
 ln -s /usr/bin/php5 /usr/bin/php 


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 28, 2014, 10:55:07 PM
which php5 didn't do anything.  I did try whereis php5 and used ln -s /etc/php5 /usr/bin/php but that didn't do anything when the script tried to run.  There was also /usr/lib/php5 and /usr/share/php5, which did not produce any results when I ln -s /usr/lib/php5 /usr/bin/php or ln -s /usr/share/php5 /usr/bin/php.  I did remove the links before creating the new ones with rm.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 28, 2014, 11:00:13 PM
Sorry, I'm not sure where PHP is locate in BAMT.   Try asking in a BAMT-related forum perhaps?

Once you know where it's at, you can link it to /usr/bin/php.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 29, 2014, 01:57:33 AM
Got it!  I had to apt-get install php5-cli.  Once I did that the files were where you thought they would be, and then I used ln to make the softlink, and then the computer rebooted at the next monitor because it saw a sick/dead gpu, although I don't think there was one... From an earlier post of mine, is there a setting to restart cgminer/pc if hashrate falls below xx?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 29, 2014, 05:04:51 AM
The next version will send email notification or reboot if a GPU stops outputting accepted shares.  It wont be based on hash rate.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 29, 2014, 01:08:42 PM
Hey, I found this post a while ago, and as I am using sgminer and also wanted some easier customization, I have reworked the script quite a lot.

Still needs a little more work though, then I will be sharing it here.

I highly appreciate your work!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 29, 2014, 06:38:59 PM
Hey, I found this post a while ago, and as I am using sgminer and also wanted some easier customization, I have reworked the script quite a lot.

Still needs a little more work though, then I will be sharing it here.

I highly appreciate your work!

Cool.  Post it and I'll incorporate your improvements.  :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 29, 2014, 11:02:23 PM
cgmon 0.1b6 released.

  •    Now checks accepted share outputs.  If no shares in 5 (default) minutes, send email notice and reboot rig.
  •    Moved all log messages to ~$mining_user/cgmon.log instead of the current working directory of whichever user ran cgmon.
  •    Split cgminer_path into cgminer_path and cmginer_exec to support sgminer.
  •    Added support for sgminer 4.0.0.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on January 29, 2014, 11:03:35 PM
Great work guys! I love cgmon!

I am running 4X R9 280X GPU's on scrypt mining,
a few questions:

1) When i manually disable all my GPU's in cgminer, it still shows as "cgminer running and all GPU's healthy, cgmon 0.1b5"
Any idea's how cgmon can detect sick or Dead GPU's accurately?

2) Do I need to be root user to run cgmon,tcl ? since my rig reboots sometimes and i am not there 24/7, I would like cgmon to make sure cgminer is running at all times. I beleive my rig logs in as user and not root. Will cgmon still run?

Thx


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 29, 2014, 11:35:55 PM
If you add it in /etc/crontab as root, it will run by itself yes.

It needs root to be able to reboot.
After a reboot and the cron job runs, it will start cgminer.

Example:
* * * * * root /home/username/cgmon.tcl

That would run it every minute.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on January 30, 2014, 01:51:58 AM
Yes That crontab suggestion worked thx!

Here are some of the issues im having with the new cgmon 0.16b

1) I cant get Cgminer to start, it shows "cgminer not running, starting..." "cgminer started successfully"
   But nothing happens.

When i remove the cgminer_path "" blank, it works, however it restarts cgminer multiple times....

Question: What should i put in the cgminer_exec and cgminer_path
              Whats the difference between these two fields?


2) I;m also having another problem where even if i disable all my GPU's manually from CGminer i still get all "GPU's running healthy" message from cgmon.

Am I doing something wrong? shouldnt it detect DEAD GPU's and restart cgminer?

Thx
 


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 30, 2014, 03:39:33 AM
I have problems with the actual reboot, but this I would think is a BAMT issue.  I am able to fix it by changing the shutdown -r now command to reboot -f.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 02:04:25 PM
funkycold:

1: I will try to replicate it and come up with a fix.

2: That is part of jdapes code, but I do believe you have to wait at least 3 minute for it to detect it. How long have you tried to wait?


MrBobC:

I haven't tried BAMT myself, but it could have other commands, as you have already figured.
If there is an easy way to detect if the OS is BAMT, which I guess there is (will look into it) it should be easy to implement a fix, so you don't have to change it yourself.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 02:17:20 PM
Right, here is a little "bugfix":

The variable is not initialized:
# uncomment for sgminer
#set use_sgminer "yes"

Which leads to:
can't read "use_sgminer": no such variable
    while executing
"if {$mine_for == "litecoin" && $use_sgminer == "no"} {set cgminer_option1 "--scrypt" } else { set cgminer_option1 ""}"
    (file "./cgmon.tcl" line 287)

It is fixed by:
The variable is not initialized:
# uncomment for sgminer
set use_sgminer "no"
#set use_sgminer "yes"

If you uncomment the one below, the variable will be changed. In this, you can control sgminer with just commenting/uncomment the variable below.

Apart from that, the script runs for me. Did you change anything else?


Also, if you will in:
set cgminer_path ""
Then you only have to set the directory, like /home/user/sgminer/, where the sgminer file is located inside. You don't have to fill out the directory path, if you have installed cgminer, like I have by compiling and installing with "sudo make install".


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: amptivate on January 30, 2014, 03:19:33 PM
My cron log is not generated. I changed the directory for the log to /home/user/cgmon.log yet it is never generated, even when I execute the cron command manually.

I am trying to get this working with BAMT 1.3... I am getting random device being hung, and my rig is unable to reboot itself apprently.

Here is my cron.log from /var/log/ when I run the cron command directly through console

Jan 30 15:25:01 (none) /USR/SBIN/CRON[5494]: (munin) CMD (if [ -x /usr/bin/munin-cron ]; then /usr/bin/munin-cron; fi)
Jan 30 15:25:01 (none) /USR/SBIN/CRON[5495]: (root) CMD (if [ -x /etc/munin/plugins/apt_all ]; then /etc/munin/plugins/apt_all update 7200 12 >/dev/null; elif [ -x /etc/munin/plugi$
Jan 30 15:25:01 (none) /USR/SBIN/CRON[5496]: (root) CMD (/opt/bamt/mother)
Jan 30 15:25:04 (none) /USR/SBIN/CRON[5492]: (CRON) error (grandchild #5494 failed with exit status 1)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 03:27:39 PM
Try changing values to:
set cgminer_exec "cgminer"
set cgminer_path "/opt/miners/cgminer/"

Did you remember to change username in:
set mining_user "user"


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: amptivate on January 30, 2014, 03:33:26 PM
Try changing values to:
set cgminer_exec "cgminer"
set cgminer_path "/opt/miners/cgminer/"

Did you remember to change username in:
set mining_user "user"

Yes, the username is the default "user" - as is the one for BAMT...unless I need to change it to root?


The values are set to as you suggested above. I chmod it again, still nothing


Edit: this also seems to showup in syslog - Jan 30 15:35:05 (none) /USR/SBIN/CRON[6088]: (CRON) error (grandchild #6090 failed with exit status 1)

when i try to run the cron manually


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 03:38:39 PM
Does it come with any output when you run it?
Is it running in screen? Type: screen -r
To deattach, press Ctrl + A + D

Did you remember to install the required packages?
# 1) Install PHP, TCL and screen. 
# CentOS: yum install php53 tcl screen
# Ubuntu: apt-get install php5 tcl screen


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: amptivate on January 30, 2014, 03:48:13 PM
Does it come with any output when you run it?
Is it running in screen? Type: screen -r
To deattach, press Ctrl + A + D

Did you remember to install the required packages?
# 1) Install PHP, TCL and screen. 
# CentOS: yum install php53 tcl screen
# Ubuntu: apt-get install php5 tcl screen

I type "/home/user/cgmon.tcl >/dev/null 2>&1" and i get no output, just a new line...

php5, tcl, and screen are all installed and updated.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 03:51:37 PM
Oh, ">/dev/null 2>&1" is exactly for not making any output, I guess it should be removed, both from cronjob line to actually get logoutput...
When you run it manually, type:
sudo ./cgmon.tcl
That should trigger it with some output.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: amptivate on January 30, 2014, 04:27:08 PM
Oh, ">/dev/null 2>&1" is exactly for not making any output, I guess it should be removed, both from cronjob line to actually get logoutput...
When you run it manually, type:
sudo ./cgmon.tcl
That should trigger it with some output.

Thanks dr00g! Got it working! PHP wasnt in the correct directory... once the log started showing I was able to troubleshoot.

I have a question though. The reason I was looking for a monitoring solution in the first place is because my cgminer randomly freezes and stops responding. I am able to SSH through my phone or computer and coldreboot the rig. Will this script do the equivalent, or does it ONLY restart/reboot when cgminer quits completely?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 30, 2014, 05:13:54 PM
I had that problem aswell, in my case it turned out my GPU apparantly didn't like my thread-concurrency...

Anyway, to solve it I found a script which I found here a while ago: http://forum.feathercoin.com/index.php?topic=5989.0

Add this to a file, like /home/username/amd_crash_monitor.sh

#!/bin/bash
if ( dmesg | grep "ASIC hang happened" ); then
  echo "Catalyst has crashed! Rebooting..."
  /sbin/shutdown -r now
fi

Add it to crontab the same way as cgmon, works same way with the extra flag if you want to see output or not.

After the driver has crashed it could take a few minutes before it appears in the log, and the rig reboots.

Remember that you likely should change the reboot line to work with BAMT.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on January 30, 2014, 11:45:39 PM
Try changing values to:
set cgminer_exec "cgminer"
set cgminer_path "/opt/miners/cgminer/"

Did you remember to change username in:
set mining_user "user"

Thx dr00g!

I already had figured out the set_sgminer = "no" part, the issue was with the path.
I got everything working now.

For those who may struggle, here is what to put since the new 0.1b6 has two fields (path and exec) which kind of threw me off a little.

set cgminer_exec "cgminer"
set cgminer_path "/your/path/to/cgminer/"


About the GPU disabled. Yes i waited 3-4minutes and it did detect my DEAD/SICK GPU...one little problem, it rebooted my computer instead of cgminer...is this normal?

Here is the output message i got...

"GPU 0 no accepted shares in 458 seconds. GPU probably hung.
cgminer not running, starting....."

and it reboot my computer...Is this normal?

A small suggestion, maybe you should only reboot that particular GPU, I was looking at API commands for cgminer, The command for restarting a GPU is gpurestart|N where N is the GPU number. So gpurestart|0 would restart GPU0.

Just a suggestion, since GPU restarts are much quicker than cgminer restarts.

Thx and the only thing missing now would be:

1) Set Hash rate, if falls below reboot cgminer

Thx Guys!!



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 31, 2014, 12:29:03 AM
How can I get the e-mail notifications to work?  I tried using smtp.gmail.com:25 but that doesn't send anything.  Does anyone know of an smtp setting I could use so the e-mail gets sent?  Thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 31, 2014, 12:31:36 AM
You are welcome, promise you will teach other people mining too! ;)

It depends on what is the problem, sometimes it can require a reboot as it is the actual driver that has crashed.

What do you need that for, experiencing that hashrate drops and a cgminer restart to fix it?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 31, 2014, 12:37:41 AM
Unfortunately you can't use gmail with this script: https://bitcointalk.org/index.php?topic=353436.msg4759718#msg4759718


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 31, 2014, 01:33:42 AM
2) I;m also having another problem where even if i disable all my GPU's manually from CGminer i still get all "GPU's running healthy" message from cgmon.

Am I doing something wrong? shouldnt it detect DEAD GPU's and restart cgminer?

Thx
 

If your GPUs are disabled, cgmon won't 'see' them and so it will assume everything is running smoothly.   If one of the GPU's is marked as sick, dead, or stops outputting accepted shares, cgmon will log it, notify you, and then reboot the server.

-j


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 31, 2014, 01:37:37 AM
Right, here is a little "bugfix":

The variable is not initialized:
# uncomment for sgminer
#set use_sgminer "yes"

Which leads to:
can't read "use_sgminer": no such variable
    while executing
"if {$mine_for == "litecoin" && $use_sgminer == "no"} {set cgminer_option1 "--scrypt" } else { set cgminer_option1 ""}"
    (file "./cgmon.tcl" line 287)

It is fixed by:
The variable is not initialized:
# uncomment for sgminer
set use_sgminer "no"
#set use_sgminer "yes"

If you uncomment the one below, the variable will be changed. In this, you can control sgminer with just commenting/uncomment the variable below.

Apart from that, the script runs for me. Did you change anything else?


Also, if you will in:
set cgminer_path ""
Then you only have to set the directory, like /home/user/sgminer/, where the sgminer file is located inside. You don't have to fill out the directory path, if you have installed cgminer, like I have by compiling and installing with "sudo make install".

Thanks for this.  I've fixed the uninitialized variable error in the latest version on the website.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 31, 2014, 01:44:49 AM


Thx dr00g!

I already had figured out the set_sgminer = "no" part, the issue was with the path.
I got everything working now.

For those who may struggle, here is what to put since the new 0.1b6 has two fields (path and exec) which kind of threw me off a little.

set cgminer_exec "cgminer"
set cgminer_path "/your/path/to/cgminer/"


Thank you.  I've now added this explanation for cgminer_path:
Code:
# this is required only if your cgminer_exec binary is not installed in your mining_user PATH (like /usr/bin/ or whatever)
# example:  /home/user/cgminer-3.1.1/       (must end with a '/')
set cgminer_path ""


About the GPU disabled. Yes i waited 3-4minutes and it did detect my DEAD/SICK GPU...one little problem, it rebooted my computer instead of cgminer...is this normal?

Here is the output message i got...

"GPU 0 no accepted shares in 458 seconds. GPU probably hung.
cgminer not running, starting....."

and it reboot my computer...Is this normal?

A small suggestion, maybe you should only reboot that particular GPU, I was looking at API commands for cgminer, The command for restarting a GPU is gpurestart|N where N is the GPU number. So gpurestart|0 would restart GPU0.

Just a suggestion, since GPU restarts are much quicker than cgminer restarts.

For me at least, when a GPU goes SICK or DEAD a full reboot of the computer is always required to get the GPU working again.   This has been the case with all my rigs and GPUs.  It could still be just me though since my rigs are running mostly identical software...  Anyhow, that's why it restart the entire computer.





Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 31, 2014, 01:50:02 AM
I have a question though. The reason I was looking for a monitoring solution in the first place is because my cgminer randomly freezes and stops responding. I am able to SSH through my phone or computer and coldreboot the rig. Will this script do the equivalent, or does it ONLY restart/reboot when cgminer quits completely?

Typically cgminer will still be running when a situation requiring a reboot occurs...  So no, if a GPU crashes, it will reboot whether cgminer is running or not.

If cgminer itself crashes and stops responding -- cgmon is not setup to deal with that situation.   Let me know if that's actually what's going on and if so I can probably add a feature to reboot in that case.

-j


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on January 31, 2014, 02:06:10 AM
# 0.1b7
#   Added detection of cgminer/AMD crash aka 'asic hang' (thanks dr00g!)
#   Fixed rebooting on BAMT.
#   Default share timer changed from 5 to 10 minutes.
#   Accepted share counts and rate added to logfile.  Example below.

Code:
Jan 30 17:55:02 miner8 GPU 0 Shares accepted since last run:  16  (1.07 shares/min)
Jan 30 17:55:02 miner8 GPU 1 Shares accepted since last run:  29  (1.93 shares/min)
Jan 30 17:55:02 miner8 GPU 2 Shares accepted since last run:  1  (0.07 shares/min)
Jan 30 17:55:02 miner8 GPU 3 Shares accepted since last run:  17  (1.13 shares/min)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on January 31, 2014, 04:57:13 AM

For me at least, when a GPU goes SICK or DEAD a full reboot of the computer is always required to get the GPU working again.   This has been the case with all my rigs and GPUs.  It could still be just me though since my rigs are running mostly identical software...  Anyhow, that's why it restart the entire computer.



its fine, rebooting the computer isnt a bad idea for dead/sick GPU's considering ubuntu is really quick to reboot unlike Windows....Linux is the only way to go for continuous mining IMO....thx for everything jdape! It is getting closer to CGwatcher....



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on January 31, 2014, 05:45:22 AM
Hey, I found this post a while ago, and as I am using sgminer and also wanted some easier customization, I have reworked the script quite a lot.

Still needs a little more work though, then I will be sharing it here.

I highly appreciate your work!

Sgminer is the only way to go for newer GPU's (R9 290, R9 290X, R9 280X, etc...)
it is very stable and has lots of bugs fixed....just my opinion


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on January 31, 2014, 11:21:55 AM
I noticed just now after downloading the new cgmon that my log file says it is 0.1b8.  Did you do another release or is it mislabelled?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 31, 2014, 02:44:51 PM
No problem guys, it's great we can make this work for everyone!

jdape:
I was thinking, how do you feel about using my implementation of settings?
I think that is a lot easier to get an overview of, also you can use commented lines to make notes and "disable" options.

Also, more pools would be great, I have 5 pools in my version, which I change between.

I know my implementation is very static, but I guess it could be a lot prettier by using some lists (I am TCL noob).


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on January 31, 2014, 05:50:12 PM
 Status: PHP Warning:  socket_read(): unable to read from socket [104]: Connection reset by peer in /tmp/cgmon-api.php on line 35
 
I have this error happening. I believe that it's because I run Anubis on the side and Anubis makes the socket_read() impossible on cgmon side from time to time. Any quick way to solve this ?

Thanks

*Not Anubis's fault. I stopped pointing on that particular miner and it crashed again. I cannot go 10 minutes w/o it crashing because of that. Not sure what's wrong. Will disable it in the meantime.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on January 31, 2014, 08:29:31 PM
I think I found what the problem was. I added api-allow in the cgminer extra-options. Seems it didn't like it for some reason. It would crash after 5 mins~.

Should I put that in the Gpu_options ? Or else ?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on January 31, 2014, 09:09:04 PM
Try adding an extra line:

At line 102:
# cgminer is not running, restart it.
notice "$cgminer_exec not running, starting..."
notice "$mining_command"

With the extra line you can see the cgminer command when you run cgmon. Makes it a little easier to debug invalid arguments.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on January 31, 2014, 09:41:41 PM
/home/miner/sgminer-4.0.0/sgminer --api-listen  -o stratum+tcp://XXXX -u XXX-p XXX-g 1 -w 256 --gpu-engine 1100 --gpu-memclock 1250 --xintensity 409 --thread-concurrency 21568 -g 1 --auto-fan --temp-target 75 --gpu-powertune 20 --queue 1 --scan-time 7 --expiry 28


My command line... Weird thing is that if I don'T run cgmon, my miner is quite stable usually. I'm a bit clueless why I would get these PHP errors now.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on February 01, 2014, 12:02:31 AM
Try adding an extra line:

At line 102:
# cgminer is not running, restart it.
notice "$cgminer_exec not running, starting..."
notice "$mining_command"

With the extra line you can see the cgminer command when you run cgmon. Makes it a little easier to debug invalid arguments.

Thx thats a great addition!

I having an issue starting sgminer from cgmon.
It says "sgminer not running, starting.....
then it shows my config file (with your new addition line 102 command)
sgminer started successfully"

but nothing.....sgminer doesnt start at all...

If i start sgminer manually, it works...

Any ideas whats going on? cgminer doesnt have this issue.
here is what im doing different from cgminer to sgminer

set cgminer_exec "sgminer"
set cgminer_path "/my/path/to/sgminer/"
set use_sgminer "yes"

again, I have a shell file which starts sgminer just fine...but why isnt cgmon working?

what am i missing here?




UPDATE!!!!   

I had a "-" missing in front of the "I" in my config file.....aaarrrgghhhhhhhhh........
if it wasnt for your new command line 102  addition i would have never seen the mistake!!!

Great WORK!!! you saved me hours of debugging!!!

thx




Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rorbit on February 01, 2014, 12:21:01 PM
Hi, thanks for the script.

I've undervolted my 7950 and am now looking for stable clock speeds.  CGMon did its job and restarted after two crashes during the night.  Are these crashes due to undervolting bad for the card?

CGMon works well until I induce what I think is an AMD driver crash by manually increasing the clock speeds.  The entire system goes down.  OS is unresponsive.  I can't SSH in.

However, the cron job continues to call CGMon every five minutes.

After a hard reboot I checked the log files.  Each time CGMon was started it hung at this point:

# cgminer IS running.  Check if GPUs are healthy.
catch {exec php -f $cgminer_api notify | grep "=>" | grep "Last Not Well"} argx

Any ideas?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: bobers on February 01, 2014, 12:45:06 PM
where is cgmon.tcl at BAMT?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 01, 2014, 01:04:06 PM
funkycold:
Good to hear you fixed it, it was for that reason I originally added that line, helps you out quite a lot, especially when you are tired! ;)

rorbit:
I have a few times myself experienced that touching the clock speeds when, in my case, sgminer is running, and it locks up.
Doesn't always happen though...

bobers:
As it should (you guys with BAMT will have to give us some feedback) already work in BAMT, it's pretty easy to install.
If it will be included in BAMT as default, well, that is up to jdape and the BAMT developer :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on February 01, 2014, 05:31:06 PM
funkycold:
Good to hear you fixed it, it was for that reason I originally added that line, helps you out quite a lot, especially when you are tired! ;)

rorbit:
I have a few times myself experienced that touching the clock speeds when, in my case, sgminer is running, and it locks up.
Doesn't always happen though...

bobers:
As it should (you guys with BAMT will have to give us some feedback) already work in BAMT, it's pretty easy to install.
If it will be included in BAMT as default, well, that is up to jdape and the BAMT developer :)

Never Liked BAMT (sorry just my Opinion). It kept giving me errors, had a terrible experience with it. Ubuntu is the only way to go IMO not even Xubuntu.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 01, 2014, 08:12:09 PM
Also had a few issues with Xubuntu, but good old 12.10 seem to work for me...

Thinking about trying to use CentOS instead, if not a smaller, more suitable distro for mining.

Btw, it doesn't seem like the cron job is writing to the logfile, unless I change it to this:
* * * * * root /home/username/cgmon.tcl >> /home/username/cgmon.log

Else it ends up as a log file in /root/cgmon.log.
On another note, might be because I had set my logpath to ~/cgmon.log, and then it runs as root... Just a little heads up!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 02:45:10 AM
Hi, thanks for the script.

I've undervolted my 7950 and am now looking for stable clock speeds.  CGMon did its job and restarted after two crashes during the night.  Are these crashes due to undervolting bad for the card?

CGMon works well until I induce what I think is an AMD driver crash by manually increasing the clock speeds.  The entire system goes down.  OS is unresponsive.  I can't SSH in.

However, the cron job continues to call CGMon every five minutes.

After a hard reboot I checked the log files.  Each time CGMon was started it hung at this point:

# cgminer IS running.  Check if GPUs are healthy.
catch {exec php -f $cgminer_api notify | grep "=>" | grep "Last Not Well"} argx

Any ideas?

Sounds like cgmon is waiting to get a reply from cgminer/sgminer but because cgminer or sgminer is frozen, cgmon doesnt know what to do.    I'll add a new feature shortly to detect this situation and reboot as appropriate.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 02:47:46 AM
Also had a few issues with Xubuntu, but good old 12.10 seem to work for me...

Thinking about trying to use CentOS instead, if not a smaller, more suitable distro for mining.

Btw, it doesn't seem like the cron job is writing to the logfile, unless I change it to this:
* * * * * root /home/username/cgmon.tcl >> /home/username/cgmon.log

Else it ends up as a log file in /root/cgmon.log.
On another note, might be because I had set my logpath to ~/cgmon.log, and then it runs as root... Just a little heads up!

I too was losing messages when running via root :)

The last few cgmon versions use this for the logfile location:

Code:
set cgmon_logfile "~$mining_user/cgmon.log"

This way the messages always go to the correct location. 



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 03:02:21 AM
where is cgmon.tcl at BAMT?

You can place it anywhere in your BAMT installation.  Sorry If I have misunderstood your question.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 03:03:49 AM
0.1b9 is out.

# 0.1b8
#   All messages now correctly specify the currently running mining software (i.e. cgminer or sgminer, etc.)
# 0.1b9
#   Fixed bug with custom cgminer_path
#   If a local mining_exec is found and no executable is installed globally nor via custom_path, local exec will be used.
#   The actual mining command is now displayed when mining is attempted.  This will help immensely with finding problems.   Thanks for the idea dr00g!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: tenaciouzd on February 02, 2014, 05:14:56 AM
Is there a guide somewhere to set this up for BAMT. Sorry, I don't have a PhD in Linux to understand all the shit inside the file when I open it in leafpad. Shit, it took me long enough just to find where the hell it saved it to. But I definately would love the features this says it can offer. So I am willing to learn.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 05:20:02 AM
aaaaand 10.

# 0.1b10
#   Added support for up to 5 mining pools.
#   Now really checks to see if the mining command worked and if miner is running.  Sends email/notice upon success.  If not, displays suggestion for fixing. 
#   Now logs the command used to mine for success and failure.   Easier troubleshooting.
#   Cleaned up configuration and instructions.
#   Now has GPU options at the top of cgmon.tcl since that line gets edited the most.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 02, 2014, 06:03:47 AM
I am wondering can i custom the default screen session name (dot+hostname ) to anything i want.
can you provide a variable in next version


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 06:45:33 AM
whew.

# 0.1b11
#   Added detection of unresponsive cgminer/sgminer.

The API file has changed.   If you have been using a previous version of cgmon and you want to enable this feature -- delete /tmp/cgmon-api.php (or just reboot the computer).  It will get recreated automatically on the next run. 


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 02, 2014, 11:54:00 AM
That's a lot of changes!

There is a little bug though, pool 3 to 5 will never get added.

You can do something like this:

# Check if pool variable exist, else initialize so script doesn't break below
if {![info exists pool1]} {set pool1 ""}
if {![info exists pool2]} {set pool2 ""}
if {![info exists pool3]} {set pool3 ""}
if {![info exists pool4]} {set pool4 ""}
if {![info exists pool5]} {set pool5 ""}


# Add pools which are not empty
if {$pool1 ne ""} {append mining_command "-o $pool1 -u $pool1_user -p $pool1_pass "}
if {$pool2 ne ""} {append mining_command "-o $pool2 -u $pool2_user -p $pool2_pass "}
if {$pool3 ne ""} {append mining_command "-o $pool3 -u $pool3_user -p $pool3_pass "}
if {$pool4 ne ""} {append mining_command "-o $pool4 -u $pool4_user -p $pool4_pass "}
if {$pool5 ne ""} {append mining_command "-o $pool5 -u $pool5_user -p $pool5_pass "}


Btw, awesome job on the php timeout, been wanting that, but I couldn't figure how to do it! :)
That is funny enough how I learned about ASIC hang when I was troubleshooting what actually made it hang up - both ASIC hang and sometimes when doing OC (or voltage change I seem to remember having experienced too) hangs up the miner so you can't quit, or will recieve API replies.

Would it be possible to throw the php timeout interval as a variable from the tcl script? Just so it's easier to costumize, if needed :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on February 02, 2014, 12:38:26 PM
jdape : Would you have any idea why I was/am getting these PHP errors ?

Thanks


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 06:11:04 PM
That's a lot of changes!

There is a little bug though, pool 3 to 5 will never get added.
Hmm.  It seems to work.  Here's the code I am using now:
Code:
if {$pool3 != ""} {append mining_command " -o $pool3 -u $pool3_user -p $pool3_pass "}
If pool3 is specified in the config, it appends the pool3 variables to the mining command.



Btw, awesome job on the php timeout, been wanting that, but I couldn't figure how to do it! :)
That is funny enough how I learned about ASIC hang when I was troubleshooting what actually made it hang up - both ASIC hang and sometimes when doing OC (or voltage change I seem to remember having experienced too) hangs up the miner so you can't quit, or will recieve API replies.

Thanks!  It was a PITA to figure out actually.  Documentation wasn't very clear on timeouts in php.


Would it be possible to throw the php timeout interval as a variable from the tcl script? Just so it's easier to costumize, if needed :)
Hmm.  I don't know how one could do that since the variables in that string (the api file) are specifically not being interpreted by TCL.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 06:15:37 PM
jdape : Would you have any idea why I was/am getting these PHP errors ?

Thanks


That could happen if your cgminer/sgminer is not listening to API commands, or not listening to them on the correct hostname/port.  You need --api-listen and you should be listening on 127.0.0.1 (localhost) port 4028.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 02, 2014, 06:24:51 PM
Oh, didn't notice you put those lines in the middle of the script, just looked it (too) quickly through!

The reason I have a few lines to initialize is because then you can "deactivate" a pool from starting next time by simply commenting the poolx variable, instead of switching pool numbers or urls around.
Have been thinking if this could be done in an even smarter way, will look into that later...


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 06:26:21 PM
Oh, didn't notice you put those lines in the middle of the script, just looked it (too) quickly through!

The reason I have a few lines to initialize is because then you can "deactivate" a pool from starting next time by simply commenting the poolx variable, instead of switching pool numbers or urls around.
Have been thinking if this could be done in an even smarter way, will look into that later...

Great point.  I will have to change it to allow that behavior.  :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 06:59:56 PM
Done.

#   Changed pool configuration.  Now you can comment out unused pools or leave them blank. 

Note: In 0.1b12 the pool variables have changed format so copy/pasting old pool info into this latest download will break the script.  You'll need to enter the actual address, username, and password as required.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 02, 2014, 07:47:21 PM
Sweet implementation, much smoother than mine! :P

Now you can also cleanup 50 % of your todo! ;)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 07:49:27 PM
haha... yea.  That feature is *almost* working ;)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 08:19:51 PM
Hi there!
Could you help me to resolve the following issue.
I have added this line:"*/5 * * * *   root   /home/my username/cgmon.tcl >/dev/null 2>&1" to crontab and after the system boots nothing happens but in 5 minutes cgmon starts. Does it happens because  my PC connects to internet through wifi and it takes 10-15 seconds to connect to router after booting and therefore after booting cgminer cood not connect to the pool and only after checking of cgmon in 5 minutes it restarts cgminer again?
Thank you.


By default the cronjob runs every fifth minute of the hour.  So your miner would get started within 5 minutes of booting.  If you want, you can change */5 to */1 or */2 so it checks every minute or two instead.   


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 08:24:11 PM
Hi there!
Could you help me to resolve the following issue.
I have added this line:"*/5 * * * *   root   /home/my username/cgmon.tcl >/dev/null 2>&1" to crontab and after the system boots nothing happens but in 5 minutes cgmon starts. Does it happens because  my PC connects to internet through wifi and it takes 10-15 seconds to connect to router after booting and therefore after booting cgminer cood not connect to the pool and only after checking of cgmon in 5 minutes it restarts cgminer again?
Thank you.


By default the cronjob runs every fifth minute of the hour.  So your miner would get started within 5 minutes of booting.  If you want, you can change */5 to */1 or */2 so it checks every minute or two instead.  

FYI, having your miner start four times a day, via a 5 minute cronjob would on average potentially waste 0.6% of your daily mining time, vs a 1 minute cronjob.    Perhaps I should change the default cronjob to 1, 2, or 3 minutes?

Of course the reboots themselves could cause that much loss too... 

The nice thing about using cgmon.tcl for me, is that I can see which GPU's are clocked too high and slowly lower those clock speeds until the GPU becomes stable over multiple days or weeks.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 08:28:32 PM
FYI, having your miner start four times a day, via a 5 minute cronjob would on average potentially waste 0.6% of your daily mining time, vs a 1 minute cronjob.  

Actually it could be twice that much loss since cgmon.tcl only has a chance to catch the problem once every 5 minutes...  The next version will have a recommended cron time of every 2 minutes.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 02, 2014, 08:32:51 PM
cgmon b12 released

http://www.forked.net/~apex/cgmon/cgmon.tcl (http://www.forked.net/~apex/cgmon/cgmon.tcl)

Changes:

# 0.1b12
#   Added check for connection reset when using cgminer API.
#   Moved share monitoring option into config section.
#   Changed pool configuration.  Now you can comment out unused pools or leave them blank.
#   Added option to disable email notifications when cgmon.tcl is run by hand.  Keeps the inbox spam down when adjusting settings, etc.
#   Cleaned up some code.
#   Changed cronjob default to every 2 minutes.  If you have an existing cronjob, you'll need to edit /etc/crontab yourself to make this change.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 03, 2014, 03:25:48 PM
When cgmon restarts cgminer, I find my hashrate is less than half what it was before, despite all the same settings.  Does the restart command not include (in windows terms) setx use_gpu_alloc 100 and the gpu_use_sync_objects 1?  Also, any word on the reboot if the hash rate falls below xx?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rorbit on February 03, 2014, 04:43:07 PM
Thanks for the PHP time out catch.  That should do it.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 03, 2014, 05:43:54 PM
OS: CentOS 6.2 X64
cgmon 0.1b13

Quote
couldn't execute "shutdown": no such file or directory
    while executing
"exec shutdown -r now"
    (procedure "reboot" line 5)
    invoked from within
"reboot"
    (procedure "check_status" line 175)
    invoked from within
"check_status"
    (file "/usr/local/bin/cgmon.tcl" line 421)


[root@rig ~]# whereis shutdown
shutdown: /sbin/shutdown /usr/share/man/man8/shutdown.8.gz /usr/share/man/man3p/shutdown.3p.gz /usr/share/man/man2/shutdown.2.gz


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 03, 2014, 06:24:20 PM
Try changing:

"exec shutdown -r now"

To:
"exec reboot"

That should work in CentOS.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 04, 2014, 02:17:46 AM
OS: CentOS 6.2 X64
cgmon 0.1b13

Quote
couldn't execute "shutdown": no such file or directory
    while executing
"exec shutdown -r now"
    (procedure "reboot" line 5)
    invoked from within
"reboot"
    (procedure "check_status" line 175)
    invoked from within
"check_status"
    (file "/usr/local/bin/cgmon.tcl" line 421)


[root@rig ~]# whereis shutdown
shutdown: /sbin/shutdown /usr/share/man/man8/shutdown.8.gz /usr/share/man/man3p/shutdown.3p.gz /usr/share/man/man2/shutdown.2.gz

Fixed.  Thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 04, 2014, 02:21:02 AM
When cgmon restarts cgminer, I find my hashrate is less than half what it was before, despite all the same settings.  Does the restart command not include (in windows terms) setx use_gpu_alloc 100 and the gpu_use_sync_objects 1?  Also, any word on the reboot if the hash rate falls below xx?

Hmm.  Take a look at /tmp/cgmon-mine.sh.  That's the file that has the mining command.  It should also contain:
Code:
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1

You could try running /tmp/cgmon-mine.sh directly and see if that gets you the full hashrate.  If it does, I expect the problem could be with the way cgminer is started from crontab.   What OS are you using?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 04, 2014, 03:01:48 AM
That file looked fine.  BAMT 1.3


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 04, 2014, 10:56:20 AM
If set crontab like this
Quote
*/1 * * * *     /usr/local/bin/cgmon.tcl >>/var/log/cgmon.log 2>&1
and edit cgmon.tcl like this
Quote
set cgmon_logfile "/var/log/cgmon.log"
the log file like this

Quote
[root@rig-2 ~]# tailf /var/log/cgmon.log
Feb 04 18:50:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:50:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:51:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:51:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:52:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:52:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:53:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:53:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:54:02 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:54:02 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
no big deal, but maybe fix the Install instructions ?
thanks for your gread job.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: bobers on February 04, 2014, 11:56:42 AM
That file looked fine.  BAMT 1.3
Could you plz give me steps how did you add it to BAMT?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on February 04, 2014, 11:57:14 AM
What are the possible causes of sgminer hard hang? I was getting GPU not well before and tuned it down and now sgminer just hangs.




Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 04, 2014, 12:45:50 PM
From my experience, it can be due to:
1: Unstable thread-concurrency for the card
2: Too much OC
3: Too much undervolting
4: A combination of OC and it now needs more voltage
5: Somekind of other non-default value which is incompatible with your card, many errors are caused by manual settings!
6: Changes to engine/ memory clock values, or voltage value while running cgminer/sgminer can sometimes crash it, no idea why...

All of them will usually result in what is earlier mentioned as "ASIC hang", which in English means that the graphic driver has crashed.
That will either lead to "dead GPU", or a complete cgminer hang.

It could also be due to a unstable/uncompatible driver, but not sure that has caused me any issues.

I myself am running with a setup of:
Xubuntu 12.10
AMD Catalyst 13.12
AMD ADL SDK 6.0
AMD APP SDK 2.8
Sapphire 7950 w/ boost, running 1100/1500 at vddc 1.100, thead-concurrency 24000

Angela/bobers:
That is because of this line in the cron:
*/1 * * * *     /usr/local/bin/cgmon.tcl >>/var/log/cgmon.log 2>&1
By adding >>/var/log/cgmon.log I guess you override the logpath setting in cgmon. You should be fine by doing:
*/1 * * * *     /usr/local/bin/cgmon.tcl

A little tip: */1 is the same just *, so * * * * * is every minute.

Keep in mind that as there is no username set, it will run as currently logged on user. That tells me for the script to work, as it needs root rights, that you either:
1: Is always running as root, and thereby the miner process as root, generally not a good idea for security purposes
2: Not using the crontab file which is compatible with usernames
3: Not using the crontab file which is compatbile with usernames, and you are running with a non-root user account, and in that case the script won't work (reboot command requires it).

It's only in /etc/crontab you can specify run-as usernames, not by doing crontab -e, which is a seperate file for each user, and thereby always runs as that user.

So what you really should do is:
nano /etc/crontab
Add:
* * * * *   root   /home/username/cgmon.tcl


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on February 04, 2014, 02:26:02 PM
Yeah I'm doing a fresh install of everything and will see how it goes. I might even start from scratch with my settings. Hard hang is no fun. It can go 5 hours w/o hard hanging and then 5 times in 1 hour. Really hard to put your finger on.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 04, 2014, 03:31:06 PM
If set crontab like this
Quote
*/1 * * * *     /usr/local/bin/cgmon.tcl >>/var/log/cgmon.log 2>&1
and edit cgmon.tcl like this
Quote
set cgmon_logfile "/var/log/cgmon.log"
the log file like this

Quote
[root@rig-2 ~]# tailf /var/log/cgmon.log
Feb 04 18:50:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:50:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:51:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:51:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:52:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:52:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:53:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:53:01 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:54:02 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
Feb 04 18:54:02 rig-2 - cgmon 0.1b13 - cgminer running and all GPUs healthy.
no big deal, but maybe fix the Install instructions ?
thanks for your gread job.

Code:
*/1 * * * *     /usr/local/bin/cgmon.tcl >>/var/log/cgmon.log 2>&1

Hi.  This line is creating the redundant log file entries.  Remove '>/var/log/cgmon.log'.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 04, 2014, 06:03:31 PM
Thank you very much
my computer is a dedicate rig, and there is nothing on it but only rig software,so i don't really care about security
and also thanks for the introduce of crontab,that helps me a lot
From my experience, it can be due to:
1: Unstable thread-concurrency for the card
2: Too much OC
3: Too much undervolting
4: A combination of OC and it now needs more voltage
5: Somekind of other non-default value which is incompatible with your card, many errors are caused by manual settings!
6: Changes to engine/ memory clock values, or voltage value while running cgminer/sgminer can sometimes crash it, no idea why...

All of them will usually result in what is earlier mentioned as "ASIC hang", which in English means that the graphic driver has crashed.
That will either lead to "dead GPU", or a complete cgminer hang.

It could also be due to a unstable/uncompatible driver, but not sure that has caused me any issues.

I myself am running with a setup of:
Xubuntu 12.10
AMD Catalyst 13.12
AMD ADL SDK 6.0
AMD APP SDK 2.8
Sapphire 7950 w/ boost, running 1100/1500 at vddc 1.100, thead-concurrency 24000

Angela/bobers:
That is because of this line in the cron:
*/1 * * * *     /usr/local/bin/cgmon.tcl >>/var/log/cgmon.log 2>&1
By adding >>/var/log/cgmon.log I guess you override the logpath setting in cgmon. You should be fine by doing:
*/1 * * * *     /usr/local/bin/cgmon.tcl

A little tip: */1 is the same just *, so * * * * * is every minute.

Keep in mind that as there is no username set, it will run as currently logged on user. That tells me for the script to work, as it needs root rights, that you either:
1: Is always running as root, and thereby the miner process as root, generally not a good idea for security purposes
2: Not using the crontab file which is compatible with usernames
3: Not using the crontab file which is compatbile with usernames, and you are running with a non-root user account, and in that case the script won't work (reboot command requires it).

It's only in /etc/crontab you can specify run-as usernames, not by doing crontab -e, which is a seperate file for each user, and thereby always runs as that user.

So what you really should do is:
nano /etc/crontab
Add:
* * * * *   root   /home/username/cgmon.tcl


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on February 04, 2014, 07:36:23 PM
What is the delay between starting ubuntu and starting cgminer and how it can be changed?
Now cgminer starts in a bout 3-5 minutes after booting OS.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 04, 2014, 09:28:09 PM
What is the delay between starting ubuntu and starting cgminer and how it can be changed?
Now cgminer starts in a bout 3-5 minutes after booting OS.

Add the full path to cgmon.tcl to your rc.local file.  That will start it immediately at boot time.

For example, in Ubuntu I have this line in /etc/rc.local
Code:
/home/username/cgmon.tcl&



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 05, 2014, 03:05:01 AM
I would like to make it so that instead of cgmon trying to start cgminer, it just restarts the pc instead.  I left the other day to get some mining supplies and got e-mails every minute that it was starting the mining program on one of my PCs.  I came home to over 180 e-mails.  This would work considering the cgmon process doesn't start until 5 minutes after the computer is on.  By then it would have started mining by itself.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 05, 2014, 03:56:26 AM
I would like to make it so that instead of cgmon trying to start cgminer, it just restarts the pc instead.  I left the other day to get some mining supplies and got e-mails every minute that it was starting the mining program on one of my PCs.  I came home to over 180 e-mails.  This would work considering the cgmon process doesn't start until 5 minutes after the computer is on.  By then it would have started mining by itself.

There must be an error in cgmon, or something else on your computer.   That is not the intended behavior...

You can disable email notifications if you just want cgmon to restart your computer when it detects a problem.  There's an option in the configuration section.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on February 05, 2014, 05:23:51 AM
What is the delay between starting ubuntu and starting cgminer and how it can be changed?
Now cgminer starts in a bout 3-5 minutes after booting OS.

Add the full path to cgmon.tcl to your rc.local file.  That will start it immediately at boot time.

For example, in Ubuntu I have this line in /etc/rc.local
Code:
/home/username/cgmon.tcl&


I've already added to crontab */5 * * * *   root   /home/my user name /cgmon.tcl >/dev/null 2>&1 and it works as described - starts only in 3-5 min after booting.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 05, 2014, 11:57:35 AM
I know how to disable the e-mail notification, but I'm not too familiar with coding.  What is the start command I should be looking for to change to "reboot"?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr00g on February 05, 2014, 11:42:45 PM
I know how to disable the e-mail notification, but I'm not too familiar with coding.  What is the start command I should be looking for to change to "reboot"?

That would be this reboot routine:

proc reboot {} {
            
   after 10000
   exec /sbin/shutdown -r now
   exec shutdown -r now

   # and in case that didn't work...
   # (BAMT)
   after 5000
   exec reboot -f
}


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 06, 2014, 01:18:35 AM
I've seen that.  I'm referring to the part where cgmon actually starts cgminer when it says it wasn't running.  Instead of the cgmon script starting cgminer, I'd like it to reboot the computer.  If I knew where to look I would replace the start command with the reboot procedure reference.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on February 06, 2014, 08:22:34 AM
How is it possible to change the pool without rebooting the PC?
If I change in tcl file the main pool what should I do next?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mig5000 on February 06, 2014, 03:40:44 PM
How is it possible to change the pool without rebooting the PC?
If I change in tcl file the main pool what should I do next?

'Q' : quit sgminer/cgmin
Change the server in cgmon.tcl.
Save and relaunch is with sudo ./cgmon.tcl


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 06, 2014, 11:28:24 PM
How is it possible to change the pool without rebooting the PC?
If I change in tcl file the main pool what should I do next?

I make the changes I want in cgmon.tcl and then I do this:
Code:
screen -r
q
./cgmon.tcl


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 07, 2014, 02:20:11 AM
Whats up Jdape badass script so far. Im having a problem that I hope you can address.

1.) ubuntu 13.04 machine never reboots for any of the variables that you provide. The reboot command appears to be broken. ive done several rounds of testing to see if the command ever invokes, unplugging network cable, over clocking card until it hangs but it doesnt appear to ever happen.

Any help?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 07, 2014, 02:30:38 AM
Do you see the broadcast message saying its about to be rebooted?  Do you get emails saying the GPU is hung/dead/sick and the script is going to reboot?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 07, 2014, 03:00:38 AM
How is it possible to change the pool without rebooting the PC?
If I change in tcl file the main pool what should I do next?

I make the changes I want in cgmon.tcl and then I do this:
Code:
screen -r
q
./cgmon.tcl

Found almost the same problem,if i changed cgminer.conf then press s-c-y to restart cgminer
cgmon.tcl will reboot the pc and log shows
Quote
GPU 0 no accepted shares in 540 seconds. GPU probably hung.
solution is same,press q to quit cgminer instead of press s-c-y to restart cgminer


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 07, 2014, 03:06:12 AM
im using sgminer 4.0.0


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rudyo on February 07, 2014, 08:19:53 PM
I am using Bamt 1.3 and sgminer and have a couple of questions.

1) I am using the cgminer.conf file in /etc/bamt with all my config settings (MUCH easier than command line entries...).  Can cgmon.tcl use this .conf file rather than parroting the entire contents out as command line entries in cgmon.tcl?
Also when I tweak the config, I would prefer to not have to change it in the cgmon.tcl as well. 


2) I think it was mentioned in the thread (but not sure I understood how to implement) that a reboot is the preferred remedy for a low hashrate or a dead/sick GPU.  How can I easily set this up?  I have found (as mentioned) that restarting gminer does not correct the issue and I almost always reboot.

Thanks!




 


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 08, 2014, 09:29:54 AM
I am using Bamt 1.3 and sgminer and have a couple of questions.

1) I am using the cgminer.conf file in /etc/bamt with all my config settings (MUCH easier than command line entries...).  Can cgmon.tcl use this .conf file rather than parroting the entire contents out as command line entries in cgmon.tcl?
Also when I tweak the config, I would prefer to not have to change it in the cgmon.tcl as well. 
Try
Code:
set cgminer_gpu_options "-c /etc/bamt/cgminer.conf"
and left pool settings blank in cgmon.tcl


Quote
2) I think it was mentioned in the thread (but not sure I understood how to implement) that a reboot is the preferred remedy for a low hashrate or a dead/sick GPU.  How can I easily set this up?  I have found (as mentioned) that restarting gminer does not correct the issue and I almost always reboot.

Thanks!
1: low hashrate don't think so, dead/sick, change nothing,it's automatically.
2:never restart cgminer,only quit and wait cgmon.tcl restart it or run cgmon.tcl manually.





 



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 04:24:05 PM
I am using Bamt 1.3 and sgminer and have a couple of questions.

2) I think it was mentioned in the thread (but not sure I understood how to implement) that a reboot is the preferred remedy for a low hashrate or a dead/sick GPU.  How can I easily set this up?  I have found (as mentioned) that restarting gminer does not correct the issue and I almost always reboot.

Thanks!

Exactly.  This is what cgmon does. :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 08, 2014, 05:10:14 PM
ok jdape figured it out. if I remove the network cable or the wireless usb plug (thereby disabling the network) there appears to be a bug in the scripts regarding nshares- last number of shares. For whatever reason, at no point in the process does it ever really recognize that the network is dead and prompts for a restart. I would have thought that the share differential logic would have prompted the reboot process after the gpus stopped having shares accepted but apparently not.

So in other words my testing method did not invoke the reboot process. to reproduce, please pull the network plug or disable the wireless card on your machine and see what happens. considering everything else works id say that this is a reproduceable issue.

when i had a sick card or a soft system hang due to a bad card, the machine rebooted itself as it should.

This script kicks so much ass. i will be donating some coin your way on monday. To say that this script is fuckin badass would be a complete and total understatement.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 05:19:12 PM
ok jdape figured it out. if I remove the network cable or the wireless usb plug (thereby disabling the network) there appears to be a bug in the scripts regarding nshares- last number of shares. For whatever reason, at no point in the process does it ever really recognize that the network is dead and prompts for a restart. I would have thought that the share differential logic would have prompted the reboot process after the gpus stopped having shares accepted but apparently not.

So in other words my testing method did not invoke the reboot process. to reproduce, please pull the network plug or disable the wireless card on your machine and see what happens. considering everything else works id say that this is a reproduceable issue.

when i had a sick card or a soft system hang due to a bad card, the machine rebooted itself as it should.

This script kicks so much ass. i will be donating some coin your way on monday. To say that this script is fuckin badass would be a complete and total understatement.


Wow.  I'm very glad to hear you like it so much. :)

I'll try and reproduce the issue.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 05:55:23 PM
ok jdape figured it out. if I remove the network cable or the wireless usb plug (thereby disabling the network) there appears to be a bug in the scripts regarding nshares- last number of shares. For whatever reason, at no point in the process does it ever really recognize that the network is dead and prompts for a restart. I would have thought that the share differential logic would have prompted the reboot process after the gpus stopped having shares accepted but apparently not.

So in other words my testing method did not invoke the reboot process. to reproduce, please pull the network plug or disable the wireless card on your machine and see what happens. considering everything else works id say that this is a reproduceable issue.


How long did you wait after disconnecting the network?   Currently it would take about 20 minutes before cgmon notices the accepted share count has stopped rising and reboots.

I'll see if I can find a way to detect it sooner...



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 08, 2014, 06:40:20 PM
not sure ive ever waited 20 minutes, but i would say that after 5 mins of no detected shares that it should reboot. Does anyone disagree with that? The only other feature that would be nice is if the script could determine whether or not the network is connected and either restart the usb port that the usb wireless key is on, or restart the network interface prior to rebooting. Thats a bit contrived, but could quickly get things back in order in the event of a flakey piece of hardware or the network interface craps out. Which i have to say is not uncommon with usb wireless cards.

Again, you would not believe how much more efficient this scrypt coupled with the use of sgmon is going to make my operation.

you will be receiving a nice reward on monday Jdape.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 06:56:05 PM
0.1b14 is out.  

Code:
# 0.1b14
#   New: Now checks and warns if script isnt running as root before trying to reboot/shutdown.
#   New: Check status of all mining pools.  Send an email notification and reboot (optional) if all pools are offline.
#   Upd: More info on non responsive api errors. i.e. when cgminer starts, but all pools are down.

cgmon will now check the status of all mining pools on each run.  If all pools are unreachable an error will be logged.  Optionally an email will be sent and the server will reboot (if you have those features enabled).  

This feature should correct network problems such as crashed or hung network adapters.  It will also keep you notified if there's a network outage of more than a couple minutes on your rig.  The email notifications would not go through during an outage, so you'll have to check the logfile.  I think in the future, cgmon will send an email when the network becomes available again along with the duration of the outage.

By default, the reboot option is turned off for this new feature.  You can change the behavior in the appropriate config section (shown below).

Code:
# Monitor the network status of all mining pools.  
set checkpools "yes"
# Reboot if all mining pools are unreachable.
set reboot_when_pools_are_down "no"




Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 06:59:41 PM
Try
Code:
set cgminer_gpu_options "-c /etc/bamt/cgminer.conf"
and left pool settings blank in cgmon.tcl

That's awesome.  Love the hack :)

I have considered coding a setting to enable a config file, but thats just about as good.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 07:07:16 PM
not sure ive ever waited 20 minutes, but i would say that after 5 mins of no detected shares that it should reboot. Does anyone disagree with that?

It depends on the speed of the card and the diff.  You can change how many minutes are allowed without an accepted share in the config file.  I have a GPU that runs at only 80kh/s and 128 diff, so i've had to increase the share time to 15 minutes. Lower than that and it would reboot sometimes even when the card is working normally because it doesnt output many shares.

If your GPU's are hashing at maybe, 500kh/s, you would probably be fine decreasing the share timer to 2 or 3 minutes.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 08, 2014, 07:07:39 PM

FYI, cgmon is perfectly compatible with vertminer.  I'm using it on all my rigs now.  Just drop the binary anywhere and  copy the .cl files to /usr/local/bin/.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: zubuxx on February 08, 2014, 08:36:04 PM
Hi - thx for this amazing script :)

cgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options

i have this communicate when cgmon is launched by cron. When manually i enter command above its working properly

/etc/crontab

*/2 * * * *   root  /root/cgmon.tcl >/dev/null 2>&1

thx for your support

CRONTAB IS NOT WORKING :(


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 08, 2014, 10:01:17 PM
I think 5 minutes is good. i have r290x, so it makes itself very clear that something is wrong very quickly. And i dont want to do it too quickly in the event that the interenet connection is merely flakey and or subject to short outages. While shitty for mining, you dont want to reboot the connection if it times out for a minute or so.

Thanks Jdape.

-E


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 09, 2014, 02:24:23 AM
Hi - thx for this amazing script :)

cgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options

i have this communicate when cgmon is launched by cron. When manually i enter command above its working properly

/etc/crontab

*/2 * * * *   root  /root/cgmon.tcl >/dev/null 2>&1

thx for your support

CRONTAB IS NOT WORKING :(


What do you have $cgminer_exec set to? 
Code:
set cgminer_exec "cgminer"

Can you post the contents of /tmp/cgmon-mine.sh?

Are you running as root?  What is $mining_user set to?  Does the script run when you're logged in as that user?



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: iann on February 09, 2014, 07:14:16 AM
I am using Bamt 1.3 and sgminer and have a couple of questions.

1) I am using the cgminer.conf file in /etc/bamt with all my config settings (MUCH easier than command line entries...).  Can cgmon.tcl use this .conf file rather than parroting the entire contents out as command line entries in cgmon.tcl?
Also when I tweak the config, I would prefer to not have to change it in the cgmon.tcl as well. 
Try
Code:
set cgminer_gpu_options "-c /etc/bamt/cgminer.conf"
and left pool settings blank in cgmon.tcl


Hi Angela thanks for the line, I'm finally able to get it running!!! (I'm using SMOS)

Btw I've a question about ssh. I always ssh with root. Is that a bad habbit? I couldn't login with user@ip_address since it keeps saying my password is wrong even though I've changed it using 'passwd' after logging in with root. Any clue?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 09, 2014, 08:44:50 AM
Quote
Hi Angela thanks for the line, I'm finally able to get it running!!! (I'm using SMOS)

Btw I've a question about ssh. I always ssh with root. Is that a bad habbit?
Absolutely yes!
Quote
I couldn't login with user@ip_address since it keeps saying my password is wrong even though I've changed it using 'passwd' after logging in with root. Any clue?
Never used SMOS, sorry


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: iann on February 09, 2014, 09:14:26 AM
Never used SMOS, sorry

Do you use bamt? They are essentially the same.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: zubuxx on February 09, 2014, 10:21:52 AM
Hi - thx for this amazing script :)

cgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options

i have this communicate when cgmon is launched by cron. When manually i enter command above its working properly

/etc/crontab

*/2 * * * *   root  /root/cgmon.tcl >/dev/null 2>&1

thx for your support

CRONTAB IS NOT WORKING :(


What do you have $cgminer_exec set to?  
Code:
set cgminer_exec "cgminer"

Can you post the contents of /tmp/cgmon-mine.sh?

Are you running as root?  What is $mining_user set to?  Does the script run when you're logged in as that user?




i set set cgminer_exec "cgminer"

cgmon-mine it is:

#!/bin/bash
export DISPLAY=:0
export GPU_MAX_ALLOC_PERCENT=100
export GPU_USE_SYNC_OBJECTS=1
screen -md /root/gckeccak/cgminer --api-listen  --keccak --api-listen -o max.smalltimeminer.com:3355 -u xx.1 -p xx


i am lauching script as root - mining user set to root BUT hmm as you see im mining maxcoin. I set to avoid --script line "use sgminer" but cgminer exec is cgminer - maybe it is a problem


---------------------------


# GPU settings
set cgminer_gpu_options "--keccak --api-listen"

# Username running X server (i.e. the username you use when logging into the Linux graphical interface)
# This must be correct or cgminer wont run properly.
set mining_user "root"

# Mine for Litecoin or Bitcoin?
set mine_for "litecoin"
#set mine_for "bitcoin"

set cgminer_path "/root/gckeccak/"

# Extra options to pass to cgminer
# At least --api-listen is required for cgmon to work.
set cgminer_extra_options "--api-listen"

# Use sgminer.  This removes --scrypt from the command line for compatibility with sgminer
set use_sgminer "yes"

DEBUG INFO :

 /root/gckeccak/cgminer --api-listen  --keccak --api-listen -o max.smalltimeminer.com:3355 -u xx.1 -p xx --scrypt

 [2014-02-09 11:55:37] /root/gckeccak/cgminer: --scrypt: unrecognized option

Keccak miner doesnt handle properly --scrypt option


----------------------------

I just wrote simple script launching cgmon remotely using ssh i expect - its working properly





Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 09, 2014, 03:46:24 PM
zubuxx,

Sounds like you got it figured out.  If not let me know.

I think the config section could use some more clarifying because the $mine_for "litecoin" option is confusing.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: zubuxx on February 09, 2014, 04:26:13 PM
zubuxx,

Sounds like you got it figured out.  If not let me know.

I think the config section could use some more clarifying because the $mine_for "litecoin" option is confusing.

yep its working properly thx for your support and this saving savings :) script


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 09, 2014, 05:15:33 PM
I seem to keep getting e-mail notifications that accepted shares haven't been seen in almost 10,000 seconds.  So I upgraded the script, and I modified it so when it sends that e-mail there was another word on the end of it.  That word doesn't appear in my e-mail or in the cgmon.log file.  Every 2 minutes though, I get an e-mail.  It's like it's left over from the previous version of the script.  I even deleted the cgmon.tcl and cgmon.log files.  I kept it active in /etc/crontab and I magically am still getting e-mails despite crontab referencing a script that doesn't exist.  How can I make this stop?

Fixed it!  It was on a different computer where I didn't change the from e-mail address.  :P


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: pouyaye on February 09, 2014, 07:55:39 PM
Can I use it in Mac OSX?

how can I build one for osx?

thanks


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 10, 2014, 02:31:53 AM
Hi, I am setting up cgmon in SMOS.   I think the last thing I need to do is set the parameters below for "set cgminer_path" correctly:

# this is required only if your cgminer_exec binary is NOT installed in your $mining_user's PATH (i.e. /usr/bin/)
# example:  /home/user/cgminer-3.1.1/       (must end with a '/')
set cgminer_path ""

Does anyone know what this path is on SMOS?   SMOS does run off BAMT.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: indie22 on February 10, 2014, 02:45:21 AM
Thanks for writing this script.

I have a question regarding usage with BAMT. Are people integrating this with the BAMT mine start/stop script at all? After reading the thread a couple times I am not clear on this aspect.

I would like to use cgmon to do the actual monitoring of cgminer and carry out the necessary tasks for sick/dead/low hashrate scenarios, but continue to use the BAMT start/stop scripts for management of the miner.

Thanks for any insight.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: scryptactical on February 10, 2014, 06:40:29 PM
just sent you 10 coins big boy. Thanks Jdape!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 11, 2014, 02:36:02 AM
Can I use it in Mac OSX?

how can I build one for osx?

thanks

Yes, it should work in OSX (I just fixed one small issue for OSX.  Try the latest  version.)  Everything needed is already installed.  Just follow the instructions at the top of the script.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 11, 2014, 02:36:25 AM
just sent you 10 coins big boy. Thanks Jdape!

Wow!  Confirmed.  Thank you! :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 11, 2014, 03:48:21 AM
just sent you 10 coins big boy. Thanks Jdape!

Wow!  Confirmed.  Thank you! :)
Hey there!  I have cgmon installed. And I can run it manually, check the log and the manual run is logged. However, it will not run via cron. I have set up the cron as:

* * * * *        root     /home/cgmon.tcl


My cgmon file is located in /home.   So I feel that I have done everything right. But for some reason the cron is not running.  Btw I am using BAMT.  I would sincerely appreciate any help I could get.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 11, 2014, 05:18:26 PM
Hey there!  I have cgmon installed. And I can run it manually, check the log and the manual run is logged. However, it will not run via cron. I have set up the cron as:

* * * * *        root     /home/cgmon.tcl


My cgmon file is located in /home.   So I feel that I have done everything right. But for some reason the cron is not running.  Btw I am using BAMT.  I would sincerely appreciate any help I could get.

Have you made sure cron is actually running on your system?  If so try adding
Code:
>/dev/null 2>&1
to the end of your cgmon cron config.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on February 12, 2014, 12:17:55 AM
Hey there!  I have cgmon installed. And I can run it manually, check the log and the manual run is logged. However, it will not run via cron. I have set up the cron as:

* * * * *        root     /home/cgmon.tcl


My cgmon file is located in /home.   So I feel that I have done everything right. But for some reason the cron is not running.  Btw I am using BAMT.  I would sincerely appreciate any help I could get.

Have you made sure cron is actually running on your system?  If so try adding
Code:
>/dev/null 2>&1
to the end of your cgmon cron config.

Hi Jdape....Im enjoying the newer versions of cgmon so far (01b16)!

a quick bug report:

1) The rebooting of the rig if hasrate or pool is not communicating is a great thing. Only i did experiment it and i found that if the internet connection is not back after the reboot it will keep trying to reboot sgminer instead of rebooting the rig. Wouldn't it be better to reboot the rig, in case it has an issue?

2) I dont put the /dev/null 2>&1 at the end of the cronjob and it works. Just thought i'd mention it

3) Is it possible to add a scrypt (optional to user) to reboot the rig once in a while. Im not sure about this, but is it possible that we are stuck on old shares? Ive noticed i am more productive when i reboot the rig once in a while. Maybe rebooting the rig 3-4 times a day isn't a bad idea, considering Ubuntu takes less than a minute to reboot.

Thx again!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: aMasheep on February 12, 2014, 08:01:24 AM
Hey, I am also having a problem getting this to work properly.
When I try to launch cgmon.tcl it gives me this error:
Code:
miner@miner:~$ sudo sh cgmon.tcl
cgmon.tcl: 27: cgmon.tcl: Syntax error: "(" unexpected

This is currently how my crontab file looks:
Code:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
*/2 * * * *     root    /home/miner/cgmon.tcl >/dev/null 2>&1


And here is a link to my edited version of the cgmon.tcl
http://pastebin.com/xLzhYvpC

I'd apprecciate all and any help. Thank you.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: SlipperySlope on February 12, 2014, 10:12:53 AM
Try changing line 27 in your tcl script.

Code:
set pool(address1) "maxpool.1gh.com:17333"

The scrypt assumes the stratum pool protocol.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: pikapika_doge on February 12, 2014, 10:19:36 AM
Can someone please tell us a brief guide how to use Cgmon?

I am a total newbie to Linux and i use ltcrabbit OS (it is written BAM everywhere) from usb.

What is this tcl file? And how will i use it?

Does CG mon has a Graphical Interface?
Does it have auto intensity to drop gpu heat?
Does it have any control over gpu fans? (Because my gpu fans jumps %100 and it stays %100 even if i stop cgminer)

Thanks in advence.

Briefly we need a simple user guide as  newbies


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: aMasheep on February 12, 2014, 10:37:14 AM
Try changing line 27 in your tcl script.

Code:
set pool(address1) "maxpool.1gh.com:17333"

The scrypt assumes the stratum pool protocol.

Thanks, I'll try this ASAP when I get home :3


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: aMasheep on February 12, 2014, 02:47:30 PM
Unfortunately, It did not work. Still getting the same exact error. Might it be that it doesn't expect a "(" and that I should mod the code so it doesn't have any ( on that line? I guess I could do that.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: aMasheep on February 12, 2014, 03:50:51 PM
Try changing line 27 in your tcl script.

Code:
set pool(address1) "maxpool.1gh.com:17333"

The scrypt assumes the stratum pool protocol.

Thanks, I'll try this ASAP when I get home :3

This wasn't my problem as stated in the last post. I found the problem though.

When I ran it, I used
Code:
sudo sh cgmon.tcl
But I should use
Code:
sudo chmod +x cgmon.tcl
./cgmon.tcl

But thanks for the help :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 12, 2014, 05:44:04 PM
Hi Jdape....Im enjoying the newer versions of cgmon so far (01b16)!

a quick bug report:

1) The rebooting of the rig if hasrate or pool is not communicating is a great thing. Only i did experiment it and i found that if the internet connection is not back after the reboot it will keep trying to reboot sgminer instead of rebooting the rig. Wouldn't it be better to reboot the rig, in case it has an issue?

Thanks for the report!

Maybe.  If one reboot didn't fix it, is another going to?  We probably don't want a rig to keep rebooting over and over.

3) Is it possible to add a scrypt (optional to user) to reboot the rig once in a while. Im not sure about this, but is it possible that we are stuck on old shares? Ive noticed i am more productive when i reboot the rig once in a while. Maybe rebooting the rig 3-4 times a day isn't a bad idea, considering Ubuntu takes less than a minute to reboot.

Thx again!

You can use a shell script like this:
Code:
#!/bin/sh
/sbin/shutdown -r now

Pop that in a file, chmod +x it, then add it to /etc/crontab to reboot every so many hours.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rorbit on February 12, 2014, 09:39:40 PM
Hi,

if I add the following to the end of the cgminer command in cgmon-mine.sh shouldn't it capture the output?

2>> ~/log/_cgminer_log.txt

I want to be able to track whenever a pool failover happens.

This creates the log file but nothing is written to it.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 13, 2014, 10:04:08 AM
So I have BAMT 1.3, and I seem to still be having problems with weird hashrates when cgmon starts sgminer.  Where can I change the command from the cgmon script starting the program to just running "mine restart" as root?  I think the script already runs as the root user.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 13, 2014, 03:32:53 PM
Can someone please help me get cgmon working on BAMT?    I have the cgmon.tcl in the home folder. I have made all the changes to the cgmon.tcl file that I need to. I can manually run the cgmon.tcl file and it will work. However, for some reason the cron is not working. I am wondering if it has to do with the cron, or maybe it has to do with changing the file permission to 755. Maybe changing the permission is a different command in BAMT?  When I changed the permission of the file I used this command "chmod 755 cgmon.tcl".

I have not been sleeping good at night because I keep waking to check the rig. Would really like to get this script going.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 13, 2014, 10:26:59 PM
That is the correct command.  In crontab you have the */2 * * * * root /home/user/cgmon.tcl >/dev/null 2>&1


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 13, 2014, 10:49:16 PM
That is the correct command.  In crontab you have the */2 * * * * root /home/user/cgmon.tcl >/dev/null 2>&1
MrBob, I sincerely appreciate the help.

Yes, I have the crontab setup and it looks like this:

*/2 * * * * root /home/cgmon.tcl >/dev/null 2>&1

My cgmon.tcl file is in the /home folder.

Still not working. :(


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 13, 2014, 11:00:54 PM
chmod 755 /home/cgmon.tcl

check the settings to see where the log file is pointed to.

Also, did you do the following?

apt-get update
apt-get install tcl
apt-get install php5-cli
apt-get install php5

When I did this for the first time, just php5 wasn't enough, I needed php5-cli.  This is not in the instructions.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 13, 2014, 11:09:27 PM
chmod 755 /home/cgmon.tcl

check the settings to see where the log file is pointed to.

Also, did you do the following?

apt-get update
apt-get install tcl
apt-get install php5-cli
apt-get install php5

When I did this for the first time, just php5 wasn't enough, I needed php5-cli.  This is not in the instructions.
I did the chmod again.

For the log I have two outputs it seems:
/root/cgmon.log
/live/cow/root/cgmon.log

I just tried to install php5-cli and it showed to already be installed.

Also, for the "user" in the cgmon.tcl file I have it designated "root".  

I can still run the file manually, but cron will not run it. 


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 13, 2014, 11:39:12 PM
Just so this is clear. I check the log after a manual run of the script and its been recorded in the log. I do not see any other runs in the log other then the ones that I have done manually.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 14, 2014, 12:16:22 AM
Do you have "api-listen" : true in your /etc/bamt/cgminer.conf?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 14, 2014, 12:21:01 AM
Yes.

"api-listen" : true,


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 14, 2014, 12:55:56 AM
I did do this command recommended by Angela earlier in the thread:

set cgminer_gpu_options "-c /etc/bamt/cgminer.conf"

Thats because i would like to be able to set my gpu options via the cgminer.conf file. Not sure if maybe that messed things up.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 14, 2014, 01:02:22 AM
No, I have that too.  That wouldn't impact the ability to just run the monitoring and output the cgmon.log file. That could be it with the root user.  Mine is "user." Try that.  I'm thinking there must be something different between yours and mine.  Your user being "root" could be it.  What version of BAMT are you using?  I use 1.3.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 14, 2014, 01:12:56 AM
I tried "user" and it did not work. I just now even downloaded a new cgmon.tcl file to the "user" profile. Ran the chmod, and did everything like I am suppose to, pointed the cron to the correct place. Once again it will run manually but will not run with cron. I am using 1.3 SMOS which runs on BAMT.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 14, 2014, 01:36:03 AM
Something is up with my cron. I tried to start the service with this:
/etc/init.d/cron start


And I get this:
Starting periodic command scheduler: cron failed!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 14, 2014, 01:47:45 AM
Possibly an SMOS issue, though not likely.  Unfortunately friend, I've gone through the list of things I thought it could be, unless there is a problem with syntax somewhere in your /etc/crontab on a different line?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 14, 2014, 01:56:58 AM
MrBob I appreciate the help. I have put in a call to someone who will hopefully know. If all else fails I will switch out of SMOS and move over to pure BAMT.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 14, 2014, 03:40:47 AM
Hi,

if I add the following to the end of the cgminer command in cgmon-mine.sh shouldn't it capture the output?

2>> ~/log/_cgminer_log.txt

I want to be able to track whenever a pool failover happens.

This creates the log file but nothing is written to it.


cgmon-mine.sh is created whenever cgmon starts cgminer.  So you actually make that change within cgmon.tcl.  Try adding it to the end of your $cgminer_gpu_options line in cgmon.tcl

Actually the issue is with screen...  When I try logging to a file it only works when NOT using screen...  

You can log cgminer ouput by adding -L to the screen options in cgmon.tcl.

Code:
set screen_cmd "screen -mdL"

Will leave a screenlog.0 file in the current working directory.  Let me know if you find another way to do it.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: bomberb17 on February 14, 2014, 03:49:46 PM
Has anyone found a free SMTP server to use for email receiving? My ISP's needs authentication..


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 15, 2014, 08:13:52 AM
cgmon 1.0 through 1.0.3 have just been released.

New features:
  • SMTP Authentication support! Works with gmail.
  • Automatic version check and script updating.   If you run
Code:
./cgmon.tcl update
cgmon will determine if there's a new version available.  If so, it will download the new version and migrate your existing configuration settings into cgmon.tcl.tmp.   Then you can move the temp file to cgmon.tcl.

# 1.0
#   Added auto update procedure:  ./cgmon.tcl update
#   Added SMTP AUTH support.
#   Added screen command syntax to output when starting.
# 1.0.1 & 1.0.2
#   Bug fixes
# 1.0.3
#   Added new version notifications to emails, when applicable.



Update procedure in action:

Code:
apex@miner3:~$ ./cgmon.tcl update
--2014-02-15 00:06:37--  http://www.forked.net/~apex/cgmon/cgmon.tcl
Resolving www.forked.net (www.forked.net)... 38.103.167.118
Connecting to www.forked.net (www.forked.net)|38.103.167.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25702 (25K) [application/x-tcl]
Saving to: `cgmon.tcl.autoupdate'

     0K .......... .......... .....                           100%  657K=0.04s

2014-02-15 00:06:37 (657 KB/s) - `cgmon.tcl.autoupdate' saved [25702/25702]

Version Check:  You have 1.0.2, latest is 1.0.3.
Updating now...
Update successful! cgmon 1.0.3 is now located at /home/apex/cgmon.tcl.tmp. To finish the update process run this command:
mv /home/apex/cgmon.tcl.tmp /home/apex/cgmon.tcl
apex@miner3:~$ mv /home/apex/cgmon.tcl.tmp /home/apex/cgmon.tcl
apex@miner3:~$ ./cgmon.tcl
Feb 15 00:13:34 miner3 - cgmon 1.0.3 - cgminer running and all GPUs healthy.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 15, 2014, 08:24:41 AM
FYI, to debug SMTP AUTH, change line 480 from:
Code:
			-debug false \
to
Code:
			-debug true \


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: bomberb17 on February 15, 2014, 10:10:24 AM
In the file change "Ubuntu: apt-get install libtcl tcl-tls" to "Ubuntu: apt-get install tcllib tcl-tls"


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: bomberb17 on February 15, 2014, 10:17:16 AM
I'm not getting any mail. Also if I debug, I get the message
Code:
invalid bareword "exited"
in expression "exited - 11";
should be "$exited" or "{exited}" or "exited(...)" or ...
    (parsing expression "exited - 11")
    invoked from within
"expr  $current_accepted($n) -  $previous_accepted($n)"
    (procedure "check_status" line 190)
    invoked from within
"check_status"
    (file "./cgmon.tcl" line 579)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rorbit on February 15, 2014, 03:09:55 PM
Hi,

if I add the following to the end of the cgminer command in cgmon-mine.sh shouldn't it capture the output?

2>> ~/log/_cgminer_log.txt

I want to be able to track whenever a pool failover happens.

This creates the log file but nothing is written to it.


cgmon-mine.sh is created whenever cgmon starts cgminer.  So you actually make that change within cgmon.tcl.  Try adding it to the end of your $cgminer_gpu_options line in cgmon.tcl

Actually the issue is with screen...  When I try logging to a file it only works when NOT using screen...  

You can log cgminer ouput by adding -L to the screen options in cgmon.tcl.

Code:
set screen_cmd "screen -mdL"

Will leave a screenlog.0 file in the current working directory.  Let me know if you find another way to do it.



Thanks jdape.

This works.

You can also copy /etc/screenrc file to your working directory and rename it .screenrc to modify screen variables.

E.g. add the following line to customise your log filename to cgminer_log_2014_02_15.txt:

logfile "/home/user/log/cgminer_log_20%y_%m_%d.txt"


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 15, 2014, 04:47:07 PM
In the file change "Ubuntu: apt-get install libtcl tcl-tls" to "Ubuntu: apt-get install tcllib tcl-tls"

Fixed, thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 15, 2014, 04:55:30 PM
I'm not getting any mail. Also if I debug, I get the message
Code:
invalid bareword "exited"
in expression "exited - 11";
should be "$exited" or "{exited}" or "exited(...)" or ...
    (parsing expression "exited - 11")
    invoked from within
"expr  $current_accepted($n) -  $previous_accepted($n)"
    (procedure "check_status" line 190)
    invoked from within
"check_status"
    (file "./cgmon.tcl" line 579)

Run this command and send me the output please.
Code:
php -f /tmp/cgmon-api.php devs | grep "Accepted] =>" | grep -v Diff


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: technocoma on February 15, 2014, 05:25:02 PM
Just what I've been looking for. Thanks for this


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 15, 2014, 07:36:38 PM
Just what I've been looking for. Thanks for this

Cool.  Let me know if you find any bugs :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: ckopobapka on February 15, 2014, 11:29:57 PM
I've made a simple startup init-script for BAMT that runs cgmon in virtual screen without using cron. I think it's more convenient way to debug and control cgmon.

1. copy cgmon_wrapper.sh from http://yadi.sk/d/34zlbFhWHx4ua (http://yadi.sk/d/34zlbFhWHx4ua) to any directory you want. I keep it in "/opt/cgmon/"

2. copy cgmon_daemon from http://yadi.sk/d/aKU8Zr6nHx4ug (http://yadi.sk/d/aKU8Zr6nHx4ug) to "/etc/init.d/" directory on your BAMT.
Configure it according to your system:
a) At the end of the 4th line:
Code:
# Required-Start:    $remote_fs $syslog mine
... I've added word "mine", because cgmon_daemon needs to be runned only after "/etc/init.d/mine" script. You may add your own here...

b) In the 22th line:
Code:
DAEMON_ARGS="-DmS cgmon_daemon /opt/cgmon/cgmon_wrapper.sh"
... if you saved cgmon_wrapper.sh in other dirctory, you need to fix the line according to your cgmon_wrapper.sh path.

3. Make the scripts executable:
Code:
sudo chmod 755 /etc/init.d/cgmon_daemon
sudo chmod 755 /opt/cgmon/cgmon_wrapper.sh #write here your own cgmon_wrapper.sh path if it differs

4. Enable autostart:
Code:
sudo update-rc.d cgmon_daemon defaults
sudo update-rc.d cgmon_daemon enable

5. You may start it by hands:
Code:
sudo /etc/init.d/cgmon_daemon start
Also, you restart and stop it.

6. To view a virtual screen use:
Code:
sudo screen -r cgmon_daemon
To exit from the screen use "Ctrl+a d"


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 16, 2014, 01:11:24 AM
ckopobapka, thank you so much for posting that.  I am having cron problems so maybe this will be my answer. I hope some other people can chime in as to if this is a good solution to use.

I only got a little confused at this part:

"... I've added word "mine", because cgmon_daemon needs to be runned only after "/etc/init.d/mine" script. You may add your own here..."

Can I just leave that part alone and put it in as it is?


I MUST get this program working. I woke up to a sick gpu this morning, what a bummer.




Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: funkycold on February 16, 2014, 04:09:17 AM
Hi Jdape....Im enjoying the newer versions of cgmon so far (01b16)!

a quick bug report:

1) The rebooting of the rig if hasrate or pool is not communicating is a great thing. Only i did experiment it and i found that if the internet connection is not back after the reboot it will keep trying to reboot sgminer instead of rebooting the rig. Wouldn't it be better to reboot the rig, in case it has an issue?

Thanks for the report!

Maybe.  If one reboot didn't fix it, is another going to?  We probably don't want a rig to keep rebooting over and over.

3) Is it possible to add a scrypt (optional to user) to reboot the rig once in a while. Im not sure about this, but is it possible that we are stuck on old shares? Ive noticed i am more productive when i reboot the rig once in a while. Maybe rebooting the rig 3-4 times a day isn't a bad idea, considering Ubuntu takes less than a minute to reboot.

Thx again!

You can use a shell script like this:
Code:
#!/bin/sh
/sbin/shutdown -r now

Pop that in a file, chmod +x it, then add it to /etc/crontab to reboot every so many hours.

How safe is it to shutdown or reboot a rig while sgminer is running?
When i add a line in the BASH file to stop sgminer cgmon tries to re-open it (since I am running it every 2 minutes). Is there a way to halt the cronjob until the next reboot?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 16, 2014, 04:40:49 AM
Completely safe.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Angela8488 on February 16, 2014, 04:57:40 PM
First thank you for the great job done
if use option like this
Quote
set conf(cgminer_gpu_options) "--keccak -c /root/.cgminer/cgminer.conf.1"
the pool in # Primary mining pool will appear in cgminer as the last pool
if use option like this
Quote
set conf(cgminer_gpu_options) ""
the pool in # Primary mining pool will be the first pool
can you change it to alway first
i think maybe it's because cgmon.tcl run script like this
Quote
/root/cgminer_keccak/bin/cgminer --api-listen  --keccak -c /root/.cgminer/cgminer.conf.max -o pool_url -u xxx -p x
so can you change it to
Quote
/root/cgminer_keccak/bin/cgminer --api-listen  --keccak  -o pool_url -u xxx -p x -c /root/.cgminer/cgminer.conf.max


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: ckopobapka on February 16, 2014, 08:55:22 PM
I only got a little confused at this part:
"... I've added word "mine", because cgmon_daemon needs to be runned only after "/etc/init.d/mine" script. You may add your own here..."
Can I just leave that part alone and put it in as it is?
If you are sure, that your miner autostarts by script "/etc/init.d/mine" (this is default behavior in BAMT), you can put it in as it is (with word mine).


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 16, 2014, 09:01:37 PM
First thank you for the great job done
if use option like this
Quote
set conf(cgminer_gpu_options) "--keccak -c /root/.cgminer/cgminer.conf.1"
the pool in # Primary mining pool will appear in cgminer as the last pool
if use option like this
Quote
set conf(cgminer_gpu_options) ""
the pool in # Primary mining pool will be the first pool
can you change it to alway first
i think maybe it's because cgmon.tcl run script like this
Quote
/root/cgminer_keccak/bin/cgminer --api-listen  --keccak -c /root/.cgminer/cgminer.conf.max -o pool_url -u xxx -p x
so can you change it to
Quote
/root/cgminer_keccak/bin/cgminer --api-listen  --keccak  -o pool_url -u xxx -p x -c /root/.cgminer/cgminer.conf.max

Done.  This is now the default behavior in cgmon 1.0.5.

If you have 1.0.3 or 1.0.4 now, run
Code:
 ./cgmon.tcl update
to upgrade to 1.0.5.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 16, 2014, 09:04:35 PM
So, I guess that means I better officially release 1.0.5...


# 1.0.4
#   notify_on_manual_runs was not being obeyed.
#   Added quiet flag (-q) to wget when version checking.
# 1.0.5
#   Now adds mining pools before gpu options when setting up the mining command (request by Angela8488).


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 16, 2014, 09:13:28 PM
There was a tiny bug in the 1.0.x versions that was preventing emails (and possibly reboots) when SMTP auth was NOT being used.  So if you have 1.0.x please update to 1.0.6.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 17, 2014, 12:01:44 AM
jdape,

   Wondering if you can change the sbin/shutdown -r now command to reboot -f for all of them, or set an option for bamt so that it just uses reboot -f only?  The autoupdate is awesome but I manually change the sbin/shutdowns to reboot -f -n on all of them, otherwise it would be as easy as running the update and moving the file.  Thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 17, 2014, 02:10:12 AM
jdape,

   Wondering if you can change the sbin/shutdown -r now command to reboot -f for all of them, or set an option for bamt so that it just uses reboot -f only?  The autoupdate is awesome but I manually change the sbin/shutdowns to reboot -f -n on all of them, otherwise it would be as easy as running the update and moving the file.  Thanks!

Currently cgmon attempts a 'shutdown -r now'.  If that fails, it will try 'reboot -f'.  Does the default reboot behavior still not work correctly on BAMT?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 17, 2014, 03:11:40 AM
I was trying to save the time of the delay is all.  Could you maybe make it an option that if BAMT = "yes" then call a different BAMT_reboot procedure that only has "reboot -f" or even "reboot -f -n"?  Sometimes reboot -f doesn't work and I have to use reboot -f -n.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 17, 2014, 03:16:33 AM
I only got a little confused at this part:
"... I've added word "mine", because cgmon_daemon needs to be runned only after "/etc/init.d/mine" script. You may add your own here..."
Can I just leave that part alone and put it in as it is?
If you are sure, that your miner autostarts by script "/etc/init.d/mine" (this is default behavior in BAMT), you can put it in as it is (with word mine).
ckopobapka, I sincerely appreciate this. Thank you.  :)    I am going install it tomorrow.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: miner777 on February 17, 2014, 04:05:18 AM
ckopobapka, I decided to go for it and install it tonight. And it works!!!!  This is so awesome. Thank you!  You have made my day.  :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jiangzuying on February 17, 2014, 04:48:31 AM
This really is a great script! but 1 condition made me mad!

Cgmon will do nothing when it can't get data from cgminer-api, always cgminer is dead when it is starting, in this condition, cgmon will not take any action.

So could you add the feather that cgmon check the process of cgminer when it can't get the data from cgminer-api, maybe it needs some sleep time, then if there is the cgminer process and no api data, reboot the system.

Thank you!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: ckopobapka on February 17, 2014, 06:11:10 AM
ckopobapka, I decided to go for it and install it tonight. And it works!!!!  This is so awesome. Thank you!  You have made my day.  :)
Enjoy it! =)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 17, 2014, 07:48:31 PM
I was trying to save the time of the delay is all.  Could you maybe make it an option that if BAMT = "yes" then call a different BAMT_reboot procedure that only has "reboot -f" or even "reboot -f -n"?  Sometimes reboot -f doesn't work and I have to use reboot -f -n.

Done.  In the latest version you'll see
Code:
#set conf(BAMT) "no"
at the bottom of the config options.
Uncomment and set to yes to use 'reboot -f -n' before trying other reboot options.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on February 17, 2014, 08:42:02 PM
Awesome, thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: af_newbie on February 18, 2014, 07:25:54 PM
Hey jdape - thanks for this. Being a dev myself I started wanting to tinker with it right away. But, I don't know TCL. :)

Long story short I ended up re-implementing cgmon in JavaScript with node.js. I think it's pretty close now: node-cgmon (https://github.com/chrisbraddock/node-cgmon).

Not sure if you know JavaScript but if you ever want to consolidate efforts, let me know.

FYI, I cited cgmon in the credits (https://github.com/chrisbraddock/node-cgmon#credits).


Cool.  Node.js is gaining momentum on the server side.  Good to see an effort to use it.

I could not convince bfgminer developer to provide JSONP interface straight from the API.  If we had JSONP straight from the API, it would solve cross-domain issues,
and you could write ONE web page to get the status(es) directly from the miner(s).  Parsing, formatting becomes trivial in JS.

For process monitoring, you still need to have cgmon like script to monitor the process itself.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: korniza on February 23, 2014, 11:45:19 AM
what about using an option to get all parameters of cgminer/sgminer from a conf file?

I really like this option cause as a BAMT user, the script is breaking the Bamt options
 thanks

EDIT: RTFM!! thanks again for your nice script!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: DiggingD33p on February 24, 2014, 03:23:50 AM
I get the following error:
Code:
Feb 24 03:19:34 bamt-miner - GPU 0 is sick or dead, rebooting...
 Status:             [Last Not Well] => 1393211512

Version Check:  You have 1.0.8, latest is 1.0.8.
cgmon is up to date.
error flushing "sock5": broken pipe
    while executing
"flush $sockid"
    (procedure "sendmail" line 48)
    invoked from within
"sendmail "[stamp] $hostname - GPU $i DEAD - Rebooting" "$hostname GPU
$i was dead or sick... rebooting.\n Status: $line"                      "
    (procedure "check_status" line 125)
    invoked from within
"check_status"
    (file "./cgmon.tcl" line 602)
This is the error I got when I executed the cgmon.tcl manually.

The script also didnt restart the bamt mining process... I had to restart it manually...

So I think there is somewhere a bug or a misconfiguration... :/


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: aMasheep on February 24, 2014, 09:26:01 PM
I've got no idea on how to turn it off? I am trying to stop it, but time after time it just starts the mining again... and when internet connection is lost, it doesn't do much.. (my wlan adapter sometime fucks up, and the system needs a reboot to work again)

thanks


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 25, 2014, 02:16:03 AM
I get the following error:
Code:
Feb 24 03:19:34 bamt-miner - GPU 0 is sick or dead, rebooting...
 Status:             [Last Not Well] => 1393211512

Version Check:  You have 1.0.8, latest is 1.0.8.
cgmon is up to date.
error flushing "sock5": broken pipe
    while executing
"flush $sockid"
    (procedure "sendmail" line 48)
    invoked from within
"sendmail "[stamp] $hostname - GPU $i DEAD - Rebooting" "$hostname GPU
$i was dead or sick... rebooting.\n Status: $line"                      "
    (procedure "check_status" line 125)
    invoked from within
"check_status"
    (file "./cgmon.tcl" line 602)
This is the error I got when I executed the cgmon.tcl manually.

The script also didnt restart the bamt mining process... I had to restart it manually...

So I think there is somewhere a bug or a misconfiguration... :/


What are your email settings like?  Could be an error there.   Try disabling email notifications.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on February 25, 2014, 02:17:25 AM
I've got no idea on how to turn it off? I am trying to stop it, but time after time it just starts the mining again... and when internet connection is lost, it doesn't do much.. (my wlan adapter sometime fucks up, and the system needs a reboot to work again)

thanks


If you want your computer to restart when there's a network issue, make sure 'reboot_when_pools_are_down' is set to yes in the config:

Code:
set conf(reboot_when_pools_are_down) "yes"


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: ct1000ad on February 28, 2014, 06:01:42 PM
When I used crontab, sgminer would sit there "waiting for work to be available from pools" for about 5 minutes before actually starting. When I started the script manually, it would immediately work.

I think the problem was that cron was running the script from a directory where the mining user didn't have any write permissions. When I changed the crontab to:

* * * * *   root     cd /home/ct1000ad/doge/cgmon && ./cgmon.tcl > /dev/null 2>&1

the problem disappeared.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mdtspain on March 01, 2014, 01:50:13 PM
Great scrypt, works like a charm out of the box  ;D.

Miners are rebooting when they need to.

Is there a way so that I can use the cgmon-api.php not to show the info in just one line

Regards,

Michael


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 01, 2014, 02:53:50 PM
Great scrypt, works like a charm out of the box  ;D.

Miners are rebooting when they need to.

Is there a way so that I can use the cgmon-api.php not to show the info in just one line

Regards,

Michael

Glad it's working well for you.  Can you please explain your request in more detail?  Thanks :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mdtspain on March 01, 2014, 04:37:11 PM
Great scrypt, works like a charm out of the box  ;D.

Miners are rebooting when they need to.

Is there a way so that I can use the cgmon-api.php not to show the info in just one line

Regards,

Michael

Glad it's working well for you.  Can you please explain your request in more detail?  Thanks :)

On this moment, when I open cgmon-api.php in a webbrowser, there is a long string of data that is difficult to read. I would like to put some <br> in there to organise that data, so that it's readable. However I am not a PHP man...lol. It would be nice not having to login via terminal all the time. Just a grafical layout.

Sorry about my English!!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 01, 2014, 05:18:37 PM

On this moment, when I open cgmon-api.php in a webbrowser, there is a long string of data that is difficult to read. I would like to put some <br> in there to organise that data, so that it's readable. However I am not a PHP man...lol. It would be nice not having to login via terminal all the time. Just a grafical layout.

Sorry about my English!!

Why would you ever open cgmon-api.php in a webbrowser?  That is only there to be used by cgmon.tcl. :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: mdtspain on March 01, 2014, 06:00:54 PM
oh ok...then it's better to move it back to it's location


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr4g0n on March 02, 2014, 03:20:51 PM
Hello! Great scrypt! I have a question. I use Bamt/Smos and disable GPU0 (Integrated graphics) in bamt.conf and cgminer.conf but cgmon still check it and reboot because it Sick or Dead. How can i disable check for GPU0 in scrypt?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 02, 2014, 05:00:29 PM
Hello! Great scrypt! I have a question. I use Bamt/Smos and disable GPU0 (Integrated graphics) in bamt.conf and cgminer.conf but cgmon still check it and reboot because it Sick or Dead. How can i disable check for GPU0 in scrypt?

Hi,

You can disable checking of GPU 0 like this.

Find this line:
Code:
if {$gpu_status >1}  { 

below it add this new line:

Code:
if {$i == 0} {break}



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: dr4g0n on March 02, 2014, 05:17:34 PM
Thx for fast answer! Testing now.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on March 02, 2014, 09:04:01 PM
Could you please help solving the issue.
When the scrypt starts - cgminer waits for some time and than says smth like "waiting for work from pool" and in log it is written: "cgminer API is not enabled/responding". If I start cgminer manualy without cgmon it works fine.
What should I do to get things work? May be I have to open some port for api?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: SlipperySlope on March 02, 2014, 11:35:58 PM
When cgminer starts, it takes a few seconds to open the API port provided that you have enabled it as the cgmon instructions specify. You will see a detail line in the cgminer terminal window that says that the API port is open. Until that happens cgmon is not able to see cgminer and says so in its own log.

You can trace cgminer using the -T command line option, which logs all messages to the terminal window without overwriting any previous information.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Coinstron on March 03, 2014, 06:26:43 PM
Hi! tnx for great script!
but it is very sad to see this on my rig at mornings

Quote
Mar 03 20:00:02 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:02:01 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:04:03 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:06:11 bamt-miner - sgminer is not responding.  Rebooting.
Mar 03 20:06:21 bamt-miner -
Mar 03 20:08:44 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:08:44 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:08:45 bamt-miner - sgminer started successfully.  Use 'screen -r' to attach to sgminer and Control-a-d to detach.
Mar 03 20:10:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:10:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:10:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:12:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:12:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:12:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:14:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:14:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:14:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.

sometimes X is not starting after reboot and cgmon restart sgminer in endless cycle. maybe rebooting rig after N failed starts will be good solution?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on March 04, 2014, 08:56:21 PM
When cgminer starts, it takes a few seconds to open the API port provided that you have enabled it as the cgmon instructions specify. You will see a detail line in the cgminer terminal window that says that the API port is open. Until that happens cgmon is not able to see cgminer and says so in its own log.

You can trace cgminer using the -T command line option, which logs all messages to the terminal window without overwriting any previous information.
The -T parameter shows me nothing usefull so far...
What port should be opened and forwarded on router/firewall and should I use in GPU parameters smth like "--api-port XXXX --api-allow W:MY_internal _IP" ?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: virtualreality69 on March 06, 2014, 07:45:28 PM
Jdape,
First off Thanks for donating your time into this project and giving it to the community! I'm sure this will be a great tool for me in the future (once all the parts are in for my 2nd and 3rd rig).
 
Just installed it and its up and running, although I haven't had time to test/play with it yet. At some point I'll be sure to throw a few coins your way.

To Jdape and the community here,
Is there any additional official/unofficial documentation on cgmon? I'm specifically looking to see if I can pass new values to cgminer while its running and how to check cgmon's (or cgminers) current status via ssh. Apologies if this was covered at some point and I missed it.

Cheers,
- VR


Tired of finding miners sick, dead, or crashed for long periods of time?  I was!  Here's cgmon, a lightweight, free, and open source script which performs these functions in Linux:

  • Monitors health of all GPU's/ASIC's.  If a GPU crash or problem is detected, reboots the computer and starts mining automatically.
  • Auto restart cgminer when it crashes.
  • Auto restart of computer if cgminer becomes unresponsive.
  • Monitors Accepted Share counts per GPU - restart & notify if a GPU is not outputting accepted shares.
  • Monitors network connection and mining pools for outages.
  • Email notification of all actions.
  • Now has SMTP AUTH support for gmail and other ISPs*
  • Automated version checking and upgrading
  • Runs via command line in 'screen' so you can access cgminer at anytime.
[/b]
  • Runs cgminer in the background
  • Can be started/viewed via SSH
[/b]
  • Supports unlimited GPU's/ASIC's.
  • Supports up to five mining pools.
  • Supports sgminer 4.0.0




Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 06, 2014, 09:54:01 PM
I use BAMT 1.5 and always use "sync;coldreboot" to reboot the machine. What do I need to change in the script to use it with cgmon, too?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Gazylion on March 07, 2014, 04:44:45 PM
Script always instantly wants to shut down my rig after execution...

Code:
root@cryptominer-pl:/home/user/Downloads# ./cgmon.tcl
Mar 07 17:33:45 cryptominer-pl - GPU 0 is sick or dead, rebooting...
 Status:             [Last Not Well] => 1394209759
                                                                               
Broadcast Message from root@cryptominer-pl                                     
        (somewhere) at 17:33 ...                                               
                                                                               
GPU 0 DEAD - Rebooting in 10s...                                               
                                 

Code:
Time         Total    gpu0    gpu1
17:39:35    970.30  485.20  485.10
17:39:42    967.60  484.00  483.60
17:39:42    967.90  484.00  483.90

Not SMOS 1.3 by beebee with coinvert script, mining scrypt with cgminer-karloth.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jormugandr on March 07, 2014, 05:32:02 PM
Hey so I'm a total linux noob. I have BAMT 1.3 and I downloaded cgmon.tcl but I can't figure out how to open the file to make the appropriate edits. I use sgminer so I can't run it until I make the edits others previously mentioned in this thread.

How do I open the tcl file lol?!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: virtualreality69 on March 07, 2014, 07:23:37 PM
I think you win the biggest linux noob award.  This shouldnt be posted here as it pertains to linux and not so much cgmon. Look for a good linux turorial out on the interwebs if you have other linux (and not gcmon) related questions


Google how to open a file with nano (or any Linux text editor). Basically just change directory to the location its in and run:
>nano cgmon.tcl

http://askubuntu.com/questions/54221/how-to-edit-files-in-a-terminal-with-nano (http://askubuntu.com/questions/54221/how-to-edit-files-in-a-terminal-with-nano)


 


Hey so I'm a total linux noob. I have BAMT 1.3 and I downloaded cgmon.tcl but I can't figure out how to open the file to make the appropriate edits. I use sgminer so I can't run it until I make the edits others previously mentioned in this thread.

How do I open the tcl file lol?!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 07, 2014, 11:39:59 PM
Has anyone developed a more detailed instruction or install-script for this? Trying to get it to work on BAMT 1.3 w/kalroth, having a helluva a time. I've searched this forum for answers.

I have the cgmon_daemon stuff working. It launches, waits 30 seconds, and then says "cgminer is not responding, rebooting". I have it set to start after the "mine" starts (which it does), but does not communicate.

I'm using:

--api-allow W:127.0.0.1

On BAMT, what's the best course of action? Disable bamt's autostart and let cgmon do it all?


Problem 2:
If cgmon launches cgminer it says "use screen -r to see output" (or whatever). I see my power usage go up, like the cards are active. But no screen shows for cgminer. Screen -ls shows nothing, sudo screen -ls shows nothing.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 08, 2014, 02:54:32 AM
Has anyone developed a more detailed instruction or install-script for this? Trying to get it to work on BAMT 1.3 w/kalroth, having a helluva a time. I've searched this forum for answers.

I have the cgmon_daemon stuff working. It launches, waits 30 seconds, and then says "cgminer is not responding, rebooting". I have it set to start after the "mine" starts (which it does), but does not communicate.

I'm using:

--api-allow W:127.0.0.1

On BAMT, what's the best course of action? Disable bamt's autostart and let cgmon do it all?


Problem 2:
If cgmon launches cgminer it says "use screen -r to see output" (or whatever). I see my power usage go up, like the cards are active. But no screen shows for cgminer. Screen -ls shows nothing, sudo screen -ls shows nothing.
I had/have similar problems with BAMT 1.5, too. Sometimes the whole machine hangs up while rebooting, requirering a hard reset. Sometimes it reboots but starts 2 sgminer instances (1 by BAMT and 1 by cgmon). This leads to a blocked API Port because it's already used by the other instance - making the cgmon script believe sgminer is not working. Rebooting again. However, the last reboot worked without problem. But I don't know what causes the game between cgmon and bamt to crash and sometimes not.

Bamts screen session runs as root while cgmon starts its sessions as "user".


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 08, 2014, 06:21:24 AM
I had/have similar problems with BAMT 1.5, too. Sometimes the whole machine hangs up while rebooting, requirering a hard reset. Sometimes it reboots but starts 2 sgminer instances (1 by BAMT and 1 by cgmon). This leads to a blocked API Port because it's already used by the other instance - making the cgmon script believe sgminer is not working. Rebooting again. However, the last reboot worked without problem. But I don't know what causes the game between cgmon and bamt to crash and sometimes not.

Bamts screen session runs as root while cgmon starts its sessions as "user".

I think I may have worked it out. I started completely fresh and went from there - documented all steps from a fresh BAMT install. I'm going to compile it into a how-to and post it here. I also created a installation shell script for bamt users that'll walk you through each step. I'm also working on modifying the code (maybe jdarpe will accept the changes) so that if it detects BAMT=YES, it'll use the mine commands that bamt has preinstalled over trying to execute its own scripts. Should solve the double miner issues.

I'll probably post it tomorrow after I test it on a few more new installs. It's late and I want to go relax.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 08, 2014, 02:11:23 PM
I had/have similar problems with BAMT 1.5, too. Sometimes the whole machine hangs up while rebooting, requirering a hard reset. Sometimes it reboots but starts 2 sgminer instances (1 by BAMT and 1 by cgmon). This leads to a blocked API Port because it's already used by the other instance - making the cgmon script believe sgminer is not working. Rebooting again. However, the last reboot worked without problem. But I don't know what causes the game between cgmon and bamt to crash and sometimes not.

Bamts screen session runs as root while cgmon starts its sessions as "user".

I think I may have worked it out. I started completely fresh and went from there - documented all steps from a fresh BAMT install. I'm going to compile it into a how-to and post it here. I also created a installation shell script for bamt users that'll walk you through each step. I'm also working on modifying the code (maybe jdarpe will accept the changes) so that if it detects BAMT=YES, it'll use the mine commands that bamt has preinstalled over trying to execute its own scripts. Should solve the double miner issues.

I'll probably post it tomorrow after I test it on a few more new installs. It's late and I want to go relax.
That would be great! Does it also fix the "no shares detected" after doing a "mine restart" manually?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 09, 2014, 01:09:49 AM

That would be great! Does it also fix the "no shares detected" after doing a "mine restart" manually?

I'll check that. I want to do one last completely fresh run through before uploading it. I'll mark out all changes here.

-------

Going to break this into two posts for ease. This is the setup script.

** THIS IS FOR BAMT USERS .. SMOS/Others use at your own risk, I do not know if it will work for you **

INSTALL CGMON on BAMT
** Tested to work on BAMT 1.3 fresh install, your mileage may vary.
** You can do most of the commands manually, but a simple .sh script has been provided.

- Download the .sh file at bottom of post and place it in /home/user/ directory
or
- Follow step by step manual way below.

SCRIPT WAY:

- After placing it in /home/user/ directory, give execute rights to file.
Code:
chmod +x /home/user/inst_cgmon.sh 

- Then execute it via Terminal
Code:
 bash /home/user/inst_cgmon.sh 

- Follow along the prompts, brief explanation:
-- Get required files, including cgmon.tcl, applies proper permissions
-- Prompts for option to launch NANO edit of cgmon.tcl
-- Offers to create crontab for every 2 minutes (even)

For what edits should be used in cgmon.tcl for BAMT, see next post.

MANUAL WAY:
1. Open a ROOT Terminal and run the following commands (wait for each to finish).
Code:
apt-get update -y
apt-get install tcl -y
apt-get install php5-cli -y
apt-get install php5 -y
cd /home/user
wget http://www.forked.net/~apex/cgmon/cgmon.tcl
chmod +x cgmon.tcl
echo -e "" > /home/user/cgmon.log
chmod 755 /home/user/cgmon.log

2. Create the CRON job
Open a ROOT Terminal and type "crontab -e"
Add the following:
Code:
*/2 * * * *	root	/home/user/cgmon.tcl >/dev/null 2>&1 
Save (write) it.

3. See next post for recommended BAMT edits (how I got it to work) of cgmon.tcl

Can't attach, so download here: http://kaelmedia.com/files/bamt-scripts/inst_cgmon.sh
Open that file in your browser to see the code.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 09, 2014, 02:21:21 AM
Code Edits to CGMON.TCL for BAMT

* What it does: It creates another config line to bypass the internal launch commands of CGMON.TCL and use the BAMT "Mine Restart" commands. This prevents the dual miner issue.
* I'm sure there was a more elegant way of doing this, but I'm more of an automation scripter and not a programmer.
* May need to reapply some of (or all) these edits if you run an update.
* Not fully tested, I'm running it on a rig that has usual "SICK/DEAD" issues. As soon as that flies, I'll edit this to update. I know it'll fire and reboot OK if it the pools become unreachable (disconnected cable).

Edit CONF Section with this (some may not be needed, but I did them anyways):
Code:
set conf(cgminer_gpu_options)
-- set to: "-c /etc/bamt/cgminer.conf"
set conf(cgminer_extra_options)
-- set to: "--api-listen"
set conf(mining_user)
-- set to: "root"
** It wouldn't run as user for me. Bamt does the mining as root.
set conf(cgminer_path)
-- set to: "/opt/miners/cgminer/"
set conf(miner_requires_scrypt_flag)
-- set to: "no"
** If you're running BAMT 1.3, 1.4, 1.5 as stock with SGMiner.
set conf(cgmon_logfile)
-- set to: "home/user/cgmon.log"
** we're running ROOT, but want the log file in the user directory. If you didn't use the setup inst_cgmon.sh script I provided in the last post, you may need to create this file in /home/user and assign it user: root, group: root.
# set conf(BAMT)
-- set to: remove the "#" and set it to "yes"

Now the actual additions:

Underneath "set conf(BAMT)" add..
Code:
# Use BAMT's internal mine commands?
set conf(use_bamt_mine_cmds) "yes"

With that added, go to line 259, it should say "append mining_command". Change from this:
Code:
append mining_command " $conf(cgminer_gpu_options)"
 
notice $mining_command

# delete count of accepted shares when starting miner - otherwise a reboot could occur from reading irrelavent share counts
exec rm -f /tmp/accepted_count

# create bash script in /tmp/ to max use of environment variables for mining
if {![catch { set outfd [open "/tmp/cgmon-mine.sh" w] }]} {
puts $outfd "#!/bin/bash"
puts $outfd "export DISPLAY=:0"
puts $outfd "export GPU_MAX_ALLOC_PERCENT=100"
puts $outfd "export GPU_USE_SYNC_OBJECTS=1"
puts $outfd "$conf(screen_cmd) $mining_command"
close $outfd
}
exec chmod 755 /tmp/cgmon-mine.sh
exec chown $conf(mining_user) /tmp/cgmon-mine.sh
set exec_cmd "/tmp/cgmon-mine.sh"

# run the bash script as the correct user (the one running X hopefully)
catch {exec whoami} script_user
if {$script_user == $conf(mining_user)} {
catch {exec /bin/bash -c $exec_cmd} out
} elseif {$script_user == "root"} {
catch {exec su $conf(mining_user) -c /bin/bash -c $exec_cmd} out
} else {
notice "attempted to start $conf(cgminer_exec) as the wrong user.  exiting."
exit
}

# Check if miner started or not.
to this:
Code:
 		append mining_command " $conf(cgminer_gpu_options)"
 
# BAMT Alternate Message
if {$conf(use_bamt_mine_cmds) == "yes"} {
notice "Mining started via mine restart command, if errors exist, check bamt.conf or cgminer.conf in /etc/bamt/"
} else {
notice $mining_command
}

# delete count of accepted shares when starting miner - otherwise a reboot could occur from reading irrelavent share counts
exec rm -f /tmp/accepted_count

# create bash script in /tmp/ to max use of environment variables for mining
if {![catch { set outfd [open "/tmp/cgmon-mine.sh" w] }]} {
puts $outfd "#!/bin/bash"
puts $outfd "export DISPLAY=:0"
puts $outfd "export GPU_MAX_ALLOC_PERCENT=100"
puts $outfd "export GPU_USE_SYNC_OBJECTS=1"
puts $outfd "$conf(screen_cmd) $mining_command"
close $outfd
}
exec chmod 755 /tmp/cgmon-mine.sh
exec chown $conf(mining_user) /tmp/cgmon-mine.sh
set exec_cmd "/tmp/cgmon-mine.sh"

# run the bash script as the correct user (the one running X hopefully)
# BAMT Command Mine Start
if {$conf(use_bamt_mine_cmds) == "yes"} {
catch {exec su root -c /bin/bash -c "/etc/init.d/mine restart"} out
} else {
catch {exec whoami} script_user
if {$script_user == $conf(mining_user)} {
catch {exec /bin/bash -c $exec_cmd} out
} elseif {$script_user == "root"} {
catch {exec su $conf(mining_user) -c /bin/bash -c $exec_cmd} out
} else {
notice "attempted to start $conf(cgminer_exec) as the wrong user.  exiting."
exit
}}

# Check if miner started or not.

The edits are between line 256 and 287 in an unedited CGMON.TCL 1.0.8. Or between "append mining_command" and "#check if miner started or not".


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 09, 2014, 12:29:55 PM
Thank you a million, Kael! I've followed your instructions and will see if it works :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 10, 2014, 10:12:17 PM
Thank you a million, Kael! I've followed your instructions and will see if it works :)

Yeah, post back if you have issues. I did notice it reboots fine for no-network, but doesn't reboot if sick/dead. Working on figuring that one out.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 11, 2014, 12:27:03 AM
Yes, I had only one DEAD case and I don't know what exactly happened. It did not restart correctly. Then I turned the power off completely. Finally after the 5th cold reboot it worked again. Maybe this isn't something that can be fixed by a script...it looked like a hardware issue :/


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Kael on March 11, 2014, 02:09:28 AM
Yes, I had only one DEAD case and I don't know what exactly happened. It did not restart correctly. Then I turned the power off completely. Finally after the 5th cold reboot it worked again. Maybe this isn't something that can be fixed by a script...it looked like a hardware issue :/

As others have mentioned, the CRON seems to be finicky. If I ran the script through the ROOT's CRONTAB, it'd run but never reboot. If I ran it manually as a sudo, it'd reboot fine. The Daemon posted up above seems to fix this issue.

I updated the install script .. here: http://www.kaelmedia.com/files/bamt-scripts/inst_cgmon.sh

It's now:
1) Install Required Files
2) Enable SMTP Authentication (addition files)
3) Nano edit cgmon.tcl?
4) Choose to install CRON, Daemon, or skip it.

It'll install the Daemon files by ckopobapka - they're already configured for the script. Since you already did it, you can just choose "no" until you get to option 4. Choose the Daemon option. Let it finish, then do a "crontab -e" and erase the cronjob for cgmon, save that file. Do a sync;coldreboot .


Additionally, I did notice that the cgmon.log file doesn't get updated when it reboots because of a SICK/DEAD card (not good for troubleshooting) because the Daemon seems to reboot the system before it can. I'm working on a quick fix for that. Just need one of my cards to go sick real quick (they never do it when I want them to).



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: virtualreality69 on March 12, 2014, 08:21:52 PM
Kael,
Thanks for the updates for BAMT! I really appreciate your contributions to the community.  

I'm interested to know if you are aware of how to display cgminer's current status/info when its run with cgmon?  I have verified cgmon is running and I've added it to my crontab.  Cgmon starts cgminer with system boot which is great. The only thing I haven't sorted out yet is how to view the current status/info of cgminer via ssh or local terminal.  I'd really like to be able to check on the cards every day or two just to make sure they're not getting too warm with the upcoming change in seasons (winter to spring).

I dont know if you also had this issue (see below) or if you were quoting someone from earlier. 

Cheers,
- VR


UPDATE: "screen -r" apparently works now. I'm not sure if I was trying to run it before the system fully booted or what the problem was. 

Problem 2:
If cgmon launches cgminer it says "use screen -r to see output" (or whatever). I see my power usage go up, like the cards are active. But no screen shows for cgminer. Screen -ls shows nothing, sudo screen -ls shows nothing.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: rorbit on March 13, 2014, 10:51:45 AM
Hi all,

I got cgmon working with LeaseRig: http://leaserig.net/index.jsp?rfid=1681

It's easy, just replace the references to the default port 4028 in the cgmon script to the port you registered with LeaseRig.

E.g. port 7778 in the example below.

Use these cgminer parameters to restrict the access to your rig to certain functions and only from the LeaseRig IP:

--api-groups L:switchpool:addpool:removepool:restart:save:*  --api-allow W:127.0.0.1,L:89.212.242.33 --api-port 7778

If you'd like to hire out your rig please use my referral link above.

It's a great service.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: MrBobC on March 13, 2014, 01:59:33 PM
Okay, here's one.  Moving from Scrypt GPU to Scrypt ASIC, I have an RPi with Scripta.  Would this work with it or would it require different things since it's not Linux/BAMT/SMOS?  Scripta says it is Debian-based.  I use this on all my GPU miners, but it would be great to have it also work with the ASICs.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: haggis on March 14, 2014, 07:25:38 PM
Kael, I'm using your updated installscript on BAMT 1.6 without the modifications in cgmon.tcl and it works flawlessly! :)

Thank you very much!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: freskhu on March 15, 2014, 02:05:56 PM
hi there,

When i have a gpu sick, the gmon detects, o receive an email but the rig dont reboot, any idea?
check print of logo:

http://prntscr.com/3100l7

The email i receive:

http://prntscr.com/31012z


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:36:19 PM
hi there,

When i have a gpu sick, the gmon detects, o receive an email but the rig dont reboot, any idea?
check print of logo:

http://prntscr.com/3100l7

The email i receive:

http://prntscr.com/31012z

Are you sure it's not rebooting?  Judging by how the sick GPU is back to hashing two minutes later, it seems likely your rig has already rebooted.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:39:25 PM

To Jdape and the community here,
Is there any additional official/unofficial documentation on cgmon? I'm specifically looking to see if I can pass new values to cgminer while its running and how to check cgmon's (or cgminers) current status via ssh. Apologies if this was covered at some point and I missed it.

Cheers,
- VR


Code:
screen -r

That will drop you right into the running mining process.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:40:25 PM
Okay, here's one.  Moving from Scrypt GPU to Scrypt ASIC, I have an RPi with Scripta.  Would this work with it or would it require different things since it's not Linux/BAMT/SMOS?  Scripta says it is Debian-based.  I use this on all my GPU miners, but it would be great to have it also work with the ASICs.

I suspect it will work without any modification.  Post here if it does.  If it doesn't work I can probably get it working for you :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:43:18 PM
Hi! tnx for great script!
but it is very sad to see this on my rig at mornings

Quote
Mar 03 20:00:02 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:02:01 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:04:03 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:06:11 bamt-miner - sgminer is not responding.  Rebooting.
Mar 03 20:06:21 bamt-miner -
Mar 03 20:08:44 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:08:44 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:08:45 bamt-miner - sgminer started successfully.  Use 'screen -r' to attach to sgminer and Control-a-d to detach.
Mar 03 20:10:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:10:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:10:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:12:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:12:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:12:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:14:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:14:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:14:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.

sometimes X is not starting after reboot and cgmon restart sgminer in endless cycle. maybe rebooting rig after N failed starts will be good solution?

I bet there's an error in your .conf file.  What happens when you run the command manually?

Code:
/opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf

Are you running as root or another user?  Could also be a permissions issue.  Either way, running it by hand should show the problem.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:44:27 PM
I use BAMT 1.5 and always use "sync;coldreboot" to reboot the machine. What do I need to change in the script to use it with cgmon, too?

Code:
		if {$conf(BAMT) == "yes"} {
after 5000
catch {exec reboot -f -n} out
to:
Code:
		if {$conf(BAMT) == "yes"} {
after 5000
catch {exec sync;coldreboot} out


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:45:53 PM
Script always instantly wants to shut down my rig after execution...

Code:
root@cryptominer-pl:/home/user/Downloads# ./cgmon.tcl
Mar 07 17:33:45 cryptominer-pl - GPU 0 is sick or dead, rebooting...
 Status:             [Last Not Well] => 1394209759
                                                                               
Broadcast Message from root@cryptominer-pl                                     
        (somewhere) at 17:33 ...                                               
                                                                               
GPU 0 DEAD - Rebooting in 10s...                                               
                                 

Code:
Time         Total    gpu0    gpu1
17:39:35    970.30  485.20  485.10
17:39:42    967.60  484.00  483.60
17:39:42    967.90  484.00  483.90

Not SMOS 1.3 by beebee with coinvert script, mining scrypt with cgminer-karloth.

What mining software are you using?  cgminer?  Whatever it is, it's reporting that your GPU 0 is not well via the API.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: hotrock on March 16, 2014, 04:48:00 PM
I would like to thank jdape for putting this program together. It is amazing!

Also, I couldn't have gotten this running without the help from Kael and his BAMT guide.

Between the two of you specifically I couldn't have kept my rig up and running as efficiently as I can now. Asic hangs were killing me. My alternative was to reboot every hour and hope for the best. I know a few others have helped with this and I thank them too.

Only think I had to change was the reboot to echo b > /proc/sysrq-trigger to keep BAMT from hanging on reboot.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:53:25 PM
Could you please help solving the issue.
When the scrypt starts - cgminer waits for some time and than says smth like "waiting for work from pool" and in log it is written: "cgminer API is not enabled/responding". If I start cgminer manualy without cgmon it works fine.
What should I do to get things work? May be I have to open some port for api?

Check that the permissions of your mining directory allow read/write access for the username that the miner is running as ($conf(mining_user)).

rough example:

Code:
chmod -R 755 /home/user/mining_directory/*
chown -R user /home/user/*


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:55:51 PM
FYI, there's only been one donation so far... Even a tiny amount would show your appreciation.  Cheers!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 04:56:48 PM
I would like to thank jdape for putting this program together. It is amazing!

You're welcome!   :D


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: hotrock on March 16, 2014, 05:38:44 PM
FYI, there's only been one donation so far... Even a tiny amount would show your appreciation.  Cheers!

Once I get some coin mined there will be second donation. Have no fear!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: kinsik on March 16, 2014, 08:03:12 PM
What command and where in the code of the script should I add it to start the miner not immediately after boot but in 15 seconds?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 16, 2014, 08:47:39 PM
What command and where in the code of the script should I add it to start the miner not immediately after boot but in 15 seconds?

Code:
# start
check_status
to:
Code:
# start
after 15000
check_status


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: zodiac on March 18, 2014, 09:11:06 AM
Dear jpade,
I guess I'm doing something wrong... Followed your instrusions in the TCL file, configured everything but still it doesn't work. I tried to run it manually by using:
Yes, I'm on gmail...
I guess I don't have SASL installed or some link to it is not there... I'm usually able to figure these small things by myself but I'm kinda stuck on this one
I have installed SASL using:

Code:
sudo apt-get install postfix sasl2-bin
Trying to configure postfix to the best of my abilities, will update soon...
Just saw I needed to do:
Code:
# Ubuntu: apt-get install tcllib tcl-tls
Solved this one...


I put the line in crontab and it looks like that:
Code:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
2  * * * * root /home/dogger/Downloads/cgmon.tcl >/dev/null 2>&1
17 * * * * root    cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
But, when I reboot the script doesn't work, any solution? It starts automatically but it takes it 3-70 minutes to start after my OS has completely booted, it sometimes starts only one GPU and sometimes it starts both, any insites on these matters?  
I'm on Ubuntu 13.10, 2X290X with cgminer.

Also, if my account is password protected (I disabled it for the time being), will the reboot work or will it get stuck on the enter password to login screen?

Thank you for all your work :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 18, 2014, 02:46:27 PM
Code:
2  *	* * *	root	/home/dogger/Downloads/cgmon.tcl >/dev/null 2>&1
But, when I reboot the script doesn't work, any solution? It starts automatically but it takes it 3-70 minutes to start after my OS has completely booted, it sometimes starts only one GPU and sometimes it starts both, any insites on these matters?  
I'm on Ubuntu 13.10, 2X290X with cgminer.

Also, if my account is password protected (I disabled it for the time being), will the reboot work or will it get stuck on the enter password to login screen?

Thank you for all your work :)

Hi,

You're welcome.  Sounds like you have most of it figured out now...

Your crontab is currently configured to run on the second minute of every hour.  If you want it to run every 2 minutes you need a '*/2' instead of just '2'.

You won't need to enter any passwords.

Cheers!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: zodiac on March 18, 2014, 06:57:21 PM
Dear jpade,
I understand what I did wrong now. But by now I tried to do some debugging myself, I tried:
Code:
crontab -e
And it showed me a different file then the one I edited. I'm guessing you pointed me to a more general file and "crontab -e" gives a user specific crontab file. I ended up thinking why not just use the GUI for "startup applications", press "add", browse to cgmon.tcl location, add description and some comment, and what do you know, works like a charm. Starts right after unity boots every time. I don't know the implications of me running like this, do you think your method better handles things?

I added:
Code:
# start
after 60000
check_status
So the wireless network adapter will have enough time to reconnect.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 19, 2014, 01:22:18 AM

And it showed me a different file then the one I edited. I'm guessing you pointed me to a more general file and "crontab -e" gives a user specific crontab file. I ended up thinking why not just use the GUI for "startup applications", press "add", browse to cgmon.tcl location, add description and some comment, and what do you know, works like a charm. Starts right after unity boots every time. I don't know the implications of me running like this, do you think your method better handles things?


Yep... that will run cgmon once at boot.  cgmon needs to be run every few minutes, 24/7.  That's where the cronjob comes in.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: freskhu on March 20, 2014, 03:09:18 PM
what changes we need to do to put this to work with script N like sgminer 4.1.0-troky?


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 20, 2014, 03:24:51 PM
what changes we need to do to put this to work with script N like sgminer 4.1.0-troky?

Haven't used that before, but there's an option for using sgminer already.  Should work out of the box.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: OutdoorServices on March 26, 2014, 06:25:01 PM
one of my gpu always goes sick/dead...temperature decreases until it goes dead moved it on different PCI slots and same thing. Mining lasts for maybe 2-5minutes and then has to restart.

I definitely have more then enough of a PSU as I have the corsair 1300Watt and only using 3 GPU HIS ICEQ 7950 and my kill-a-watt says 850watts.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: lossofworth on March 26, 2014, 09:06:40 PM
Hello,

First off, thank you very much for your script! It has made my life much easier. A little background on my setup. I'm running about 30 Raspberry Pi's on Rasbian with CGMiner each handling 7 Klondike 16's. The reboot and everything works well. The only issue that occurs is that sometimes it will hang after a reboot and get stuck trying to connect to the pool. Here is what I see.

Code:
 [2014-03-26 20:44:10] Please check the details from the list below of the servers you have input
 [2014-03-26 20:44:10] Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers
 [2014-03-26 20:44:10] Pool: 0  URL: http://stratum.btcguild.com:3333  User: username  Password: xxx
 [2014-03-26 20:44:10] Press any key to exit, or cgminer will try again in 15s.

This can be resolved by either restarting the raspberry or exiting the script and restarting it. I'm not the most skilled with linux but I can google my way through most issues. I'm not sure what version of cgmon I'm on, but the last item in the changelog is 0.1b16. Also I'm currently on cgminer 3.12.3.

I read through the whole thread and didn't see this issue or a related on (I think). I look forward to any help you can give and thank you in advance!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 27, 2014, 01:21:53 AM
Please upgrade to the latest version.  The newer versions will detect lack of network connectivity and/or lack of accepted shares.



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 27, 2014, 01:24:06 AM
one of my gpu always goes sick/dead...temperature decreases until it goes dead moved it on different PCI slots and same thing. Mining lasts for maybe 2-5minutes and then has to restart.

I definitely have more then enough of a PSU as I have the corsair 1300Watt and only using 3 GPU HIS ICEQ 7950 and my kill-a-watt says 850watts.

I'd try lowering your intensity or gpu-engine settings until that card is stable.  Each card is unique.  Your PSU is fine.  Cheers.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: nrps1 on March 28, 2014, 12:09:14 PM
I've been looking for something like this as I'm getting really frustrated with random hangs... For example I went on a training course for 10 hours and discovered a minute after I left my house cgminer hung for the whole time grrrrr.

The problem I have is I'm a linux n00b (shock horror!) and I'll need a little help if possible please!

As background I followed the cryptobadger guide completely for my rig, to the letter, and my concern is that I'm not too sure what I'd need to disable and how to integrate this. Has anyone got the knowhow to help me? I'd need a step by step what to type to stop the cryptobadger and move to this if possible.

If it is straight forward and I don't need to do much, feel free to point me in the right direction!

Of course, it goes without saying, whoever can get me up and running (without these infuriating crashes) will indeed get a donation as I would very much appreciate your time :)

I am an IT professional FYI, just not in Linux...



Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 28, 2014, 03:29:52 PM
The instructions are at the top of the cgmon.tcl file and are pretty much step by step.  You just need to know how to edit a text file in unix (/etc/crontab) and known what paths you're already using for your cgminer setup.  cgmon wont interfere with any of your cryptobadger stuff.


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 28, 2014, 03:33:57 PM
I've added the install instructions to the first post in this thread (its 4 steps).


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: nrps1 on March 28, 2014, 04:13:13 PM
I've added the install instructions to the first post in this thread (its 4 steps).

So you think that this shouldn't interfere with Step 6: Create cgminer startup script or Step 7: Create auto-start scripts?

http://www.cryptobadger.com/2013/04/build-a-litecoin-mining-rig-linux/


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: qys2008abcd on March 29, 2014, 04:32:43 AM
Thanks for the script, it's really useful as my rig randomly hangs in a few hours. >:( You saved me from endless nights of panic and wake up to a dead miner. I do have a question about the conf of the script:

Is there an option that CGmon can reboot the miner if CGminer failed to start?

I notice sometimes after reboot, CGminer just won't start and giving "invalid MIT-MAGIK-COOKIES-1 key segmentation fault", a cold reboot would fix the problem nicely. But right now CGmon would go into an endless circle saying "can't find cgminer running and check your conf file" but no reboot would take place. Am I missed the option or it does not come with this option yet? Right now I just use a small cron script to run constantly to check CGminer existence every 15 minutes. If CGmon has this already built in would be really great!



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: rorbit on March 29, 2014, 12:17:47 PM
Hi,

a few of times now I've woken up to a dead system with disk errors.  I click F to fix the errors and everything is fine.  I guess the last time the errors were too much as this didn't work.  Manually running fsck used up all memory and crashed.  The same thing happened when I ran a live cd and attempted to fix the disk.  So I re-installed the OS :(

I'm wondering if there is a more graceful way to shut down the system and avoid this or are we using best practices already?


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on March 31, 2014, 05:10:37 PM
Hi,

a few of times now I've woken up to a dead system with disk errors.  I click F to fix the errors and everything is fine.  I guess the last time the errors were too much as this didn't work.  Manually running fsck used up all memory and crashed.  The same thing happened when I ran a live cd and attempted to fix the disk.  So I re-installed the OS :(

I'm wondering if there is a more graceful way to shut down the system and avoid this or are we using best practices already?

Cgmon uses standard shutdown procedures - nothing that would cause file system corruption.

Sounds like you might want a new hard drive on that rig... It might last for awhile but it's probably failing.





Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on March 31, 2014, 05:16:14 PM
Thanks for the script, it's really useful as my rig randomly hangs in a few hours. >:( You saved me from endless nights of panic and wake up to a dead miner. I do have a question about the conf of the script:

Is there an option that CGmon can reboot the miner if CGminer failed to start?

I notice sometimes after reboot, CGminer just won't start and giving "invalid MIT-MAGIK-COOKIES-1 key segmentation fault", a cold reboot would fix the problem nicely. But right now CGmon would go into an endless circle saying "can't find cgminer running and check your conf file" but no reboot would take place. Am I missed the option or it does not come with this option yet? Right now I just use a small cron script to run constantly to check CGminer existence every 15 minutes. If CGmon has this already built in would be really great!


You can make your system reboot at that point with a small customization.  Find this line in cgmon.tcl:
Code:
				sendmail "[stamp] $hostname - $conf(cgminer_exec) failed to start" "$hostname $conf(cgminer_exec) failed to start.\n mining command was: $mining_command\n"

Add a new line below it with this one command:

Code:
reboot


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: jdape on March 31, 2014, 05:17:24 PM
I've added the install instructions to the first post in this thread (its 4 steps).

So you think that this shouldn't interfere with Step 6: Create cgminer startup script or Step 7: Create auto-start scripts?

http://www.cryptobadger.com/2013/04/build-a-litecoin-mining-rig-linux/


Correct.  It shouldn't interfere :)


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: pitBullXXX on April 04, 2014, 06:13:24 AM
Hello, need some help.

I have a RaspPi and some gridseeds. Sometimes miners randomly fail and have to restart cgminer.

Code:
[2014-04-03 03:18:57] GSD 2 GetResults usb read err:(-1) LIBUSB_ERROR_IO
[2014-04-03 03:18:57] No response from 2
[2014-04-03 03:18:57] GSD 2 failure, disabling!
[2014-04-03 03:19:01] Stratum from pool 1 detected new block
[2014-04-03 03:19:03] Accepted aaeacd03 Diff 383/256 GSD 3 pool 1
[2014-04-03 03:19:10] Accepted 8fc9cf7f Diff 456/256 GSD 1 pool 1

I followed everything in the CGmon installation instructions.
 
 Did ./cgmon.tcl and cgminer starts up but when a miner fails, cgminer does not restart.
 
 So, is there a way to get CGmon to work with gridseeds?


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 04, 2014, 03:01:57 PM
When that happens, run this command and send me the result.

Code:
php -f /tmp/cgmon-api.php notify

I may be able to add support for gridseed with that information.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: noodle_dam on April 05, 2014, 09:24:07 AM
Sorry, I'm a pre-school level Linux user. Could you break step 2 in the installation instructions down a little more. I'm using BAMT.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 05, 2014, 03:19:38 PM
If your path to cgmon.tcl was /home/username/cgmon.tcl you could use this to add the line to crontab:

Code:
echo "*/2 * * * *  root	/home/username/cgmon.tcl >/dev/null 2>&1" >> /etc/crontab


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: itraxe on April 05, 2014, 04:08:56 PM
bro

we need for multiple config and edition cgmon setting

like if somebody have 50-100 pc its very hard to change all conf info in ur file on each pc.

could u help with that ?

like u have client file and server file too for mass controll cgmon on pcs


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 05, 2014, 05:33:21 PM
bro

we need for multiple config and edition cgmon setting

like if somebody have 50-100 pc its very hard to change all conf info in ur file on each pc.

could u help with that ?

like u have client file and server file too for mass controll cgmon on pcs

Place a customized copy of cgmon.tcl on a webserver and download it to each of your clients as needed.  

You could even change the auto update URL to your custom copy and then update your cgmon via the builtin update function
Code:
./cgmon.tcl update
 The update function saves the unique configuration options on each machine.



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: pitBullXXX on April 05, 2014, 05:44:01 PM
When that happens, run this command and send me the result.

Code:
php -f /tmp/cgmon-api.php notify

I may be able to add support for gridseed with that information.

Ok, miner GSD 3 went down.

Code:
--------------------------------------------------------------------------------
 [P]ool management [S]ettings [D]isplay options [Q]uit
 GSD 0: 8D8A16685449  875 MHz | 370.1K/370.2Kh/s | A:254784 R:512 HW: 51 WU: 1.4/m N: 259 255[49] 244 236 219[2
 GSD 1: 8D841F994849  888 MHz | 375.8K/375.7Kh/s | A:266880 R:  0 HW: 32 WU: 1.5/m N: 231 255 257[28] 241[4] 26
 GSD 2: 8D82348D5753  850 MHz | 359.5K/359.6Kh/s | A:263616 R:256 HW:164 WU: 1.5/m N: 270[65] 278[76] 279[22] 2
 GSD 3: 6D8514714857  913 MHz | OFF   /320.9Kh/s | A:226112 R:256 HW:  5 WU: 1.1/m N: 170 203 186 174[5] 188
--------------------------------------------------------------------------------

 [2014-04-05 13:21:26] Accepted 4a13a3d4 Diff 885/256 GSD 1 pool 0
 [2014-04-05 13:21:32] Accepted 2728d78c Diff 1.67K/256 GSD 2 pool 0
 [2014-04-05 13:21:46] Accepted cdf2dcd2 Diff 318/256 GSD 2 pool 0
 [2014-04-05 13:22:35] Accepted a150cecd Diff 406/256 GSD 2 pool 0
 [2014-04-05 13:22:37] Stratum from pool 0 detected new block
 [2014-04-05 13:22:38] Accepted 0a66c626 Diff 6.3K/256 GSD 1 pool 0
 [2014-04-05 13:22:49] Accepted 551185f5 Diff 770/256 GSD 0 pool 0
 [2014-04-05 13:22:53] Accepted 9b0cd043 Diff 423/256 GSD 1 pool 0
 [2014-04-05 13:23:01] Accepted 2cd1cb1c Diff 1.46K/256 GSD 2 pool 0
 [2014-04-05 13:23:10] Accepted a76977fd Diff 391/256 GSD 1 pool 0
 [2014-04-05 13:23:14] Accepted 5dd9ddf1 Diff 698/256 GSD 0 pool 0
 [2014-04-05 13:23:17] Stratum from pool 0 detected new block


Code:
pi@raspberrypi ~ $ php -f /tmp/cgmon-api.php notify
 notify returned 'STATUS=S,When=1396718524,Code=60,Msg=Notify,Description=cgminer 3.7.2|NOTIFY=0,Name=GSD,ID=0,Last Well=1396718524,Last Not Well=0,Reason Not Well=None,*Thread Fail Init=0,*Thread Zero Hash=0,*Thread Fail Queue=0,*Dev Sick Idle 60s=0,*Dev Dead Idle 600s=0,*Dev Nostart=0,*Dev Over Heat=0,*Dev Thermal Cutoff=0,*Dev Comms Error=0,*Dev Throttle=0|NOTIFY=1,Name=GSD,ID=1,Last Well=1396718524,Last Not Well=0,Reason Not Well=None,*Thread Fail Init=0,*Thread Zero Hash=0,*Thread Fail Queue=0,*Dev Sick Idle 60s=0,*Dev Dead Idle 600s=0,*Dev Nostart=0,*Dev Over Heat=0,*Dev Thermal Cutoff=0,*Dev Comms Error=0,*Dev Throttle=0|NOTIFY=2,Name=GSD,ID=2,Last Well=1396718524,Last Not Well=0,Reason Not Well=None,*Thread Fail Init=0,*Thread Zero Hash=0,*Thread Fail Queue=0,*Dev Sick Idle 60s=0,*Dev Dead Idle 600s=0,*Dev Nostart=0,*Dev Over Heat=0,*Dev Thermal Cutoff=0,*Dev Comms Error=0,*Dev Throttle=0|NOTIFY=3,Name=GSD,ID=3,Last Well=1396710329,Last Not Well=1396710329,Reason Not Well=Thread got zero hashes,*Thread Fail Init=0,*Thread Zero Hash=1,*Thread Fail Queue=0,*Dev Sick Idle 60s=0,*Dev Dead Idle 600s=0,*Dev Nostart=0,*Dev Over Heat=0,*Dev Thermal Cutoff=0,*Dev Comms Error=0,*Dev Throttle=0|'
Array
(
    [STATUS] => Array
        (
            [STATUS] => S
            [When] => 1396718524
            [Code] => 60
            [Msg] => Notify
            [Description] => cgminer 3.7.2
        )

    [NOTIFY0] => Array
        (
            [NOTIFY] => 0
            [Name] => GSD
            [ID] => 0
            [Last Well] => 1396718524
            [Last Not Well] => 0
            [Reason Not Well] => None
            [*Thread Fail Init] => 0
            [*Thread Zero Hash] => 0
            [*Thread Fail Queue] => 0
            [*Dev Sick Idle 60s] => 0
            [*Dev Dead Idle 600s] => 0
            [*Dev Nostart] => 0
            [*Dev Over Heat] => 0
            [*Dev Thermal Cutoff] => 0
            [*Dev Comms Error] => 0
            [*Dev Throttle] => 0
        )

    [NOTIFY1] => Array
        (
            [NOTIFY] => 1
            [Name] => GSD
            [ID] => 1
            [Last Well] => 1396718524
            [Last Not Well] => 0
            [Reason Not Well] => None
            [*Thread Fail Init] => 0
            [*Thread Zero Hash] => 0
            [*Thread Fail Queue] => 0
            [*Dev Sick Idle 60s] => 0
            [*Dev Dead Idle 600s] => 0
            [*Dev Nostart] => 0
            [*Dev Over Heat] => 0
            [*Dev Thermal Cutoff] => 0
            [*Dev Comms Error] => 0
            [*Dev Throttle] => 0
        )

    [NOTIFY2] => Array
        (
            [NOTIFY] => 2
            [Name] => GSD
            [ID] => 2
            [Last Well] => 1396718524
            [Last Not Well] => 0
            [Reason Not Well] => None
            [*Thread Fail Init] => 0
            [*Thread Zero Hash] => 0
            [*Thread Fail Queue] => 0
            [*Dev Sick Idle 60s] => 0
            [*Dev Dead Idle 600s] => 0
            [*Dev Nostart] => 0
            [*Dev Over Heat] => 0
            [*Dev Thermal Cutoff] => 0
            [*Dev Comms Error] => 0
            [*Dev Throttle] => 0
        )

    [NOTIFY3] => Array
        (
            [NOTIFY] => 3
            [Name] => GSD
            [ID] => 3
            [Last Well] => 1396710329
            [Last Not Well] => 1396710329
            [Reason Not Well] => Thread got zero hashes
            [*Thread Fail Init] => 0
            [*Thread Zero Hash] => 1
            [*Thread Fail Queue] => 0
            [*Dev Sick Idle 60s] => 0
            [*Dev Dead Idle 600s] => 0
            [*Dev Nostart] => 0
            [*Dev Over Heat] => 0
            [*Dev Thermal Cutoff] => 0
            [*Dev Comms Error] => 0
            [*Dev Throttle] => 0
        )

)
[/code]


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 05, 2014, 05:48:58 PM
Is cgmon running every few minutes in your crontab?  If you're not sure, check the log file.





Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: pitBullXXX on April 05, 2014, 06:43:28 PM
I think you solved the problem... I had the wrong path to cgmon.tcl in crontab.

Now it shows its running in the log file.

Will see if it restarts cgminer when a miner goes down.

Thank you


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 05, 2014, 08:05:59 PM
Sure thing.  Cheers! :)


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: bomberb17 on April 08, 2014, 08:12:36 AM
When I manually run it, I don't receive any mail ( I have gmail).
Waiting to see if I receive when cgminer crashes..


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: whitetoo on April 08, 2014, 09:30:08 AM
Just been testing this script for the past 24 hours! It's caught 3 SICK GPUs so far and solved with an automatic reboot. Thank you to the developers, no more midnight panics!

I did have one question, when the system is told to reboot, cgmon starts cgminer in the background. I then have to open the terminal and type "screen -r" to see the readout from the miners. Is it possible to have this happen automatically following an auto-reboot? Thank you


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 08, 2014, 01:37:27 PM
When I manually run it, I don't receive any mail ( I have gmail).
Waiting to see if I receive when cgminer crashes..

Check your configuration options.  This is the default:

Code:
# send email when running script by hand (no or yes)
set mail(notify_on_manual_runs) "no"


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 08, 2014, 01:48:23 PM
Just been testing this script for the past 24 hours! It's caught 3 SICK GPUs so far and solved with an automatic reboot. Thank you to the developers, no more midnight panics!

I did have one question, when the system is told to reboot, cgmon starts cgminer in the background. I then have to open the terminal and type "screen -r" to see the readout from the miners. Is it possible to have this happen automatically following an auto-reboot? Thank you

So you're saying you want to see your miner in a terminal window after a reboot?  Hmm...   I'm sure that's possible but it would involve ugly hacks and wouldn't work reliably.   I think you'll have to type screen -r as needed for now.   That being said - you can use any computer to SSH (remotely login) into your miner computer and then type screen -r.   You don't have to physically go to your miner and pull it up on the big screen.  For example, I can open five terminal windows on my laptop, each with an SSH session to a miner and see all five at once from anywhere.

When I get sick gpu's over and over, I lower the clock speed (gpu-engine) by 10 and start it again.  Repeat until card is stable.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: whitetoo on April 08, 2014, 02:15:14 PM
Thanks for the advice jdape. Will look into the SSL option.
Noted on the gpu engine clock, sometimes the gpus can run for 48hours+ and be absolutely fine and other times they will run for an hour. Frustrating as they appear to be stable and then throw a curveball.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 08, 2014, 09:01:42 PM
Thanks for the advice jdape. Will look into the SSL option.
Noted on the gpu engine clock, sometimes the gpus can run for 48hours+ and be absolutely fine and other times they will run for an hour. Frustrating as they appear to be stable and then throw a curveball.

Now that spring is here - I notice if certain windows are closed vs opened, that makes the difference between stability and constant hangs.  Will have to power down (depending on price) or break out the AC units soon! :)



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: bomberb17 on April 09, 2014, 07:50:40 AM
When I manually run it, I don't receive any mail ( I have gmail).
Waiting to see if I receive when cgminer crashes..

Check your configuration options.  This is the default:

Code:
# send email when running script by hand (no or yes)
set mail(notify_on_manual_runs) "no"

Yes I have that option enabled. Mail is coming when cgminer hangs though.
I also have another question: I added the line
*/2 * * * *        root    /home/user/cgmon.tcl >/dev/null 2>&1
in /etc/crontab as in the instruct.ons. While the script most of the time runs ok, I see that sometimes it does not. For example, this is the output of the log:
Code:
bomberb17@bomberb17-ltcminer:~$ tail -n 20 cgmon.log
Apr 09 02:42:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:44:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:46:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:48:01 bomberb17-ltcminer - GPU 0 Shares accepted since last run:  65  (5.43 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - GPU 1 Shares accepted since last run:  68  (5.68 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - GPU 2 Shares accepted since last run:  62  (5.18 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:50:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:52:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:54:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:56:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:58:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:00:02 bomberb17-ltcminer - GPU 0 no accepted shares in 721 seconds. GPU probably hung.
Apr 09 03:02:02 bomberb17-ltcminer - cgminer API is not enabled/responding.  Restart cgminer with '--api-listen' or check the status of mining pools.
Apr 09 03:04:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:06:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:08:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:10:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:12:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:14:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
And I received the email on 03.00am.
While it restarted my computer and cgminer continued to run fine, the script stopped running every 2 minutes for some reason. I tried adding the line also in crontab -e but nothing changed.
Any ideas?
My os is Xubuntu 12.10


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: bomberb17 on April 09, 2014, 07:55:49 AM
When I manually run it, I don't receive any mail ( I have gmail).
Waiting to see if I receive when cgminer crashes..

Check your configuration options.  This is the default:

Code:
# send email when running script by hand (no or yes)
set mail(notify_on_manual_runs) "no"

Yes I have that option enabled. Mail is coming when cgminer hangs though.
I also have another question: I added the line
*/2 * * * *        root    /home/user/cgmon.tcl >/dev/null 2>&1
in /etc/crontab as in the instruct.ons. While the script most of the time runs ok, I see that sometimes it does not. For example, this is the output of the log:
Code:
bomberb17@bomberb17-ltcminer:~$ tail -n 20 cgmon.log
Apr 09 02:42:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:44:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:46:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:48:01 bomberb17-ltcminer - GPU 0 Shares accepted since last run:  65  (5.43 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - GPU 1 Shares accepted since last run:  68  (5.68 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - GPU 2 Shares accepted since last run:  62  (5.18 shares/min)
Apr 09 02:48:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:50:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:52:02 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:54:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:56:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 02:58:01 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:00:02 bomberb17-ltcminer - GPU 0 no accepted shares in 721 seconds. GPU probably hung.
Apr 09 03:02:02 bomberb17-ltcminer - cgminer API is not enabled/responding.  Restart cgminer with '--api-listen' or check the status of mining pools.
Apr 09 03:04:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:06:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:08:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:10:04 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:12:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
Apr 09 03:14:03 bomberb17-ltcminer - cgmon 1.0.8 - cgminer running and all GPUs healthy.
And I received the email on 03.00am.
While it restarted my computer and cgminer continued to run fine, the script stopped running every 2 minutes for some reason. I tried adding the line also in crontab -e but nothing changed.
Any ideas?
My os is Xubuntu 12.10


See this also
Code:
bomberb17@bomberb17-ltcminer:~$ ./cgmon.tcl
invalid bareword "exited"
in expression "229 - exited";
should be "$exited" or "{exited}" or "exited(...)" or ...
    (parsing expression "229 - exited")
    invoked from within
"expr  $current_accepted($n) -  $previous_accepted($n)"
    (procedure "check_status" line 197)
    invoked from within
"check_status"
    (file "./cgmon.tcl" line 602)


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 09, 2014, 06:23:25 PM
Can you please paste the contents of /tmp/accepted_count


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: bomberb17 on April 10, 2014, 04:46:48 AM
Can you please paste the contents of /tmp/accepted_count

Code:
bomberb17@bomberb17-ltcminer:~$ cat /tmp/accepted_count
1127 1397104922
1151 1397104922
1146 1397104922

I have restarted my rig and now cgmon works ok again.
However I have seen cgminer hanging many times without cgmon catching it, and I suspect that this "bug" (which happens once in a while) is the reason.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: freskhu on April 10, 2014, 09:37:10 AM
Hi there,
I have this scrypt running on one rig and i am trying to put on the others.
I run them with bamt 1.3, when i first installed i had this error but i dont remember how i fix it!

i got this information on the log
http://prntscr.com/38nkfi

On the config file i have the right path:
http://prntscr.com/38nkt4

any help? :D


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: freskhu on April 10, 2014, 09:44:15 AM
when running it manually:

http://prntscr.com/38nlyx

Ninja edit: this error i solved, in the path to log it misses a "/"



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: freskhu on April 10, 2014, 09:55:49 AM
If i run the scrypt manually it works, but it wont do it alone! how to fix? :D


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: ivanlabrie on April 10, 2014, 02:09:11 PM
Hi, do I need to add this to say BAMT/SMOS/NotSMOS 1.3 or PiMP to have the rig reboot when sick devices are found?


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 10, 2014, 06:05:12 PM
Hi, do I need to add this to say BAMT/SMOS/NotSMOS 1.3 or PiMP to have the rig reboot when sick devices are found?

I haven't used those, but I believe so.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 10, 2014, 06:08:47 PM
Can you please paste the contents of /tmp/accepted_count

Code:
bomberb17@bomberb17-ltcminer:~$ cat /tmp/accepted_count
1127 1397104922
1151 1397104922
1146 1397104922

I have restarted my rig and now cgmon works ok again.
However I have seen cgminer hanging many times without cgmon catching it, and I suspect that this "bug" (which happens once in a while) is the reason.

Sounds like it.  There's only so much we can do in this case.  You could try running sgminer instead.  It's a fork of later version of cgminer, with scrypt support.



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: freskhu on April 13, 2014, 08:56:35 PM
is there any way to add a feature?
If the card's temp goes to specific temperature it stops mine for like 5 minutes than reboot! this can be turn on or off!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 14, 2014, 01:20:01 AM
is there any way to add a feature?
If the card's temp goes to specific temperature it stops mine for like 5 minutes than reboot! this can be turn on or off!

That would not be difficult to add.  Perhaps a donation would provide some motivation to make it happen :)


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: Coinstron on April 15, 2014, 12:15:52 PM
Hi! tnx for great script!
but it is very sad to see this on my rig at mornings

Quote
Mar 03 20:00:02 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:02:01 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:04:03 bamt-miner - cgmon 1.0.8 - sgminer running and all GPUs healthy.
Mar 03 20:06:11 bamt-miner - sgminer is not responding.  Rebooting.
Mar 03 20:06:21 bamt-miner -
Mar 03 20:08:44 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:08:44 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:08:45 bamt-miner - sgminer started successfully.  Use 'screen -r' to attach to sgminer and Control-a-d to detach.
Mar 03 20:10:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:10:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:10:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:12:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:12:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:12:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.
Mar 03 20:14:01 bamt-miner - sgminer not running, starting via this command:
Mar 03 20:14:01 bamt-miner - /opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf
Mar 03 20:14:02 bamt-miner - sgminer failed to start.  Try running the mining command above to find the error.  Also, double check your GPU options.

sometimes X is not starting after reboot and cgmon restart sgminer in endless cycle. maybe rebooting rig after N failed starts will be good solution?

I bet there's an error in your .conf file.  What happens when you run the command manually?

Code:
/opt/miners/sph-sgminer/sgminer --api-listen   -c /opt/miners/sph-sgminer/sgminer.conf

Are you running as root or another user?  Could also be a permissions issue.  Either way, running it by hand should show the problem.


Hi!
.conf is ok, rig on default BAMT with another mining software (sgminer). Problem occurs when X.org does not start automatically (sometimes it happens) at boot (and AMD driver not working). You can try this sutuation. Sgminer exiting and return nothing. If X.org running, everything works well.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 15, 2014, 05:45:43 PM
Perhaps you can fix your X.org startup problem?  Sounds like that would make it work reliably.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: eddible on April 17, 2014, 07:18:10 AM
I'm a little confused by the config script. Why does it need my sgminer settings? All I want the script for is to reboot the machine now and again if a card goes sick, once it has rebooted, it's already set up to restart mining automatically so I don't need the script to do anything else. Can I just leave these settings blank, or comment them out? Same with the primary pool settings.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 17, 2014, 02:06:52 PM
I'm a little confused by the config script. Why does it need my sgminer settings? All I want the script for is to reboot the machine now and again if a card goes sick, once it has rebooted, it's already set up to restart mining automatically so I don't need the script to do anything else. Can I just leave these settings blank, or comment them out? Same with the primary pool settings.

To get that behavior, you can comment out these two lines to disable mining:

Code:
			catch {exec /bin/bash -c $exec_cmd} out
Code:
			catch {exec su $conf(mining_user) -c /bin/bash -c $exec_cmd} out

Make sure this is set to the correct name of your mining program:

Code:
set conf(cgminer_exec) "cgminer"

The other settings can probably be left as is, or blank.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: blackvoice on April 20, 2014, 07:53:56 AM
very nice tool


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: hotrock on April 24, 2014, 07:32:50 AM
jdape,

Just want to make sure that your donation address for BTC is 13D196kLTMPQMattuz2AtpzasX8pVW6G4U before I send some your way. I said I would donate a while ago but now that I have everything sorted out I'm here to live up to what I said.

Thanks for cgmon!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 24, 2014, 01:48:39 PM
Hi Hotrock,

http://blockchain.info/address/13D196kLTMPQMattuz2AtpzasX8pVW6G4U

Yep, that's the correct address.  Thanks!


Title: Re: cgmon - cgminer monitor for Linux - auto restart, reboot, sick gpu detect &more
Post by: hashrsyndicate on April 24, 2014, 08:16:21 PM
Hello! Great scrypt! I have a question. I use Bamt/Smos and disable GPU0 (Integrated graphics) in bamt.conf and cgminer.conf but cgmon still check it and reboot because it Sick or Dead. How can i disable check for GPU0 in scrypt?

Hi,

You can disable checking of GPU 0 like this.

Find this line:
Code:
if {$gpu_status >1}  { 

below it add this new line:

Code:
if {$i == 0} {break}



I was having an issue with my APUs causing unwanted reboots so I added a way of disabling the checking on one GPU. This change to the script seems to have broken the log file and still have to disable the check of shares because the disabled GPU will still trigger a reboot. I do not know how to program TCL so I am sure there is a better approach to what I did but it fixes the issue I was having with Cgmon.

Code:

#Added this to the top of the script to disable chosen GPU

# Disable status checking of GPU
# set value of disabled GPU to prevent unwarranted reboot
set gpu(disable) "0"

# Added this line to the fore mentioned fix under line if {$gpu_status >1}  {

# Find out which GPU is having a problem
# Added 'if {$i == $gpu(disable)} {break}' MAO HashrSyndicate

set data [split $argx "\n"]
foreach line $data {
set gpu_status [lindex $line 4]
if {$gpu_status >1}  {
if {$i == $gpu(disable)} {break}

 



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: hashrsyndicate on April 24, 2014, 11:33:10 PM
So it ran a good 14 hours before having a hard lockup, after manually restarting the log file resumed working. Have not figured out why they log file did not work at first and now need to figure out why cgmon was unable to restart the system. Also need to figure out a way to skip past disabled GPUs when checking accepted shares. Besides disabling APUs so they do no trigger a false restart, I also sometimes pull a GPU from mining rigs for running oclvanitygen. If anyone has any thoughts on how to disable the check for accepted shares on a specific GPU it would be much appreciated and I am sure beneficial for others beyond myself.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: hotrock on April 25, 2014, 11:45:29 AM
Alrighty! Send it. Hopefully this gets the ball rolling and others decide to chip in!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on April 25, 2014, 01:34:03 PM
Alrighty! Send it. Hopefully this gets the ball rolling and others decide to chip in!

Thank you!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: soulreafer on May 08, 2014, 03:59:17 PM
still waiting for the function which just restarts the cgminer. restarting the whole system takes to long on my raspberry pi and gridseeds

edit:

could it be possible to change the reboot function?
so i just remove the reboot command and add my own stuff for killing all screens with a specific name and run a cgminer startscript again?


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on May 08, 2014, 04:48:08 PM
still waiting for the function which just restarts the cgminer. restarting the whole system takes to long on my raspberry pi and gridseeds

edit:

could it be possible to change the reboot function?
so i just remove the reboot command and add my own stuff for killing all screens with a specific name and run a cgminer startscript again?

Yep, you can do that.  I would replace the reboot section of code with something like this:

Code:
proc reboot {} {
global conf
#forcibly kill all mining processes
 catch {exec killall -9 $conf(cgminer_exec)} out
#wait 10 seconds (set this to at least as long as it takes your miners to start up again)
after 10000
#re-check the status
check_status
}


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: soulreafer on May 08, 2014, 07:00:56 PM
thanks for the quick reply. this works perfect.
so i dont miss 10-20 shares per unit on a total reboot :)


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: chrison999 on June 04, 2014, 06:40:29 PM
Quick question for you...

Does cgmon work with ASIC miners?  I'm running 3 gridseeds and 5 GAWMiners fury rigs and would *love* to use cgmon for them.

Thanks!

Regards,

Chris


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on June 04, 2014, 06:58:46 PM
Quick question for you...

Does cgmon work with ASIC miners?  I'm running 3 gridseeds and 5 GAWMiners fury rigs and would *love* to use cgmon for them.

Thanks!

Regards,

Chris


Yes. I've tested it with a GAW black widow and it works.  There was a temporary problem when the GAW miner was reporting a SICK ASIC, but I haven't been able to reproduce it.  That was 6 days ago and it's been fine since.

I don't have any gridseeds to test with, but it should work.


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: hotrock on June 04, 2014, 07:09:06 PM
jdape

I have started using both cgminer and sgminer on BAMT. Obviously I don't run them at the same time but I do tend to change every couple of days.

Is there a way to have cgmon look for either a cgminer instance or an sgminer instance instead of having to change the path and name every time I want to change what miner I'm using?

If not it is no big deal it's just kind of tedious to change the settings in bamt and then change then rename the cgmon files. I have one cgmon_sg.tcl and one sgmon_cg.tcl that I rename to cgmon.tcl depending on which version is needed.

Thanks!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: jdape on June 04, 2014, 07:17:26 PM
jdape

I have started using both cgminer and sgminer on BAMT. Obviously I don't run them at the same time but I do tend to change every couple of days.

Is there a way to have cgmon look for either a cgminer instance or an sgminer instance instead of having to change the path and name every time I want to change what miner I'm using?

If not it is no big deal it's just kind of tedious to change the settings in bamt and then change then rename the cgmon files. I have one cgmon_sg.tcl and one sgmon_cg.tcl that I rename to cgmon.tcl depending on which version is needed.

Thanks!

Sure.  Add this code:

Code:
if {$argv == "sgminer"} {
set conf(cgminer_exec) "sgminer"
set conf(cgminer_path) ""
set conf(miner_requires_scrypt_flag) "no"

}

near the bottom of cgmon.tcl, just above this line:

Code:
# start

Then, when you run cgmon.tcl you would use either './cgmon.tcl' or './cgmon.tcl sgminer' to run sgminer with your settings.  Adjust accordingly for your path to cgmon.tcl.



Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: hotrock on June 05, 2014, 04:07:55 AM

Sure.  Add this code:

Code:
if {$argv == "sgminer"} {
set conf(cgminer_exec) "sgminer"
set conf(cgminer_path) ""
set conf(miner_requires_scrypt_flag) "no"

}

near the bottom of cgmon.tcl, just above this line:

Code:
# start

Then, when you run cgmon.tcl you would use either './cgmon.tcl' or './cgmon.tcl sgminer' to run sgminer with your settings.  Adjust accordingly for your path to cgmon.tcl.

Thanks!


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu detect, &more
Post by: chrison999 on June 05, 2014, 04:12:41 AM
Yes. I've tested it with a GAW black widow and it works.  There was a temporary problem when the GAW miner was reporting a SICK ASIC, but I haven't been able to reproduce it.  That was 6 days ago and it's been fine since.

I don't have any gridseeds to test with, but it should work.

Thanks for confirming that for me.  I didn't want to put a lot of effort into trying to get it running only to find out it's for GPU rigs only.  I'll play with it over the next few days and see how it works.

Thanks, again...

Regards,

Chris


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu, ASIC, &more
Post by: mikeobrien123 on June 19, 2014, 04:38:36 PM
Hi,
Does anyone have noob instructions for installing cgmon?
Im pretty new to linux commands and need a step-by-step to get things running.
I would appreciate any help!
Thanks!
-Mike


Title: Re: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu, ASIC, &more
Post by: jdape on June 19, 2014, 05:56:18 PM
Hi,
Does anyone have noob instructions for installing cgmon?
Im pretty new to linux commands and need a step-by-step to get things running.
I would appreciate any help!
Thanks!
-Mike

The first post in this thread and also the top of cgmon.tcl has step-by-step instructions.

Cheers,
Jon