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 | |
---|
25 | //ini_set("memory_limit","1G"); |
---|
26 | //set_time_limit(0); |
---|
27 | |
---|
28 | include_once "./libtoga.php"; |
---|
29 | |
---|
30 | if ( !empty( $_GET ) ) |
---|
31 | { |
---|
32 | extract( $_GET ); |
---|
33 | } |
---|
34 | |
---|
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(); |
---|
40 | |
---|
41 | global $mySession, $myData, $myXML; |
---|
42 | |
---|
43 | //printf( "c %s\n", $clustername ); |
---|
44 | |
---|
45 | $mySession = new SessionHandler( $clustername ); |
---|
46 | $mySession->checkSession(); |
---|
47 | |
---|
48 | $session = $mySession->getSession(); |
---|
49 | $myXML = $session['data']; |
---|
50 | |
---|
51 | $myData = new DataGatherer( $clustername ); |
---|
52 | $myData->parseXML( $myXML ); |
---|
53 | |
---|
54 | $mySession->updatePollInterval( $myData->getPollInterval() ); |
---|
55 | $mySession->endSession(); |
---|
56 | |
---|
57 | //printf( "%s\n", strlen( $myXML ) ); |
---|
58 | |
---|
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; |
---|
65 | |
---|
66 | function drawHostImage() |
---|
67 | { |
---|
68 | global $clustername, $hostname, $myData; |
---|
69 | |
---|
70 | if( $myData->isJobmonRunning() ) |
---|
71 | { |
---|
72 | $ic = new HostImage( $myData, $clustername, $hostname ); |
---|
73 | } |
---|
74 | else |
---|
75 | { |
---|
76 | $ic = new EmptyImage(); |
---|
77 | } |
---|
78 | |
---|
79 | $ic->draw(); |
---|
80 | } |
---|
81 | |
---|
82 | function drawSmallClusterImage() |
---|
83 | { |
---|
84 | global $clustername, $myData, $myXML; |
---|
85 | |
---|
86 | //printf( "%s\n", strlen( $myXML ) ); |
---|
87 | |
---|
88 | if( $myData->isJobmonRunning() ) |
---|
89 | { |
---|
90 | //$ic = new ClusterImage( $myXML, $clustername ); |
---|
91 | $ic = new ClusterImage( $myData, $clustername ); |
---|
92 | $ic->setSmall(); |
---|
93 | //printf( "is running\n" ); |
---|
94 | } |
---|
95 | else |
---|
96 | { |
---|
97 | $ic = new EmptyImage(); |
---|
98 | //printf( "not running\n" ); |
---|
99 | } |
---|
100 | |
---|
101 | $ic->draw(); |
---|
102 | } |
---|
103 | |
---|
104 | function drawBigClusterImage() |
---|
105 | { |
---|
106 | global $filter, $clustername, $myXML, $myData; |
---|
107 | |
---|
108 | //$ic = new ClusterImage( $myXML, $clustername ); |
---|
109 | $ic = new ClusterImage( $myData, $clustername ); |
---|
110 | $ic->setBig(); |
---|
111 | |
---|
112 | if( isset( $filter ) ) |
---|
113 | { |
---|
114 | foreach( $filter as $filtername=>$filtervalue ) |
---|
115 | { |
---|
116 | $ic->setFilter( $filtername, $filtervalue ); |
---|
117 | } |
---|
118 | } |
---|
119 | $ic->draw(); |
---|
120 | } |
---|
121 | |
---|
122 | switch( $view ) |
---|
123 | { |
---|
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 | ?> |
---|