Bitcoin Forum
November 13, 2018, 05:59:47 AM *
News: Latest Bitcoin Core release: 0.17.0 [Torrent].
 
   Home   Help Search Login Register More  
Pages: « 1 ... 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 [283] 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 ... 415 »
  Print  
Author Topic: [OS] nvOC easy-to-use Linux Nvidia Mining vBASIC || Community Edition 2.0  (Read 392828 times)
papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 08:23:03 AM
 #5641

Can't find info, what is the pass for root? "miner1" doesn't work

I think root login is disabled.
You should set its password when logged in with m1

This will do the job:
Code:
sudo passwd

1542088787
Hero Member
*
Offline Offline

Posts: 1542088787

View Profile Personal Message (Offline)

Ignore
1542088787
Reply with quote  #2

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

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 09:05:24 AM
 #5642

My approach to move logs to tmpfs :
Please check, test and share if you have better solution
We also gonna need that dirty log rotate with some modification to clear the tmpfs


Hope this helps our friends with small USB installs, I think you need at least 4GB Ram
I set the size to 512Mb, change it if you like.

First :

Code:
mkdir /home/m1/nvoc_logs

Add this line to the end of fstab : "sudo nano /etc/fstab"
Code:
tmpfs /home/m1/nvoc_logs tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M 0 0


While you are in /etc/fstab you can comment out last 2 lines

Code:
$
#UUID=55184403759586FB /mnt/55184403759586FB auto nosuid,nodev,nofail,x-gvfs-sh ....
#/dev/disk/by-id/usb-SanDisk_Cruzer_Blade_4C530001260812105231-0:0-part1 /mnt/u ....

mount your new tmpfs without restart:
Code:
sudo mount -a

Change in IAmNotAJeep_and_Maxximus007_WATCHDOG

Code:
# Creating a log file to record restarts
LOG_FILE="/home/m1/nvoc_logs/5_restartlog"
if [ -e "$LOG_FILE" ] ; then
  #Limit the logfile, just keep the last 2K
 echo "$( cat $LOG_FILE |  tail -n 2k)" > $LOG_FILE
fi

change in Maxximus007_AUTO_TEMPERATURE_CONTROL

Code:
# Creating a log file to record restarts
LOG_FILE="/home/m1/nvoc_logs/6_autotemplog"
if [ -e "$LOG_FILE" ] ; then
  #Limit the logfile, just keep the last 2K
 echo "$( cat $LOG_FILE |tail -n 2k)" > $LOG_FILE
fi

Change for screenlog :

Code:
sudo nano /etc/screenrc

add to end:
Code:
logfile  /home/m1/nvoc_logs/screenlog.0

Changes in /home/m1/www/cgi-bin/minerinfo :


Code:
TEMP_FAN_POWER=$(tail  -n 50 /home/m1/nvoc_logs/6_autotemplog  | grep GPU | awk '{gsub(/:/,": ")}1' |tail -n $GPU_COUNT | awk '{print $0,"<br>"}' )

########################### Miner Logs ###########################

if [  $COIN == "BTCZ"  ] || $COIN == "ZEC"  ] || [  $COIN == "ZEN"  ] || [  $COIN == "ZCL"  ] || [  $COIN == "HUSH"  ] || [  $COIN == "KMD"  ] && [  $ZM_or_EWBF == "ZM"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 | grep -e GPU -e "====" |grep -v '#' | tail -n $TAIL_GPU_COUNT |sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [  $COIN == "BTCZ"  ] || [  $COIN == "ZEC"  ] || [  $COIN == "ZEN"  ] || [  $COIN == "ZCL"  ] || [  $COIN == "HUSH"  ] || [  $COIN == "KMD"  ] && [  $ZM_or_EWBF == "EWBF"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 | grep -E 'GPU0|Total' | grep -v Temp |grep -v INFO |  tail -n $TAIL_GPU_COUNT  |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif  [  $COIN == "SIB"  ] || [  $COIN == "LBC"  ] || [  $COIN == "MONA"  ] || [  $COIN == "SIA"  ] || [  $COIN == "ZPOOL_LYRA2V2"  ] || [  $COIN == "ZPOOL_LBRY"  ]  || [  $COIN == "ZPOOL_BLAKE2S"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "S/A/T" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "FTC"  ] || [ $COIN == "ORB"  ] || [ $COIN == "PXC"  ] || [ $COIN == "KRB"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "accepted" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "ETH"  ] || [  $COIN == "ETC"  ] || [  $COIN == "EXP"  ] || [  $COIN == "UBQ"  ] || [  $COIN == "MUSIC"  ] || [  $COIN == "SOIL"  ]  && [  $ETHMINER_or_GENOIL_or_CLAYMORE == "ETHMINER"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "ethminer" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "ETH"  ] || [  $COIN == "ETC"  ] || [  $COIN == "EXP"  ] || [  $COIN == "UBQ"  ] || [  $COIN == "MUSIC"  ] || [  $COIN == "SOIL"  ] || [  $COIN == "DUAL_*"  ] && [  $ETHMINER_or_GENOIL_or_CLAYMORE == "CLAYMORE"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -Ev 'DevFee|New job|SHARE FOUND|Share accepted' | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

else
MINER_LOG=$(tail -n $TAIL_GPU_COUNT /home/m1/nvoc_logs/screenlog.0 |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' |  awk '{print $0,"<br>"}')
fi

telegram papampi :

Code:


GPU_UTILIZATIONS=$(tail -n 5 /home/m1/nvoc_logs/5_restartlog | grep 'GPU UTILIZATION' | awk '{gsub(/GPU UTILIZATION:  /,"")}1' | tail -n 1)
TEMP_FAN_POWER=$(tail  -n 30 /home/m1/nvoc_logs/6_autotemplog  | grep GPU | awk '{gsub(/:/,": ")}1' |tail -n $GPU_COUNT )


Done.
Either restart your rig or restart miner with :
Code:
pkill -e screen
pkill -f 3main

Moordact
Newbie
*
Offline Offline

Activity: 53
Merit: 0


View Profile
November 16, 2017, 09:47:10 AM
 #5643

I updated 3/5 rigs from 1.3 -> 1.4

The new rigs I seem to get lower sol's when I monitor the miner it has an avg 85watt and 370 sol.

However my powerlimit is set at 105 watt and it should have 100-105watt and 440 sol.

Anybody else experiencing the issues?

This is on all 1.4 systems.
Stubo
Member
**
Offline Offline

Activity: 220
Merit: 13


View Profile
November 16, 2017, 10:32:52 AM
 #5644

I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

That is a neat idea. The code worked until I determining the IP of the pool and port. Those were set to huge strings full of IPs and ports:

Code:
m1@Testy:~$ echo "Miner's name : " $P_NAME
Miner's name :  zm
m1@Testy:~$ echo "Miner PID    : " $P_NUMBER
Miner PID    :  2191
m1@Testy:~$ echo "Pool's IP    : " $IP_POOL
Pool's IP    :  192.168.1.178 192.168.1.5 45.79.223.173 94.23.12.63 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5
<cut>
m1@Testy:~$ echo "pool's port  : " $PORT_POOL
pool's port  :  42000 54332 20570 3443 64395 64396 64546 64571 64589 64608 64627 64644 64660 64677 64694 64711 64718 64734 64748 64767 64782 64795 64820 64833 64849 64860 64869 64884 64899 64918 64935 64945 64977 64988 65008 65027 65044 65064 65086 65107 65127 65145 65168 65186 65203 65219 65235 65249 65263 65277
<cut>

I still don't think that checking for connectivity to a mining pool is a good idea because of all of the pitfalls in doing so as well as the odds of a good pool being down. That being said, I spent a little bit of time to develop my idea a little bit fuller. The following in totally untested in the sense that I have not put it into the watchdog and tried it out on my test rig. I have tested the logic however:

# This statement needs to be near the top of the watchdog script
Code:
NUM_MINER_CONS=0


# These statements need to be done continually [because of profit switching]
#  where we know that the miner is connected and mining, toward the end of wdog
Code:
# Store active miner connection info into MINER_CONS array
FILTER=$(ss -tn state listening | gawk 'NR > 1 {n=split($3,A,":"); B[NR-1]=A[n]} END {for (i=1; i<length(B); i++) printf ":%s\\s{2}+|", B[i]; printf ":%s\\s{2}+", B[i]}')
MINER_CONS=( $(ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4) )
NUM_MINER_CONS=${#MINER_CONS[@]}
if [ $NUM_MINER_CONS -eq 0 ]
then
   echo "$(date) - Cannot detect active miner connections" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
fi

# This is the check that should be done if the miner is down or the GPU utilization is low
Code:
# Make sure we can connect to the mining pools iff 1 or more known miner connections
if [ $NUM_MINER_CONS -gt 0 ]
then
   CAN_HIT_POOL=0
   while [ CAN_HIT_POOL -eq 0 ]
   do
      CAN_HIT_POOL = 1
      for CON in "${MINER_CONS[@]}"
      do
         POOL_IP=$(echo $CON| cut -d':' -f 1)
         POOL_PORT=$(echo $CON| cut -d':' -f 2)
         if ! nc -vzw1 $POOL_IP $POOL_PORT;
         then
            CAN_HIT_POOL=0
            echo "$(date) - Cannot connect to mining pool $POOL_IP, port $POOL_PORT, checking again in 30 seconds..." | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
         fi
      done
      if [ CAN_HIT_POOL -eq 0 ]
      then
         sleep 30
      fi  
   done
fi

Part of the difficulty here is that some miners will have multiple connections. One such is DSTM's zm. Also, folks can be using "plusCPU". Here is what the ss code I use spits out on my test rig with that case:
Code:
m1@Testy:~$ ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4
172.104.94.15:20580
45.79.223.173:20570
188.165.195.21:3443
so we need to handle the IPs and ports as an array and make sure we can get to all of them, right? Anyway, my sample code does that but I still have no plans to use it. I like the simple check for basic internet connectivity better.

Thanks.
kk003
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 16, 2017, 12:04:34 PM
 #5645



I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

Thanks a lot mate,
I think your approach is much better than stubo which is based on guessing which one is the server

I am thinking that the first IP/port is for the miner's DEV share and I am certain that the second is our connection to the mining pool (us-east.equihash-hub.miningpoolhub.com) since the destination port (20570) matches what I have configured in 1bash. So, assuming all of this is correct, we can then just use the same check to make sure that we can connect to both pools:

But both needs a stable mining process to be running, and when pool has problem we dont have it
So I cant understand when we have all the details in 1bash why we dont strip it from there with some simple commands.

You see any problems in my approach here :

Code:
# Begin papampi Mod

source /home/m1/1bash

CURRENT_COIN=$(head -n 200 /home/m1/1bash | grep COIN= | sed 's/COIN=//' | sed 's/\"//' | sed 's/\"//')
#echo "$CURRENT_COIN"

CURRENT_COIN_POOL=$(echo {$CURRENT_COIN}_POOL |sed 's/{//' | sed 's/}//' )
#echo $CURRENT_COIN_POOL

POOL_SERVER=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
#echo "$POOL_SERVER"

CURRENT_COIN_PORT=$(echo {$CURRENT_COIN}_PORT | sed 's/{//' | sed 's/}//')
#echo "$CURRENT_COIN_PORT"

if [[ $POOL_SERVER == *stratum* ]]
then
    #echo "stratum"
    PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | cut -d':' -f1 )
    #echo "Server: $PING_SERVER"
    PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | grep -Eo '[0-9]+$' )
    #echo "Port: $PING_PORT"    

if nc -vzw2 $PING_SERVER $PING_PORT;
    then
        # echo "Strartum Server, INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Stratum Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
elif [[ $CURRENT_COIN == *DUAL*  || $CURRENT_COIN == *ZPOOL_SKUNK* || $CURRENT_COIN == *SALFTER*  ]]
then
    #echo "Dual mining, check google"
    if nc -vzw2 google.com 443
    then
        # echo "Dual mining, google is up"
        #echo "            INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        #echo "Dual mining, google is down"
        echo "WARNING:  $(date) - Cant reach google" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
else
      PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
      #echo "Server: $PING_SERVER"
      PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_PORT | grep -o '".*"' | sed 's/"//' |sed 's/"//')
      #echo "Port: $PING_PORT"
      if nc -vzw1 $PING_SERVER $PING_PORT
    then
        #echo "Not a stratum server,INTERNET_IS_GO=1" | tee -a ${LOG_FILE}
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
fi


       # End papampi Mod

IMO best way to test pool connectivity is having pool and port in vars from 1bash or whatever (as you pointed out).
I did not know those already exist.

Your idea looks good to me, guess just need a exhaustive testing.  
kk003
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 16, 2017, 12:22:53 PM
 #5646

I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

That is a neat idea. The code worked until I determining the IP of the pool and port. Those were set to huge strings full of IPs and ports:

Code:
m1@Testy:~$ echo "Miner's name : " $P_NAME
Miner's name :  zm
m1@Testy:~$ echo "Miner PID    : " $P_NUMBER
Miner PID    :  2191
m1@Testy:~$ echo "Pool's IP    : " $IP_POOL
Pool's IP    :  192.168.1.178 192.168.1.5 45.79.223.173 94.23.12.63 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5
<cut>
m1@Testy:~$ echo "pool's port  : " $PORT_POOL
pool's port  :  42000 54332 20570 3443 64395 64396 64546 64571 64589 64608 64627 64644 64660 64677 64694 64711 64718 64734 64748 64767 64782 64795 64820 64833 64849 64860 64869 64884 64899 64918 64935 64945 64977 64988 65008 65027 65044 65064 65086 65107 65127 65145 65168 65186 65203 65219 65235 65249 65263 65277
<cut>

I still don't think that checking for connectivity to a mining pool is a good idea because of all of the pitfalls in doing so as well as the odds of a good pool being down. That being said, I spent a little bit of time to develop my idea a little bit fuller. The following in totally untested in the sense that I have not put it into the watchdog and tried it out on my test rig. I have tested the logic however:

# This statement needs to be near the top of the watchdog script
Code:
NUM_MINER_CONS=0


# These statements need to be done continually [because of profit switching]
#  where we know that the miner is connected and mining, toward the end of wdog
Code:
# Store active miner connection info into MINER_CONS array
FILTER=$(ss -tn state listening | gawk 'NR > 1 {n=split($3,A,":"); B[NR-1]=A[n]} END {for (i=1; i<length(B); i++) printf ":%s\\s{2}+|", B[i]; printf ":%s\\s{2}+", B[i]}')
MINER_CONS=( $(ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4) )
NUM_MINER_CONS=${#MINER_CONS[@]}
if [ $NUM_MINER_CONS -eq 0 ]
then
   echo "$(date) - Cannot detect active miner connections" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
fi

# This is the check that should be done if the miner is down or the GPU utilization is low
Code:
# Make sure we can connect to the mining pools iff 1 or more known miner connections
if [ $NUM_MINER_CONS -gt 0 ]
then
   CAN_HIT_POOL=0
   while [ CAN_HIT_POOL -eq 0 ]
   do
      CAN_HIT_POOL = 1
      for CON in "${MINER_CONS[@]}"
      do
         POOL_IP=$(echo $CON| cut -d':' -f 1)
         POOL_PORT=$(echo $CON| cut -d':' -f 2)
         if ! nc -vzw1 $POOL_IP $POOL_PORT;
         then
            CAN_HIT_POOL=0
            echo "$(date) - Cannot connect to mining pool $POOL_IP, port $POOL_PORT, checking again in 30 seconds..." | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
         fi
      done
      if [ CAN_HIT_POOL -eq 0 ]
      then
         sleep 30
      fi  
   done
fi

Part of the difficulty here is that some miners will have multiple connections. One such is DSTM's zm. Also, folks can be using "plusCPU". Here is what the ss code I use spits out on my test rig with that case:
Code:
m1@Testy:~$ ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4
172.104.94.15:20580
45.79.223.173:20570
188.165.195.21:3443
so we need to handle the IPs and ports as an array and make sure we can get to all of them, right? Anyway, my sample code does that but I still have no plans to use it. I like the simple check for basic internet connectivity better.

Thanks.


Mmmm, I see, thx for testing the code. I only use claymore and ewbf, never found so many open connection from the miner.
I think @Papampi's idea and yours are both great.

About my code and your output I've notice that only 2 ips (guess must be pool's ips) are public and all others are private.
In case of need should be easy to find the local network range and remove ip+port for those ones and keep only the public ips+ports.
That way it does not matter how many ips has the pool, it would be possible to ping all of them.
Anyway, just thinking aloud. All approaches look good to me, 
leenoox
Full Member
***
Offline Offline

Activity: 200
Merit: 101



View Profile
November 16, 2017, 12:32:54 PM
 #5647

I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

That is a neat idea. The code worked until I determining the IP of the pool and port. Those were set to huge strings full of IPs and ports:

Code:
m1@Testy:~$ echo "Miner's name : " $P_NAME
Miner's name :  zm
m1@Testy:~$ echo "Miner PID    : " $P_NUMBER
Miner PID    :  2191
m1@Testy:~$ echo "Pool's IP    : " $IP_POOL
Pool's IP    :  192.168.1.178 192.168.1.5 45.79.223.173 94.23.12.63 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5
<cut>
m1@Testy:~$ echo "pool's port  : " $PORT_POOL
pool's port  :  42000 54332 20570 3443 64395 64396 64546 64571 64589 64608 64627 64644 64660 64677 64694 64711 64718 64734 64748 64767 64782 64795 64820 64833 64849 64860 64869 64884 64899 64918 64935 64945 64977 64988 65008 65027 65044 65064 65086 65107 65127 65145 65168 65186 65203 65219 65235 65249 65263 65277
<cut>

I still don't think that checking for connectivity to a mining pool is a good idea because of all of the pitfalls in doing so as well as the odds of a good pool being down. That being said, I spent a little bit of time to develop my idea a little bit fuller. The following in totally untested in the sense that I have not put it into the watchdog and tried it out on my test rig. I have tested the logic however:

# This statement needs to be near the top of the watchdog script
Code:
NUM_MINER_CONS=0


# These statements need to be done continually [because of profit switching]
#  where we know that the miner is connected and mining, toward the end of wdog
Code:
# Store active miner connection info into MINER_CONS array
FILTER=$(ss -tn state listening | gawk 'NR > 1 {n=split($3,A,":"); B[NR-1]=A[n]} END {for (i=1; i<length(B); i++) printf ":%s\\s{2}+|", B[i]; printf ":%s\\s{2}+", B[i]}')
MINER_CONS=( $(ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4) )
NUM_MINER_CONS=${#MINER_CONS[@]}
if [ $NUM_MINER_CONS -eq 0 ]
then
   echo "$(date) - Cannot detect active miner connections" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
fi

# This is the check that should be done if the miner is down or the GPU utilization is low
Code:
# Make sure we can connect to the mining pools iff 1 or more known miner connections
if [ $NUM_MINER_CONS -gt 0 ]
then
   CAN_HIT_POOL=0
   while [ CAN_HIT_POOL -eq 0 ]
   do
      CAN_HIT_POOL = 1
      for CON in "${MINER_CONS[@]}"
      do
         POOL_IP=$(echo $CON| cut -d':' -f 1)
         POOL_PORT=$(echo $CON| cut -d':' -f 2)
         if ! nc -vzw1 $POOL_IP $POOL_PORT;
         then
            CAN_HIT_POOL=0
            echo "$(date) - Cannot connect to mining pool $POOL_IP, port $POOL_PORT, checking again in 30 seconds..." | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
         fi
      done
      if [ CAN_HIT_POOL -eq 0 ]
      then
         sleep 30
      fi  
   done
fi

Part of the difficulty here is that some miners will have multiple connections. One such is DSTM's zm. Also, folks can be using "plusCPU". Here is what the ss code I use spits out on my test rig with that case:
Code:
m1@Testy:~$ ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4
172.104.94.15:20580
45.79.223.173:20570
188.165.195.21:3443
so we need to handle the IPs and ports as an array and make sure we can get to all of them, right? Anyway, my sample code does that but I still have no plans to use it. I like the simple check for basic internet connectivity better.

Thanks.


Guys, you are overthinking and overcomplicating this pool/port detection.

Isn't the simplest solution to ps/grep/awk miner process and extract the  pool_address/port from the actual command that miner is running? Don't all miners use pool_addr/port as an argument?

I'm sorry I can't pitch in with an actual code and I am just throwing ideas here... I've been extremely busy and don't have spare time to write/test any code now. Many thanks to all members that are thinkering/coding to make nvOC even better than it is!

leenoox
Full Member
***
Offline Offline

Activity: 200
Merit: 101



View Profile
November 16, 2017, 12:39:46 PM
 #5648

My approach to move logs to tmpfs :
Please check, test and share if you have better solution
We also gonna need that dirty log rotate with some modification to clear the tmpfs


Hope this helps our friends with small USB installs, I think you need at least 4GB Ram
I set the size to 512Mb, change it if you like.

First :

Code:
mkdir /home/m1/nvoc_logs

Add this line to the end of fstab : "sudo nano /etc/fstab"
Code:
tmpfs /home/m1/nvoc_logs tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777,size=512M 0 0


While you are in /etc/fstab you can comment out last 2 lines

Code:
$
#UUID=55184403759586FB /mnt/55184403759586FB auto nosuid,nodev,nofail,x-gvfs-sh ....
#/dev/disk/by-id/usb-SanDisk_Cruzer_Blade_4C530001260812105231-0:0-part1 /mnt/u ....

mount your new tmpfs without restart:
Code:
sudo mount -a

Change in IAmNotAJeep_and_Maxximus007_WATCHDOG

Code:
# Creating a log file to record restarts
LOG_FILE="/home/m1/nvoc_logs/5_restartlog"
if [ -e "$LOG_FILE" ] ; then
  #Limit the logfile, just keep the last 2K
 echo "$( cat $LOG_FILE |  tail -n 2k)" > $LOG_FILE
fi

change in Maxximus007_AUTO_TEMPERATURE_CONTROL

Code:
# Creating a log file to record restarts
LOG_FILE="/home/m1/nvoc_logs/6_autotemplog"
if [ -e "$LOG_FILE" ] ; then
  #Limit the logfile, just keep the last 2K
 echo "$( cat $LOG_FILE |tail -n 2k)" > $LOG_FILE
fi

Change for screenlog :

Code:
sudo nano /etc/screenrc

add to end:
Code:
logfile  /home/m1/nvoc_logs/screenlog.0

Changes in /home/m1/www/cgi-bin/minerinfo :


Code:
TEMP_FAN_POWER=$(tail  -n 50 /home/m1/nvoc_logs/6_autotemplog  | grep GPU | awk '{gsub(/:/,": ")}1' |tail -n $GPU_COUNT | awk '{print $0,"<br>"}' )

########################### Miner Logs ###########################

if [  $COIN == "BTCZ"  ] || $COIN == "ZEC"  ] || [  $COIN == "ZEN"  ] || [  $COIN == "ZCL"  ] || [  $COIN == "HUSH"  ] || [  $COIN == "KMD"  ] && [  $ZM_or_EWBF == "ZM"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 | grep -e GPU -e "====" |grep -v '#' | tail -n $TAIL_GPU_COUNT |sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [  $COIN == "BTCZ"  ] || [  $COIN == "ZEC"  ] || [  $COIN == "ZEN"  ] || [  $COIN == "ZCL"  ] || [  $COIN == "HUSH"  ] || [  $COIN == "KMD"  ] && [  $ZM_or_EWBF == "EWBF"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 | grep -E 'GPU0|Total' | grep -v Temp |grep -v INFO |  tail -n $TAIL_GPU_COUNT  |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif  [  $COIN == "SIB"  ] || [  $COIN == "LBC"  ] || [  $COIN == "MONA"  ] || [  $COIN == "SIA"  ] || [  $COIN == "ZPOOL_LYRA2V2"  ] || [  $COIN == "ZPOOL_LBRY"  ]  || [  $COIN == "ZPOOL_BLAKE2S"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "S/A/T" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "FTC"  ] || [ $COIN == "ORB"  ] || [ $COIN == "PXC"  ] || [ $COIN == "KRB"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "accepted" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "ETH"  ] || [  $COIN == "ETC"  ] || [  $COIN == "EXP"  ] || [  $COIN == "UBQ"  ] || [  $COIN == "MUSIC"  ] || [  $COIN == "SOIL"  ]  && [  $ETHMINER_or_GENOIL_or_CLAYMORE == "ETHMINER"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -e "ethminer" | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

elif [ $COIN == "ETH"  ] || [  $COIN == "ETC"  ] || [  $COIN == "EXP"  ] || [  $COIN == "UBQ"  ] || [  $COIN == "MUSIC"  ] || [  $COIN == "SOIL"  ] || [  $COIN == "DUAL_*"  ] && [  $ETHMINER_or_GENOIL_or_CLAYMORE == "CLAYMORE"  ]
then
MINER_LOG=$(tail -n 150 /home/m1/nvoc_logs/screenlog.0 |  grep -Ev 'DevFee|New job|SHARE FOUND|Share accepted' | tail -n $TAIL_GPU_COUNT |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' | awk '{print $0,"<br>"}')

else
MINER_LOG=$(tail -n $TAIL_GPU_COUNT /home/m1/nvoc_logs/screenlog.0 |  sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g' |  awk '{print $0,"<br>"}')
fi

telegram papampi :

Code:


GPU_UTILIZATIONS=$(tail -n 5 /home/m1/nvoc_logs/5_restartlog | grep 'GPU UTILIZATION' | awk '{gsub(/GPU UTILIZATION:  /,"")}1' | tail -n 1)
TEMP_FAN_POWER=$(tail  -n 30 /home/m1/nvoc_logs/6_autotemplog  | grep GPU | awk '{gsub(/:/,": ")}1' |tail -n $GPU_COUNT )


Done.
Either restart your rig or restart miner with :
Code:
pkill -e screen
pkill -f 3main

Way to go dude. Everyone should change their contributions to include this. Use it as template.

BTW, the last paragraph, if you not gonna restart the rig I think you will need to kill watchdog as well.

Stubo
Member
**
Offline Offline

Activity: 220
Merit: 13


View Profile
November 16, 2017, 12:45:37 PM
 #5649


Mmmm, I see, thx for testing the code. I only use claymore and ewbf, never found so many open connection from the miner.
I think @Papampi's idea and yours are both great.

About my code and your output I've notice that only 2 ips (guess must be pool's ips) are public and all others are private.
In case of need should be easy to find the local network range and remove ip+port for those ones and keep only the public ips+ports.
That way it does not matter how many ips has the pool, it would be possible to ping all of them.
Anyway, just thinking aloud. All approaches look good to me, 

Yes. I did that intentionally to prove the point that once you open the can of worms that is testing for pool connectivity, a lot of scenarios come up that makes the problem a lot more difficult than one would think at first. In that example, as I say, I am using not only the ZM miner to mine for ZEC but also cpuminer to mine for XMR. Most people don't realize that DSTM's ZM miner uses 2 connections: 1) for his connection to the pool he uses to mine for his dev share 2) the connection to whatever pool you are mining.  (Side Note: As of the 0.5.4* version, BOTH connections had to work or the miner would not mine. Those that use that miner are all too familiar with that because the pool he uses (flypool in EU) was down for a few hours last week and his miner stopped working. Needless to say, this caused quite an uproar with his users (see https://bitcointalk.org/index.php?topic=2021765.1060) and he took a savage beating.)

*Fortunately, DSTM has just released version 0.5.5 that supposedly will not block if his dev pool connection is unavailable.
papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 12:46:05 PM
 #5650


Done.
Either restart your rig or restart miner with :
Code:
pkill -e screen
pkill -f 3main

Way to go dude. Everyone should change their contributions to include this. Use it as template.

BTW, the last paragraph, if you not gonna restart the rig I think you will need to kill watchdog as well.

This will kill wdog, temp, miner and 3main
when 3main get killed it will restart all those as well
Code:
pkill -e screen
pkill -f 3main

kk003
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 16, 2017, 12:50:37 PM
 #5651

I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

That is a neat idea. The code worked until I determining the IP of the pool and port. Those were set to huge strings full of IPs and ports:

Code:
m1@Testy:~$ echo "Miner's name : " $P_NAME
Miner's name :  zm
m1@Testy:~$ echo "Miner PID    : " $P_NUMBER
Miner PID    :  2191
m1@Testy:~$ echo "Pool's IP    : " $IP_POOL
Pool's IP    :  192.168.1.178 192.168.1.5 45.79.223.173 94.23.12.63 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5 192.168.1.5
<cut>
m1@Testy:~$ echo "pool's port  : " $PORT_POOL
pool's port  :  42000 54332 20570 3443 64395 64396 64546 64571 64589 64608 64627 64644 64660 64677 64694 64711 64718 64734 64748 64767 64782 64795 64820 64833 64849 64860 64869 64884 64899 64918 64935 64945 64977 64988 65008 65027 65044 65064 65086 65107 65127 65145 65168 65186 65203 65219 65235 65249 65263 65277
<cut>

I still don't think that checking for connectivity to a mining pool is a good idea because of all of the pitfalls in doing so as well as the odds of a good pool being down. That being said, I spent a little bit of time to develop my idea a little bit fuller. The following in totally untested in the sense that I have not put it into the watchdog and tried it out on my test rig. I have tested the logic however:

# This statement needs to be near the top of the watchdog script
Code:
NUM_MINER_CONS=0


# These statements need to be done continually [because of profit switching]
#  where we know that the miner is connected and mining, toward the end of wdog
Code:
# Store active miner connection info into MINER_CONS array
FILTER=$(ss -tn state listening | gawk 'NR > 1 {n=split($3,A,":"); B[NR-1]=A[n]} END {for (i=1; i<length(B); i++) printf ":%s\\s{2}+|", B[i]; printf ":%s\\s{2}+", B[i]}')
MINER_CONS=( $(ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4) )
NUM_MINER_CONS=${#MINER_CONS[@]}
if [ $NUM_MINER_CONS -eq 0 ]
then
   echo "$(date) - Cannot detect active miner connections" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
fi

# This is the check that should be done if the miner is down or the GPU utilization is low
Code:
# Make sure we can connect to the mining pools iff 1 or more known miner connections
if [ $NUM_MINER_CONS -gt 0 ]
then
   CAN_HIT_POOL=0
   while [ CAN_HIT_POOL -eq 0 ]
   do
      CAN_HIT_POOL = 1
      for CON in "${MINER_CONS[@]}"
      do
         POOL_IP=$(echo $CON| cut -d':' -f 1)
         POOL_PORT=$(echo $CON| cut -d':' -f 2)
         if ! nc -vzw1 $POOL_IP $POOL_PORT;
         then
            CAN_HIT_POOL=0
            echo "$(date) - Cannot connect to mining pool $POOL_IP, port $POOL_PORT, checking again in 30 seconds..." | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
         fi
      done
      if [ CAN_HIT_POOL -eq 0 ]
      then
         sleep 30
      fi  
   done
fi

Part of the difficulty here is that some miners will have multiple connections. One such is DSTM's zm. Also, folks can be using "plusCPU". Here is what the ss code I use spits out on my test rig with that case:
Code:
m1@Testy:~$ ss -tn state established dst :* | grep -P -v "$FILTER" | grep -v Port |tr -s ' '|cut -d ' ' -f 4
172.104.94.15:20580
45.79.223.173:20570
188.165.195.21:3443
so we need to handle the IPs and ports as an array and make sure we can get to all of them, right? Anyway, my sample code does that but I still have no plans to use it. I like the simple check for basic internet connectivity better.

Thanks.


Guys, you are overthinking and overcomplicating this pool/port detection.

Isn't the simplest solution to ps/grep/awk miner process and extract the  pool_address/port from the actual command that miner is running? Don't all miners use pool_addr/port as an argument?

I'm sorry I can't pitch in with an actual code and I am just throwing ideas here... I've been extremely busy and don't have spare time to write/test any code now. Many thanks to all members that are thinkering/coding to make nvOC even better than it is!

@Leenoox, that's my thinking too. As long as we grep for "SCREEN" and "miner", pool and port will be there, but as @Stubo stated that way needs a little more elaboration because no all miners behave the same in connectivity terms.
papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 12:50:56 PM
 #5652



I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

Thanks a lot mate,
I think your approach is much better than stubo which is based on guessing which one is the server

I am thinking that the first IP/port is for the miner's DEV share and I am certain that the second is our connection to the mining pool (us-east.equihash-hub.miningpoolhub.com) since the destination port (20570) matches what I have configured in 1bash. So, assuming all of this is correct, we can then just use the same check to make sure that we can connect to both pools:

But both needs a stable mining process to be running, and when pool has problem we dont have it
So I cant understand when we have all the details in 1bash why we dont strip it from there with some simple commands.

You see any problems in my approach here :

Code:
# Begin papampi Mod

source /home/m1/1bash

CURRENT_COIN=$(head -n 200 /home/m1/1bash | grep COIN= | sed 's/COIN=//' | sed 's/\"//' | sed 's/\"//')
#echo "$CURRENT_COIN"

CURRENT_COIN_POOL=$(echo {$CURRENT_COIN}_POOL |sed 's/{//' | sed 's/}//' )
#echo $CURRENT_COIN_POOL

POOL_SERVER=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
#echo "$POOL_SERVER"

CURRENT_COIN_PORT=$(echo {$CURRENT_COIN}_PORT | sed 's/{//' | sed 's/}//')
#echo "$CURRENT_COIN_PORT"

if [[ $POOL_SERVER == *stratum* ]]
then
    #echo "stratum"
    PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | cut -d':' -f1 )
    #echo "Server: $PING_SERVER"
    PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | grep -Eo '[0-9]+$' )
    #echo "Port: $PING_PORT"    

if nc -vzw2 $PING_SERVER $PING_PORT;
    then
        # echo "Strartum Server, INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Stratum Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
elif [[ $CURRENT_COIN == *DUAL*  || $CURRENT_COIN == *ZPOOL_SKUNK* || $CURRENT_COIN == *SALFTER*  ]]
then
    #echo "Dual mining, check google"
    if nc -vzw2 google.com 443
    then
        # echo "Dual mining, google is up"
        #echo "            INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        #echo "Dual mining, google is down"
        echo "WARNING:  $(date) - Cant reach google" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
else
      PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
      #echo "Server: $PING_SERVER"
      PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_PORT | grep -o '".*"' | sed 's/"//' |sed 's/"//')
      #echo "Port: $PING_PORT"
      if nc -vzw1 $PING_SERVER $PING_PORT
    then
        #echo "Not a stratum server,INTERNET_IS_GO=1" | tee -a ${LOG_FILE}
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
fi


       # End papampi Mod

IMO best way to test pool connectivity is having pool and port in vars from 1bash or whatever (as you pointed out).
I did not know those already exist.

Your idea looks good to me, guess just need a exhaustive testing.  

I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

kk003
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 16, 2017, 12:56:11 PM
 #5653


Mmmm, I see, thx for testing the code. I only use claymore and ewbf, never found so many open connection from the miner.
I think @Papampi's idea and yours are both great.

About my code and your output I've notice that only 2 ips (guess must be pool's ips) are public and all others are private.
In case of need should be easy to find the local network range and remove ip+port for those ones and keep only the public ips+ports.
That way it does not matter how many ips has the pool, it would be possible to ping all of them.
Anyway, just thinking aloud. All approaches look good to me, 

Yes. I did that intentionally to prove the point that once you open the can of worms that is testing for pool connectivity, a lot of scenarios come up that makes the problem a lot more difficult than one would think at first. In that example, as I say, I am using not only the ZM miner to mine for ZEC but also cpuminer to mine for XMR. Most people don't realize that DSTM's ZM miner uses 2 connections: 1) for his connection to the pool he uses to mine for his dev share 2) the connection to whatever pool you are mining.  (Side Note: As of the 0.5.4* version, BOTH connections had to work or the miner would not mine. Those that use that miner are all too familiar with that because the pool he uses (flypool in EU) was down for a few hours last week and his miner stopped working. Needless to say, this caused quite an uproar with his users (see https://bitcointalk.org/index.php?topic=2021765.1060) and he took a savage beating.)

*Fortunately, DSTM has just released version 0.5.5 that supposedly will not block if his dev pool connection is unavailable.

Thx for sharing :-).
Talking about "can of worms", that's why we test code  Grin
kk003
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 16, 2017, 01:02:40 PM
 #5654



I don't use (and never did) wdog at all but I think is a must for everyone using it to make sure that the gpu % util is ok.
That's the point to watch that the pool is up and running.
I've elaborated this other example of how to get the data to make that check. I think is quite "universal" and should work with any miner, so if some of you want to test it that would be good info for developers.

Code:
#! /bin/bash

# Find out miner's name
P_NAME=$(ps aux | grep -v grep| grep SCREEN | grep miner | sed 's/ /\n/g' | grep /home/m1 | rev | cut -d"/" -f1 | rev)
# Find out miner's process number (PID)
P_NUMBER=$(pgrep $P_NAME)
# Find out pool ip and port
IP_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f1)
PORT_POOL=$(sudo lsof -e /run/user/1000/gvfs -Pan -p "$P_NUMBER" -i | grep "$P_NAME" | sed 's/->/ /' | rev | cut -d" " -f2 | rev | cut -d":" -f2)

echo "Miner's name : " $P_NAME
echo "Miner PID    : " $P_NUMBER
echo "Pool's IP    : " $IP_POOL
echo "pool's port  : " $PORT_POOL

Hope that Stubo's idea and this one help devs to consolidate wdog.

Thanks a lot mate,
I think your approach is much better than stubo which is based on guessing which one is the server

I am thinking that the first IP/port is for the miner's DEV share and I am certain that the second is our connection to the mining pool (us-east.equihash-hub.miningpoolhub.com) since the destination port (20570) matches what I have configured in 1bash. So, assuming all of this is correct, we can then just use the same check to make sure that we can connect to both pools:

But both needs a stable mining process to be running, and when pool has problem we dont have it
So I cant understand when we have all the details in 1bash why we dont strip it from there with some simple commands.

You see any problems in my approach here :

Code:
# Begin papampi Mod

source /home/m1/1bash

CURRENT_COIN=$(head -n 200 /home/m1/1bash | grep COIN= | sed 's/COIN=//' | sed 's/\"//' | sed 's/\"//')
#echo "$CURRENT_COIN"

CURRENT_COIN_POOL=$(echo {$CURRENT_COIN}_POOL |sed 's/{//' | sed 's/}//' )
#echo $CURRENT_COIN_POOL

POOL_SERVER=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
#echo "$POOL_SERVER"

CURRENT_COIN_PORT=$(echo {$CURRENT_COIN}_PORT | sed 's/{//' | sed 's/}//')
#echo "$CURRENT_COIN_PORT"

if [[ $POOL_SERVER == *stratum* ]]
then
    #echo "stratum"
    PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | cut -d':' -f1 )
    #echo "Server: $PING_SERVER"
    PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | grep -Eo '[0-9]+$' )
    #echo "Port: $PING_PORT"    

if nc -vzw2 $PING_SERVER $PING_PORT;
    then
        # echo "Strartum Server, INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Stratum Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
elif [[ $CURRENT_COIN == *DUAL*  || $CURRENT_COIN == *ZPOOL_SKUNK* || $CURRENT_COIN == *SALFTER*  ]]
then
    #echo "Dual mining, check google"
    if nc -vzw2 google.com 443
    then
        # echo "Dual mining, google is up"
        #echo "            INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        #echo "Dual mining, google is down"
        echo "WARNING:  $(date) - Cant reach google" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
else
      PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
      #echo "Server: $PING_SERVER"
      PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_PORT | grep -o '".*"' | sed 's/"//' |sed 's/"//')
      #echo "Port: $PING_PORT"
      if nc -vzw1 $PING_SERVER $PING_PORT
    then
        #echo "Not a stratum server,INTERNET_IS_GO=1" | tee -a ${LOG_FILE}
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
fi


       # End papampi Mod

IMO best way to test pool connectivity is having pool and port in vars from 1bash or whatever (as you pointed out).
I did not know those already exist.

Your idea looks good to me, guess just need a exhaustive testing.  

I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

@Papampi, I think the 3 ways are ok as long as code prevents the pitfalls that come along with it.
They are not mutually exclusive, as I said all look good to me as long as well tested.
Moordact
Newbie
*
Offline Offline

Activity: 53
Merit: 0


View Profile
November 16, 2017, 01:23:43 PM
 #5655

I updated 3/5 rigs from 1.3 -> 1.4

The new rigs I seem to get lower sol's when I monitor the miner it has an avg 85watt and 370 sol.

However my powerlimit is set at 105 watt and it should have 100-105watt and 440 sol.

Anybody else experiencing the issues?

This is on all 1.4 systems.

Anybody?
papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 01:26:43 PM
 #5656



Thanks a lot mate,
I think your approach is much better than stubo which is based on guessing which one is the server

I am thinking that the first IP/port is for the miner's DEV share and I am certain that the second is our connection to the mining pool (us-east.equihash-hub.miningpoolhub.com) since the destination port (20570) matches what I have configured in 1bash. So, assuming all of this is correct, we can then just use the same check to make sure that we can connect to both pools:

But both needs a stable mining process to be running, and when pool has problem we dont have it
So I cant understand when we have all the details in 1bash why we dont strip it from there with some simple commands.

You see any problems in my approach here :

Code:
# Begin papampi Mod

source /home/m1/1bash

CURRENT_COIN=$(head -n 200 /home/m1/1bash | grep COIN= | sed 's/COIN=//' | sed 's/\"//' | sed 's/\"//')
#echo "$CURRENT_COIN"

CURRENT_COIN_POOL=$(echo {$CURRENT_COIN}_POOL |sed 's/{//' | sed 's/}//' )
#echo $CURRENT_COIN_POOL

POOL_SERVER=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
#echo "$POOL_SERVER"

CURRENT_COIN_PORT=$(echo {$CURRENT_COIN}_PORT | sed 's/{//' | sed 's/}//')
#echo "$CURRENT_COIN_PORT"

if [[ $POOL_SERVER == *stratum* ]]
then
    #echo "stratum"
    PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | cut -d':' -f1 )
    #echo "Server: $PING_SERVER"
    PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//' | sed 's/stratum+tcp\?:\/\///' | grep -Eo '[0-9]+$' )
    #echo "Port: $PING_PORT"    

if nc -vzw2 $PING_SERVER $PING_PORT;
    then
        # echo "Strartum Server, INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Stratum Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
elif [[ $CURRENT_COIN == *DUAL*  || $CURRENT_COIN == *ZPOOL_SKUNK* || $CURRENT_COIN == *SALFTER*  ]]
then
    #echo "Dual mining, check google"
    if nc -vzw2 google.com 443
    then
        # echo "Dual mining, google is up"
        #echo "            INTERNET_IS_GO=1"
        INTERNET_IS_GO=1
    else
        #echo "Dual mining, google is down"
        echo "WARNING:  $(date) - Cant reach google" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
    
else
      PING_SERVER=$( cat /home/m1/1bash | grep $CURRENT_COIN_POOL | grep -o '".*"' | sed 's/"//'| sed 's/"//')
      #echo "Server: $PING_SERVER"
      PING_PORT=$(cat /home/m1/1bash | grep $CURRENT_COIN_PORT | grep -o '".*"' | sed 's/"//' |sed 's/"//')
      #echo "Port: $PING_PORT"
      if nc -vzw1 $PING_SERVER $PING_PORT
    then
        #echo "Not a stratum server,INTERNET_IS_GO=1" | tee -a ${LOG_FILE}
        INTERNET_IS_GO=1
    else
        echo "WARNING:  $(date) - Mining Pool Server is DOWN" | tee -a ${LOG_FILE} ${ALERT_LOG_FILE}
        INTERNET_IS_GO=0
    fi
fi


       # End papampi Mod

IMO best way to test pool connectivity is having pool and port in vars from 1bash or whatever (as you pointed out).
I did not know those already exist.

Your idea looks good to me, guess just need a exhaustive testing.  

I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

@Papampi, I think the 3 ways are ok as long as code prevents the pitfalls that come along with it.
They are not mutually exclusive, as I said all look good to me as long as well tested.

Tottaly agree that it needs testing
I tested with over 20 coins and that was where I found that zpool_skunk has different naming in 1bash and can not get its pool and server with same approach so for now put it in the google ping part

I will do more testing for sure and expect you experts do the same as well,
will try to get dual mining pools from 1bash and fix them as well.

papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 01:27:35 PM
 #5657

I updated 3/5 rigs from 1.3 -> 1.4

The new rigs I seem to get lower sol's when I monitor the miner it has an avg 85watt and 370 sol.

However my powerlimit is set at 105 watt and it should have 100-105watt and 440 sol.

Anybody else experiencing the issues?

This is on all 1.4 systems.

Anybody?

I Do not have lower hash rate since I get to 1.4

Stubo
Member
**
Offline Offline

Activity: 220
Merit: 13


View Profile
November 16, 2017, 01:42:04 PM
 #5658


I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

Exactly. We want it to be simple which is why I originally and still stand by the simple check for internet connectivity only in the watchdog script. I have already demonstrated with ZM that looking at 1bash is not sufficient in that it doesn't account for the hidden connection to the pool for the DEV fee. I also presented a potential solution for how to overcome this but I think we all agree that it is too complex for nvOC. So, we are back to where we started.

Thanks.
leenoox
Full Member
***
Offline Offline

Activity: 200
Merit: 101



View Profile
November 16, 2017, 01:59:32 PM
 #5659


I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

Exactly. We want it to be simple which is why I originally and still stand by the simple check for internet connectivity only in the watchdog script. I have already demonstrated with ZM that looking at 1bash is not sufficient in that it doesn't account for the hidden connection to the pool for the DEV fee. I also presented a potential solution for how to overcome this but I think we all agree that it is too complex for nvOC. So, we are back to where we started.

Thanks.

Why do we even need to check the second connection as long as our main connection to the pool is working? Even if the miner is mining dev fee on another pool the utilization will be up and watchdog will not restart the miner

papampi
Full Member
***
Offline Offline

Activity: 378
Merit: 105


Linux FOREVER! Resistance is futile!!!


View Profile
November 16, 2017, 02:03:25 PM
 #5660


I'm with you,
Dont see why going through all the problem to get them from else where when all available in 1bash

When pool is down there is no connectivity to get pool and port from and there may be no miner up to get them from running miner as well

When we can get them with some simple cat | grep | sed ... why go through all the complexity?
Isnt our goal is to make nvoc as simple as possible?

Dont understand

Exactly. We want it to be simple which is why I originally and still stand by the simple check for internet connectivity only in the watchdog script. I have already demonstrated with ZM that looking at 1bash is not sufficient in that it doesn't account for the hidden connection to the pool for the DEV fee. I also presented a potential solution for how to overcome this but I think we all agree that it is too complex for nvOC. So, we are back to where we started.

Thanks.

Why do we even need to check the second connection as long as our main connection to the pool is working? Even if the miner is mining dev fee on another pool the utilization will be up and watchdog will not restart the miner

Thats the same case with dual mining claymore and I'm writing its code to grab the pool/port from 1bash for dual as well

Pages: « 1 ... 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 [283] 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 ... 415 »
  Print  
 
Jump to:  

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