Changeset 6 for trunk/cluster_status.php
- Timestamp:
- Apr 22, 2015, 10:27:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cluster_status.php
r1 r6 1 1 <?php 2 2 3 include "/home/us3/bin/listen-config.php"; 3 $us3bin = exec( "ls -d ~us3/bin" ); 4 include "$us3bin/listen-config.php"; 4 5 5 6 $xml = get_data(); 6 7 7 if ( $xml == "" ) exit(); // No status available 8 if ( $xml != "" ) 9 parse( $xml ); 8 10 9 11 $data = array(); 10 parse( $xml ); 12 13 local_status(); 11 14 12 15 foreach ( $data as $item ) … … 32 35 catch ( HttpException $e ) 33 36 { 34 write_log( "$self: Cluster Status not available" );37 // write_log( "$self: Cluster Status not available" ); 35 38 return ""; 36 39 } … … 152 155 write_log( "$self: Query failed $query - " . mysql_error( $gfac_link ) ); 153 156 echo "$self: Query failed $query - " . mysql_error( $gfac_link ) . "\n"; 157 } 158 } 159 160 // Get local cluster status 161 162 function local_status() 163 { 164 global $self; 165 global $data; 166 167 // $clusters = array( "alamo", "jacinto", "bcf" ); 168 $clusters = array( "alamo", "jacinto" ); 169 // $clusters = array( "alamo" ); 170 foreach ( $clusters as $clname ) 171 { 172 $a = Array(); 173 if ( $clname == "alamo" ) 174 { 175 $qstat = `ssh $clname '/usr/bin/qstat -B 2>&1|tail -1'`; 176 177 $sparts = preg_split( '/\s+/', $qstat ); 178 $que = $sparts[ 3 ]; 179 $run = $sparts[ 4 ]; 180 $sta = $sparts[ 10 ]; 181 } 182 else 183 { 184 $qstat = `ssh $clname '/opt/torque/bin/qstat -B 2>&1|tail -1'`; 185 186 $sparts = preg_split( '/\s+/', $qstat ); 187 $que = $sparts[ 3 ]; 188 $run = $sparts[ 4 ]; 189 $sta = $sparts[ 9 ]; 190 } 191 192 //echo "$self: cln que run sta $clname $que $run $sta \n"; 193 194 if ( $sta == "Active" ) 195 { 196 $sta = "up"; 197 } 198 else 199 { 200 $sta = "down"; 201 $que = "0"; 202 $run = "0"; 203 } 204 205 $a[ 'cluster' ] = $clname; 206 $a[ 'queued' ] = $que; 207 $a[ 'running' ] = $run; 208 $a[ 'status' ] = $sta; 209 210 $data[] = $a; 211 $a[ 'cluster' ] = $clname . "-local"; 212 $data[] = $a; 154 213 } 155 214 } … … 191 250 if ( $name == "resourceHealth" ) 192 251 { 193 $name .= $this->_index;252 ## $name .= $this->_index; 194 253 $this->_index++; 195 254 }
Note:
See TracChangeset
for help on using the changeset viewer.