Changeset 35 for trunk/cluster_status.php
- Timestamp:
- Apr 8, 2018, 4:41:57 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cluster_status.php
r32 r35 22 22 } 23 23 24 exit(); 24 //exit(); 25 exit(0); 25 26 26 27 // Get the cluster status … … 115 116 //echo " $cluster $queued, $status, $running\n"; 116 117 117 $gfac_link = mysql_connect( $dbhost, $guser, $gpasswd ); 118 $result = mysql_select_db( $gDB, $gfac_link ); 119 120 if ( ! $result ) 118 $gfac_link = mysqli_connect( $dbhost, $guser, $gpasswd, $gDB ); 119 120 if ( ! $gfac_link ) 121 121 { 122 122 write_log( "$self: Could not connect to DB $gDB" ); … … 126 126 127 127 $query = "SELECT * FROM cluster_status WHERE cluster='$cluster'"; 128 $result = mysql _query( $query, $gfac_link);128 $result = mysqli_query( $gfac_link, $query ); 129 129 130 130 if ( ! $result ) 131 131 { 132 write_log( "$self: Query failed $query - " . mysql _error( $gfac_link ) );133 echo "$self: Query failed $query - " . mysql _error( $gfac_link ) . "\n";132 write_log( "$self: Query failed $query - " . mysqli_error( $gfac_link ) ); 133 echo "$self: Query failed $query - " . mysqli_error( $gfac_link ) . "\n"; 134 134 exit(); 135 135 } 136 136 137 $rows = mysql _num_rows( $result );137 $rows = mysqli_num_rows( $result ); 138 138 139 139 if ( $rows == 0 ) // INSERT … … 154 154 } 155 155 156 $result = mysql _query( $query, $gfac_link);156 $result = mysqli_query( $gfac_link, $query ); 157 157 158 158 if ( ! $result ) 159 159 { 160 write_log( "$self: Query failed $query - " . mysql _error( $gfac_link ) );161 echo "$self: Query failed $query - " . mysql _error( $gfac_link ) . "\n";160 write_log( "$self: Query failed $query - " . mysqli_error( $gfac_link ) ); 161 echo "$self: Query failed $query - " . mysqli_error( $gfac_link ) . "\n"; 162 162 } 163 163 } … … 182 182 else 183 183 { 184 $clusters = array( "alamo", "lonestar5", "stampede", "comet", 185 "stampede2-b", "jetstream", "jureca", "jacinto-b" ); 184 // $clusters = array( "alamo", "lonestar5", "comet", 185 // "stampede2", "jetstream", "jureca", "jacinto" ); 186 $clusters = array( "alamo", "lonestar5", "comet", 187 "stampede2", "jetstream" ); 186 188 } 187 189 … … 238 240 break; 239 241 } 240 case 'stampede ':241 { 242 $host = "us3@stampede .tacc.utexas.edu";243 $qstat = `ssh $host '/usr/local/bin/showq 2> &1|grep "Total Jobs"'`;242 case 'stampede2': 243 { 244 $host = "us3@stampede2.tacc.utexas.edu"; 245 $qstat = `ssh $host '/usr/local/bin/showq 2>/dev/null|grep "Total Jobs"'`; 244 246 $sparts = preg_split( '/\s+/', $qstat ); 245 247 $tot = $sparts[ 2 ]; … … 251 253 break; 252 254 } 253 case 'stampede2':254 {255 $host = "us3@stampede2.tacc.utexas.edu";256 $qstat = `ssh $host '/usr/local/bin/showq 2>&1|grep "Total Jobs"'`;257 $sparts = preg_split( '/\s+/', $qstat );258 $tot = $sparts[ 2 ];259 $run = $sparts[ 5 ];260 $que = $sparts[ 8 ];261 $sta = "up";262 if ( $tot == '' || $tot == '0' )263 $sta = "down";264 break;265 }266 255 case 'lonestar5': 267 256 { 268 257 $host = "us3@ls5.tacc.utexas.edu"; 269 $qstat = `ssh $host '/usr/local/bin/showq 2> &1|grep "Total Jobs"'`;258 $qstat = `ssh $host '/usr/local/bin/showq 2>/dev/null|grep "Total Jobs"'`; 270 259 $sparts = preg_split( '/\s+/', $qstat ); 271 260 $tot = $sparts[ 2 ]; … … 280 269 { 281 270 $run = $sparts[ 5 ]; 282 //$que = $sparts[ 8 ];283 $que = $sparts[ 11 ];271 $que = $sparts[ 8 ]; 272 // $que = $sparts[ 11 ]; 284 273 } 285 274 break; … … 288 277 { 289 278 $host = "us3@comet.sdsc.edu"; 290 $qstat = `ssh $host '/usr/bin/sinfo -s -p compute -o "%a %F" |tail -1'`; 291 $sparts = preg_split( '/\s+/', $qstat ); 292 $sta = $sparts[ 0 ]; 293 $knts = $sparts[ 1 ]; 294 $sparts = preg_split( '/\//', $knts ); 295 $run = $sparts[ 0 ]; 296 $que = $sparts[ 1 ]; 297 if ( $sta == "" ) 298 $sta = "down"; 299 break; 300 } 301 case 'gordon': 302 { 303 $host = "us3@gordon.sdsc.edu"; 304 $qstat = `ssh $host '/opt/torque/bin/qstat -B 2>&1|tail -1'`; 305 $sparts = preg_split( '/\s+/', $qstat ); 306 $que = $sparts[ 3 ]; 307 $run = $sparts[ 4 ]; 308 $sta = $sparts[ 10 ]; 309 if ( $sta == "Active" ) 310 $sta = "up"; 279 //$qstat = `ssh $host '/usr/bin/sinfo -s -p compute -o "%a %F" |tail -1'`; 280 $qstat = `ssh $host '/home/us3/scripts/cstat 2>&1'`; 281 $sparts = preg_split( '/\s+/', $qstat ); 282 $tot = $sparts[ 1 ]; 283 $run = '0'; 284 $que = '0'; 285 $sta = "up"; 286 if ( $tot == '' || $tot == '0' ) 287 { 288 $sta = "down"; 289 } 311 290 else 312 $sta = "down"; 291 { 292 $run = $sparts[ 3 ]; 293 $que = $sparts[ 5 ]; 294 } 313 295 break; 314 296 }
Note:
See TracChangeset
for help on using the changeset viewer.