[532] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * |
---|
| 4 | * This file is part of Jobmonarch |
---|
| 5 | * |
---|
| 6 | * Copyright (C) 2006 Ramon Bastiaans |
---|
| 7 | * |
---|
| 8 | * Jobmonarch is free software; you can redistribute it and/or modify |
---|
| 9 | * it under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | * (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * Jobmonarch is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | * |
---|
| 22 | * SVN $Id: image.php 329 2007-04-22 13:36:26Z bastiaans $ |
---|
| 23 | */ |
---|
| 24 | |
---|
[651] | 25 | //ini_set("memory_limit","1G"); |
---|
| 26 | //set_time_limit(0); |
---|
[555] | 27 | |
---|
[532] | 28 | include_once "./libtoga.php"; |
---|
| 29 | |
---|
[582] | 30 | if ( !empty( $_GET ) ) |
---|
| 31 | { |
---|
[532] | 32 | extract( $_GET ); |
---|
| 33 | } |
---|
| 34 | |
---|
[648] | 35 | $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); |
---|
| 36 | $view = $httpvars->getHttpVar( "view" ); |
---|
| 37 | $host = $httpvars->getHttpVar( "host" ); |
---|
| 38 | $query = $httpvars->getHttpVar( "query" ); |
---|
| 39 | $clustername = $httpvars->getClusterName(); |
---|
[532] | 40 | |
---|
[648] | 41 | global $mySession, $myData, $myXML; |
---|
[532] | 42 | |
---|
[648] | 43 | //printf( "c %s\n", $clustername ); |
---|
[532] | 44 | |
---|
[648] | 45 | $mySession = new SessionHandler( $clustername ); |
---|
| 46 | $mySession->checkSession(); |
---|
[532] | 47 | |
---|
[651] | 48 | $session = $mySession->getSession(); |
---|
[648] | 49 | $myXML = $session['data']; |
---|
[646] | 50 | |
---|
[648] | 51 | $myData = new DataGatherer( $clustername ); |
---|
| 52 | $myData->parseXML( $myXML ); |
---|
[646] | 53 | |
---|
[648] | 54 | $mySession->updatePollInterval( $myData->getPollInterval() ); |
---|
| 55 | $mySession->endSession(); |
---|
[646] | 56 | |
---|
[648] | 57 | //printf( "%s\n", strlen( $myXML ) ); |
---|
[646] | 58 | |
---|
[582] | 59 | if( isset($jid) && ($jid!='')) $filter['jid']=$jid; |
---|
| 60 | if( isset($state) && ($state!='')) $filter['state']=$state; |
---|
| 61 | if( isset($owner) && ($owner!='')) $filter['owner']=$owner; |
---|
| 62 | if( isset($queue) && ($queue!='')) $filter['queue']=$queue; |
---|
| 63 | if( isset($host) && ($host!='')) $filter['host']=$host; |
---|
| 64 | if( isset($query) && ($query!='')) $filter['query']=$query; |
---|
[532] | 65 | |
---|
[646] | 66 | function drawHostImage() |
---|
| 67 | { |
---|
[648] | 68 | global $clustername, $hostname, $myData; |
---|
[532] | 69 | |
---|
[648] | 70 | if( $myData->isJobmonRunning() ) |
---|
[582] | 71 | { |
---|
[648] | 72 | $ic = new HostImage( $myData, $clustername, $hostname ); |
---|
[582] | 73 | } |
---|
[532] | 74 | else |
---|
[582] | 75 | { |
---|
[532] | 76 | $ic = new EmptyImage(); |
---|
[582] | 77 | } |
---|
[532] | 78 | |
---|
| 79 | $ic->draw(); |
---|
| 80 | } |
---|
| 81 | |
---|
[646] | 82 | function drawSmallClusterImage() |
---|
| 83 | { |
---|
[648] | 84 | global $clustername, $myData, $myXML; |
---|
[532] | 85 | |
---|
[648] | 86 | //printf( "%s\n", strlen( $myXML ) ); |
---|
| 87 | |
---|
| 88 | if( $myData->isJobmonRunning() ) |
---|
[582] | 89 | { |
---|
[648] | 90 | //$ic = new ClusterImage( $myXML, $clustername ); |
---|
| 91 | $ic = new ClusterImage( $myData, $clustername ); |
---|
[532] | 92 | $ic->setSmall(); |
---|
[648] | 93 | //printf( "is running\n" ); |
---|
[582] | 94 | } |
---|
| 95 | else |
---|
| 96 | { |
---|
[532] | 97 | $ic = new EmptyImage(); |
---|
[648] | 98 | //printf( "not running\n" ); |
---|
[532] | 99 | } |
---|
| 100 | |
---|
| 101 | $ic->draw(); |
---|
| 102 | } |
---|
| 103 | |
---|
[646] | 104 | function drawBigClusterImage() |
---|
| 105 | { |
---|
[648] | 106 | global $filter, $clustername, $myXML, $myData; |
---|
[532] | 107 | |
---|
[648] | 108 | //$ic = new ClusterImage( $myXML, $clustername ); |
---|
| 109 | $ic = new ClusterImage( $myData, $clustername ); |
---|
[532] | 110 | $ic->setBig(); |
---|
| 111 | |
---|
[582] | 112 | if( isset( $filter ) ) |
---|
| 113 | { |
---|
| 114 | foreach( $filter as $filtername=>$filtervalue ) |
---|
| 115 | { |
---|
| 116 | $ic->setFilter( $filtername, $filtervalue ); |
---|
[532] | 117 | } |
---|
| 118 | } |
---|
| 119 | $ic->draw(); |
---|
| 120 | } |
---|
| 121 | |
---|
[646] | 122 | switch( $view ) |
---|
| 123 | { |
---|
[532] | 124 | case "small-clusterimage": |
---|
| 125 | |
---|
| 126 | drawSmallClusterImage(); |
---|
| 127 | |
---|
| 128 | break; |
---|
| 129 | |
---|
| 130 | case "big-clusterimage": |
---|
| 131 | |
---|
| 132 | drawBigClusterImage(); |
---|
| 133 | |
---|
| 134 | break; |
---|
| 135 | |
---|
| 136 | case "hostimage": |
---|
| 137 | |
---|
| 138 | drawHostImage(); |
---|
| 139 | |
---|
| 140 | break; |
---|
| 141 | |
---|
| 142 | default: |
---|
| 143 | |
---|
| 144 | break; |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | ?> |
---|