Pages:
Author

Topic: cgmon - mining monitor for Linux - auto restart, reboot, sick gpu, ASIC, &more - page 5. (Read 48345 times)

sr. member
Activity: 269
Merit: 250

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.
sr. member
Activity: 269
Merit: 250
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.
newbie
Activity: 62
Merit: 0
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
hero member
Activity: 984
Merit: 1000
Kael, I'm using your updated installscript on BAMT 1.6 without the modifications in cgmon.tcl and it works flawlessly! Smiley

Thank you very much!
member
Activity: 110
Merit: 10
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.
newbie
Activity: 34
Merit: 0
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.

full member
Activity: 125
Merit: 100
Check out FireCoin!
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.
newbie
Activity: 10
Merit: 0
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).

hero member
Activity: 984
Merit: 1000
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 :/
newbie
Activity: 10
Merit: 0
Thank you a million, Kael! I've followed your instructions and will see if it works Smiley

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.
hero member
Activity: 984
Merit: 1000
Thank you a million, Kael! I've followed your instructions and will see if it works Smiley
newbie
Activity: 10
Merit: 0
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".
newbie
Activity: 10
Merit: 0

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.

hero member
Activity: 984
Merit: 1000
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?
newbie
Activity: 10
Merit: 0
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.
hero member
Activity: 984
Merit: 1000
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".
newbie
Activity: 10
Merit: 0
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.
full member
Activity: 125
Merit: 100
Check out FireCoin!
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


 


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?!
newbie
Activity: 2
Merit: 0
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?!
member
Activity: 98
Merit: 10
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.
Pages:
Jump to: