Commit e0cff876 authored by marix's avatar marix
Browse files

Adjusted repository structure to new naming of QCO/RTCO


git-svn-id: https://marix.org/repos/stuff/trunk/uni/qco@83 d1b3f9c7-8810-0410-acd1-cd427091ae90
parents
Matthias Bach <marix (at) marix (dot) org>
Just copy the www-directory into your Webserver.
Configuration can be done via the file "configs/baseconfig.php". Please note that that file will also be written to by the application and changes that have not been loaded into the application will be lost when doing changes via the ui. If you change the baseconfig file and the application has already been used you will have to reload the configuration via the configuration page.
The default configuration file is given for ganglia. If you use lemon either copy the file baseconfig_lemon.php over the baseconfig.php file or change the $BASECONFIG_FILE in inc/config.php.
The following files/directories must be writeable by the webserver:
configs - for configuration via ui. If configuration ui is disable this directory can be read-only.
templates_c - for compiled Smarty templates
graphs - for storage of generated plots
If you want to use the lemon_mrs plugin you should add FmonMRs_php to the automatically loaded modules in php.ini. Usually this means adding /usr/lib/FmonMRs_php.so to extension in php.ini. The plugin can work without it, but then it has to use deprecated php functionality that can degrade performance.
If your gnuplot does not reside in the path or has a non standard executable name you will have to adjust the variable $GNUPLOT in inc/config.php.
If you plot a lot of data you might also want to adjust your shared memory size. To do this adjust $SHARED_MEM_SIZE in inc/config.php. The default setting allows to plot more than 6 metrics for 200 nodes, therefore for small installation you could even reduce this size. If the application runs out of shared memory you will be given instructions on what memory size is needed. Keep in mind to drop the old data storage via the configuration-page when doing changes to the shared memory configuration.
The lisence is still to be decided. Hack it however you want, but give credit and feedback.
This is QCO, the Quick Cluster Overview tool.
The main purpose of this tool is to enable you to get a quick overview over the clusters performance while being easy on resources. Therefore this is a lightweight script with a limited (but adjustable) refresh rate that can be run inside your php-enabled webserver.
For installation instructions on the web UI please read the INSTALL file.
For documentation on internal interfaces, datastructures etc. please view the doc-directory. The source itself has been markuped in a PhpDocumentor-like style so that it is theoretically possible to get an overview of the code using PhpDocumentor.
The testing-directory contains some commandline tools for fooling with the shared memory, test plugin interfaces and run dry-runs as well as a ganglia server emulator. These can be run from the testing directory. If you want to use the same shared memory segment as the application in the webserver you should adjust the chdir()s (which are always in one of the first lines) of the scripts to point to your qco-installation that's used by the webserver.
Data plugins have to check data age and not add outdated data.
Configuration.
LOG
javascript for embedding
sanity checks in setConfig
+---------------------------------------------------------------------------------+
| APACHE THREAD (standalone, ganlia, lemon ui) |
+---------------------------------------------------------------------------------+
:config ^ | DATA
v | DATA v
+------------------------------------------------------+ +-----------------------+
| DATA HANDLING LAYER | | Template Engine (own, |
+------------------------------------------------------+ | ganglia, lemon) |
| ^ ^ | config +-----------------------+
| config |cluster-data | | cluster-data ^
v | v v |
+-------------------+ +-------------+ +----------------+ | Templates
| Cluster Interface | | Shared data | | plot plugin | | (Images)
+-------------------+ | interface | +----------------+ |
| | +-------------+ | images |
+---------+ +-------+ | v |
| Ganglia | | Lemon | +---------+ +-----------------------------------------+
+---------+ +-------+ | SysVShm | | file system |
+---------+ +-----------------------------------------+
The data handling layer is basically responsible for the following:
- Ensure current data is in shared data interface
- If necessary update shared data from cluster interface
- Check configuration to feed plot plugin with correct data
and have it plot the desired graphs
- return configuration + cluster data to main application for later display
The apache thread could be either of the following:
- default standalone view
- modified ganglia or lemon ui
- ajax-handling php script (either default or other uis)
- configuration view (DATA only has to include config but but might be written back)
Here only the SysV-SharedMemory interface is shown as shared data inteface. It would
as well be possible to use some kind of SQL, Distributed Cache or Filesystem based
interface.
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>A PHP Interface to GNUPlot</TITLE>
<META NAME="Author" CONTENT="lvxing">
<META NAME="Keywords" CONTENT="lvxing liu yi computer science">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<Table width=80% height=200 border=0 cellspacing=0 align=center>
<tr>
<td><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'PHP_GnuPlot.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">GNUPlot</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">draw2DLine</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PGData</span><span style="color: #007700">(</span><span style="color: #DD0000">'test&nbsp;Data'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">4</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">)&nbsp;);<br /><br /></span><span style="color: #0000BB">demoSampleFile</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTitle</span><span style="color: #007700">(</span><span style="color: #DD0000">"2D&nbsp;Test"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PGData</span><span style="color: #007700">::</span><span style="color: #0000BB">createFromFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'plot1.txt'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'data&nbsp;set&nbsp;II'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">plotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'lines'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'1:($2)'&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set2DLabel</span><span style="color: #007700">(</span><span style="color: #DD0000">"2D&nbsp;Label"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">plotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'linespoints'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'($1/20):($2*2)'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$data2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">changeLegend</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'replot&nbsp;II'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">plotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'boxes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'($1/20):($2)'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//$p-&gt;set("autoscale");<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRange</span><span style="color: #007700">(</span><span style="color: #DD0000">'y'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">0.6</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.6&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">export</span><span style="color: #007700">(</span><span style="color: #DD0000">'test2D.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br /><br /><br />function&nbsp;</span><span style="color: #0000BB">demoSampleFile</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'plot1.txt'</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #DD0000">"10&nbsp;&nbsp;&nbsp;&nbsp;0.093589504197705<br />20&nbsp;&nbsp;&nbsp;&nbsp;0.18763678062534<br />30&nbsp;&nbsp;&nbsp;&nbsp;0.28007895516094<br />40&nbsp;&nbsp;&nbsp;&nbsp;0.3772850801436<br />50&nbsp;&nbsp;&nbsp;&nbsp;0.45641177158072<br />60&nbsp;&nbsp;&nbsp;&nbsp;0.5483119759646<br />70&nbsp;&nbsp;&nbsp;&nbsp;0.64713177119153<br />80&nbsp;&nbsp;&nbsp;&nbsp;0.73679384002403<br />90&nbsp;&nbsp;&nbsp;&nbsp;0.82093219662338<br />100&nbsp;&nbsp;&nbsp;&nbsp;0.89928340743387<br />110&nbsp;&nbsp;&nbsp;&nbsp;0.9330042604089<br />120&nbsp;&nbsp;&nbsp;&nbsp;0.91835632225303<br />130&nbsp;&nbsp;&nbsp;&nbsp;0.77081887392486<br />140&nbsp;&nbsp;&nbsp;&nbsp;0.56138136507401<br />150&nbsp;&nbsp;&nbsp;&nbsp;0.35419806755938<br />160&nbsp;&nbsp;&nbsp;&nbsp;0.19338611559021<br />170&nbsp;&nbsp;&nbsp;&nbsp;0.097598541367033<br />180&nbsp;&nbsp;&nbsp;&nbsp;0.048300839801159<br />"</span><span style="color: #007700">);<br />}<br /></span>
</span>
</code></td></tr></table>
<br><br>
</BODY>
</HTML>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>A PHP Interface to GNUPlot</TITLE>
<META NAME="Author" CONTENT="lvxing">
<META NAME="Keywords" CONTENT="lvxing liu yi computer science">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<Table width=80% height=200 border=0 cellspacing=0 align=center>
<tr>
<td><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'PHP_GnuPlot.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">GNUPlot</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">draw3DLine</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PGData</span><span style="color: #007700">(</span><span style="color: #DD0000">'test&nbsp;Data'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">4</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">)&nbsp;);<br /></span><span style="color: #0000BB">$data</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addDataEntry</span><span style="color: #007700">(&nbsp;array(</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">)&nbsp;);<br /><br /></span><span style="color: #0000BB">demoSampleFile</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTitle</span><span style="color: #007700">(</span><span style="color: #DD0000">"3D&nbsp;Test"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$data2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">PGData</span><span style="color: #007700">::</span><span style="color: #0000BB">createFromFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'plot1.txt'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'data&nbsp;set&nbsp;II'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set3DLabel</span><span style="color: #007700">(</span><span style="color: #DD0000">"3D&nbsp;Label"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">splotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'lines'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'1:2:3'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">splotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'linespoints'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'($1/20):($2*2):3'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$data2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">changeLegend</span><span style="color: #007700">(&nbsp;</span><span style="color: #DD0000">'replot&nbsp;II'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">splotData</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">$data2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'points'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'($1/20):($2):3'&nbsp;</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//$p-&gt;set("autoscale");<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRange</span><span style="color: #007700">(</span><span style="color: #DD0000">'y'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(&nbsp;</span><span style="color: #0000BB">0.8</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.8&nbsp;</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">export</span><span style="color: #007700">(</span><span style="color: #DD0000">'test3D.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br /><br /><br />function&nbsp;</span><span style="color: #0000BB">demoSampleFile</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'plot1.txt'</span><span style="color: #007700">,&nbsp;<br /></span><span style="color: #DD0000">"10&nbsp;&nbsp;&nbsp;&nbsp;0.093589504197705&nbsp;1<br />20&nbsp;&nbsp;&nbsp;&nbsp;0.18763678062534&nbsp;1<br />30&nbsp;&nbsp;&nbsp;&nbsp;0.28007895516094&nbsp;1<br />40&nbsp;&nbsp;&nbsp;&nbsp;0.3772850801436&nbsp;&nbsp;1<br />50&nbsp;&nbsp;&nbsp;&nbsp;0.45641177158072&nbsp;1<br />60&nbsp;&nbsp;&nbsp;&nbsp;0.5483119759646&nbsp;1<br />70&nbsp;&nbsp;&nbsp;&nbsp;0.64713177119153&nbsp;1<br />80&nbsp;&nbsp;&nbsp;&nbsp;0.73679384002403&nbsp;1<br />90&nbsp;&nbsp;&nbsp;&nbsp;0.82093219662338&nbsp;1<br />100&nbsp;&nbsp;&nbsp;&nbsp;0.89928340743387&nbsp;1<br />110&nbsp;&nbsp;&nbsp;&nbsp;0.9330042604089&nbsp;1<br />120&nbsp;&nbsp;&nbsp;&nbsp;0.91835632225303&nbsp;1<br />130&nbsp;&nbsp;&nbsp;&nbsp;0.77081887392486&nbsp;1<br />140&nbsp;&nbsp;&nbsp;&nbsp;0.56138136507401&nbsp;1<br />150&nbsp;&nbsp;&nbsp;&nbsp;0.35419806755938&nbsp;1<br />160&nbsp;&nbsp;&nbsp;&nbsp;0.19338611559021&nbsp;1<br />170&nbsp;&nbsp;&nbsp;&nbsp;0.097598541367033&nbsp;1<br />180&nbsp;&nbsp;&nbsp;&nbsp;0.048300839801159&nbsp;1<br />"</span><span style="color: #007700">);<br />}<br /></span>
</span>
</code></td></tr></table>
<br><br>
</BODY>
</HTML>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>A PHP Interface to GNUPlot</TITLE>
<META NAME="Author" CONTENT="lvxing">
<META NAME="Keywords" CONTENT="lvxing liu yi computer science">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<Table width=80% height=200 border=0 cellspacing=0 align=center>
<tr>
<td><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'PHP_GnuPlot.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">GNUPlot</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">'contour'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTitle</span><span style="color: #007700">(</span><span style="color: #DD0000">"default&nbsp;contours"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exe</span><span style="color: #007700">(</span><span style="color: #DD0000">"splot&nbsp;x*y\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(</span><span style="color: #0000BB">0.6</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.6</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">export</span><span style="color: #007700">(</span><span style="color: #DD0000">'testCall.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$p</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br /></span>
</span>
</code></td></tr></table>
<br><br>
</BODY>
</HTML>
\ No newline at end of file
Measurements on
Intel PIII 800 MHz, 512 MB RAM
SuSE Linux 9.2, PHP 4.3.8
------------------------------
Original Versoin:
Two Small Datasets
Pure Plotting : 0.3 s.
Plotting and filling : 0.31 s.
One large Dataset
Pure Plotting : 0.39 s.
Plotting and filling : 0.44 s.
Script execution : 25.4 s.
--
Two Small Datasets
Pure Plotting : 0.3 s.
Plotting and filling : 0.31 s.
One large Dataset
Pure Plotting : 0.39 s.
Plotting and filling : 0.44 s.
Script execution : 25.62 s.
-------------------------------
Direct plot to file:
Two Small Datasets
Pure Plotting : 0.09 s.
Plotting and filling : 0.09 s.
One large Dataset
Pure Plotting : 0.19 s.
Plotting and filling : 0.21 s.
Script execution : 9.87 s.
--
Two Small Datasets
Pure Plotting : 0.09 s.
Plotting and filling : 0.09 s.
One large Dataset
Pure Plotting : 0.19 s.
Plotting and filling : 0.21 s.
Script execution : 9.85 s.
--
Two Small Datasets
Pure Plotting : 0.09 s.
Plotting and filling : 0.1 s.
One large Dataset
Pure Plotting : 0.19 s.
Plotting and filling : 0.21 s.
Script execution : 10.14 s.
-------------------------------
No temp-files:
Two Small Datasets
Pure Plotting : 0.09 s.
Plotting and filling : 0.09 s.
One large Dataset
Pure Plotting : 0.19 s.
Plotting and filling : 0.21 s.
Script execution : 9.79 s.
--
Pure Plotting : 0.09 s.
Plotting and filling : 0.09 s.
One large Dataset
Pure Plotting : 0.19 s.
Plotting and filling : 0.21 s.
Script execution : 9.97 s.
------------------------------
------------------------------
------------------------------
Measurements on
Intel Pentium M 1400 MHz, 768 MB RAM
SuSE Linux 10.1, PHP 5.0
------------------------------
Original Version:
Two Small Datasets
Pure Plotting : 0.18 s.
Plotting and filling : 0.18 s.
One large Dataset
Pure Plotting : 0.2 s.
Plotting and filling : 0.21 s.
Script execution : 12.92 s.
--
Two Small Datasets
Pure Plotting : 0.18 s.
Plotting and filling : 0.18 s.
One large Dataset
Pure Plotting : 0.22 s.
Plotting and filling : 0.22 s.
Script execution : 13.34 s.
------------------------------
Only plot to file:
Pure Plotting : 0.05 s.
Plotting and filling : 0.05 s.
One large Dataset
Pure Plotting : 0.07 s.
Plotting and filling : 0.07 s.
Script execution : 4.09 s.
--
Pure Plotting : 0.03 s.
Plotting and filling : 0.03 s.
One large Dataset
Pure Plotting : 0.06 s.
Plotting and filling : 0.06 s.
Script execution : 3.14 s.
-------------------------------
No writing of files:
Two Small Datasets
Pure Plotting : 0.03 s.
Plotting and filling : 0.03 s.
One large Dataset
Pure Plotting : 0.05 s.
Plotting and filling : 0.06 s.
Script execution : 2.95 s.
--
Two Small Datasets
Pure Plotting : 0.03 s.
Plotting and filling : 0.03 s.
One large Dataset
Pure Plotting : 0.05 s.
Plotting and filling : 0.06 s.
Script execution : 3 s.
This is version 0.2 the data model definition for the Quick Cluster Overview.
In this document elements written in ALL CAPS are assoziative arrays and elements written in mixed caps are normal elements. In associative implmenetations the names of the array entries must be the same as in this document, while in an non-associative implementation the order of the elements should be the same as in this document. If an array only has one member called N then it is a usual array having a number of N (where N might vary depending on e.g. configuration) entries.
DATA All data that will be shared between threads/processes
|
+--CONFIG Configuration data
| |
| +--intervall The intervall after which data may be pulled from the cluster in seconds
| |
| +--maxHistory The maximum number of datasets to hold for historical plotting.
| |
| +--showNodeList Whether to show the list of nodes on the frontpage. Possible values are show, optional and none. If not set it defaults to optional.
| |
| +--stylesheet The stylesheet to use. If omitted hardcoded default will be used.
| |
| +--disableConfigUI If set to any value other than false, an emtpy string or zero (or not at all) it will not be possible to edit the configuration via the ui. All configuration changes will have to be made via the baseconfig file and loaded into the application using the cmdcli in the testing directory.
| |
| +--plotPlugin The name of the plotPlugin (e.g. gnuplot)
| |
| +--graphBasePath Path to the directory the graphs will be shown in
| |
| +--ALLGRAPHS Definition of default values for all graphs
| | |
| | +-- YRANGE
| | | |
| | | +-- min The minimum value of the yrange. Can be auto for autoscaling. If empty or not set default is used.
| | | |
| | | +-- max The maximum value of the yrange. Can be auto for autoscaling. If empty or not set default is used.
| | |
| | +-- SIZE
| | |
| | +-- x The graph size in x direction. If empty or not set default is used.
| | |
| | +-- y The graph size in x direction. If empty or not set default is used.
| |
| +--GRAPHS Definition of each graph that will be drawn
| | |
| | +--N A graph definition
| | |
| | +-- title Title of this graph
| | |
| | +-- metric The id of the metric to be drawn in this graph. From version .2 on this can be multiple metrics seperated by |.
| | |
| | +-- file The name of the file to store the graph in
| | |
| | +-- YRANGE
| | | |
| | | +-- min The minimum value of the yrange. Can be auto for autoscaling. If empty or not set default is used.
| | | |
| | | +-- max The maximum value of the yrange. Can be auto for autoscaling. If empty or not set default is used.
| | |
| | +-- SIZE
| | |
| | +-- x The graph size in x direction. If empty or not set default is used.
| | |
| | +-- y The graph size in x direction. If empty or not set default is used.
| |
| +--DATASOURCE The datasources from which to pull data
| |
| +-- name The name of the datasource plugin
| |
| +-- PROVIDER An array of name[:port] to specify from where the plugin shall pull it's data
| | |
| | +--name
| | |
| | +--port
| |
| +-- CLIENTS For plugins that require a list of clients the ids of the clients to retrieve data from
|
+--CLUSTER_DATA
|
+--lastUpdate Timestamp of the last update of the cluster-data and images (unix timestamp, seconds)
|
+--currentSet The dataset containing the latest data (this allows for an easy round robbing)
|
+--DATA_SETS A "database"
|
+--N One set of metrics
|
+--timestamp When this data was collected (unix/seconds)
|
+--METRIC The data a certain metric where METRIC is the metrics name
|
+-- name
|
+-- id
|
+-- The datatype of this metric
|
+-- NODES The list of all nodes providing this metric
|
+-- N The data of one node
|
+-- id Nodes id
|
+-- name Nodes name (if provided)
|
+-- value Nodes values for this metric
\ No newline at end of file
In the current version data sharing will be done via System-V Shared Memory. Other ways of data sharing are possible and therefore the different ways of data sharing will quickly be discussed here.
SQL-Server: Well scaling, but requires a lot of resources and add aditional parsing overhead
SQLite: Fast, embedded easy to use. Sadly not included in PHP4, but available via PEAR. However file-based and parsing might add aditional overhead.
Filebased: Doesn't require anything, however some kind of serialization will have to be done and performance is unknown.
Shared-Mem: Easy to use, non-persistent. Only serialization has to be done, which is handled by the interfaces. The SysV-Interface is only available in Unix, but that's a minor problem. No disk-access, not additional application.
Pipes: Require extra process. Would allow for data-layer to be written in c++, but data-exchange would have to deal with serialization of objects in different programming languages and extra process would always run.
PHP-Cache(lite): Easy to use cache, however doesn't use Shared-Memory but Filesystem. Can also cache images with automatic timeout.
Memcached: The all in one solution. Would cluster, interfaced c++ and PHP, but would be an extra application to run on the server with unknown overhead.
\ No newline at end of file
This is version 0.1 of the datasource plugin interface.
A datasource is defined by putting a file <datasource>.php in the datasources folder, where <datasource> is the name of the datasource. E.g. the datasource plugin for ganglia is called ganglia.php. This file will have to implement the functions defined below where the <datasource> part of the function name is the name of the datasource. E.g. the getName function of ganglia would be called ganglia_getName().
If a plugin needs to define global variables inside those should also be prefixed with <datasource>_ to avoid nameclashes between the plugin and other parts of the application. The error variable of ganglia would therefore e.g. be called $ganglia_error. Also keep in mind that the plugin might be included from within a function. Therefore variable that's not explicitly declared global might not be.
The interfaceTest.php in the testing directory can be used to check whether a plugin is defined correctly.
To be actually used a datasource will also have to be enabled in the configuration.
-- Method definition --
<datasource>_getName(): Retrieves a human readable name of the datasource.
<datasource>_getDescription(): Retrieves a little longer description of the datasource which can be shown in the configuration ui.
<datasource>_getVersion: Returns the version string of the datasource implementation.
<datasource>_getAuthor: Should return the name of the author/maintainer of this plugin.
<datasource>_getInterfaceVersion: Shall return the version of the interface this plugin implements. Should be 0.1 for this version.
<datasource>_getData( &$metrics, $config ): This method shall fill all the metrics given in the metrics array with data for every node in the cluster. Some datasources, e.g. ganglia, will always have to fetch all metrics, but as other sources, e.g. lemon, can specify which metrics to fetch, as not parsin and storing unneeded metrics saves memory and execution time these sources shall just skipped unneeded metrics. This method shall return TRUE (boolean) if successfull and FALSE (boolean) otherwise. For defintion of the format of the $metrics and the $config arrays the the data-model documentation version 0.1.
<datasource>_getError(): Shall return an error string if <datasource>_getData() returned FALSE. Otherwise the return value is up to the implementation.
<datasource>_requiresClientList(): Shall return TRUE (boolean) if the plugin needs a list of clients to survey to function properly, FALSE (boolean) otherwise.
Old simplified API will be replaced in September 2006.
You can use Metric names for queries as it can be seen from types_util.c:(62-68).
FmonMRs_php.so (usually in /usr/lib) has to be loaded (via php.ini or dl) in order to use simplified api from php.
Server has to be specified via environment variable MR_SERVER_URL for remote or MR_SPOOLDIR for lokal flat-file server. MR_SERVER_URL is a standard url like http://my_server:12409 and MR_SPOOLDIR is a directory like /var/edg/spool.
An alternative is utilising the MR-Interfaces from the LRF. Those can be retrieved from lrf/mr_load.php. In addition in that case configuration can be read from lrf/config.php. However that usage probably requires some working directory hacks (to ensure proper loading of includes without sourcecode-patching).
TODO check for in/output-structures of lrf/mr*.php-Methods.
\ No newline at end of file
File added
This is version 0.1 of the plot provider plugin interface.
A plot provider is defined by putting a file <plotter>.php in the plotter folder, where <plotter> is the name of the plot provider. E.g. the plugin plotting using gnuplot will be called gnuplot.php. This file will have to implement the functions defined below where the <plotter> part of the function name is the name of the plot plugin. E.g. the getName function of gnuplot would be called gnuplot_getName().
If a plugin needs to define global variables inside those should also be prefixed with <datasource>_ to avoid nameclashes between the plugin and other parts of the application. The error variable of gnuplot would therefore e.g. be called $gnuplot_error. Also keep in mind that the plugin might be included from within a function. Therefore variable that's not explicitly declared global might not be.
The interfaceTest.php in the testing directory can be used to check whether a plugin is defined correctly.
To be actually used a plot plugin will have to be choosen in the configuration.
-- Method definition --
<plotter>_getName(): Retrieves a human readable name of the plugin.
<plotter>_getDescription(): Retrieves a little longer description of the plugin which can be shown in the configuration ui.
<plotter>_getVersion: Returns the version string of the plugin implementation.
<plotter>_getAuthor: Should return the name of the author/maintainer of this plugin.
<plotter>_getInterfaceVersion: Shall return the version of the interface this plugin implements. Should be 0.1 for this version.
<plotter>_plot( $cluster_data, $config ): Shall plot data for the metrics according to the definition. Shall return TRUE (boolean) on success and FALSE (boolean) on failure. For defintion of the format of the $cluster_data and the $config arrays the the data-model documentation version 0.1.
<plotter>_getError(): Shall return an error string if <plotter>_getData() returned FALSE. Otherwise the return value is up to the implementation.
#!/usr/bin/php
<?php
/**
* RTCO command line client
*
* A commandline client that allows accessing the engine the
* same way the web ui would.
*/
// go to document root to avoid strang behaviour due to wrong path
chdir('../www');
require_once('./contrib/timer.php');
$scriptTimer = new Timer();
// parse commandline
$argc = $_SERVER['argc'];
$argv = $_SERVER['argv'];
if( $argc < 2 ) {
$action = 'get';
} else {
$action = $argv[1];
}
switch( $action ) {
case 'get':
$engineTimer = new Timer();
// load engine
require_once('./inc/engine.php');
// and get data
$data = getData();
$engineTimer->stop();
// print the data for aestetic pleasure
if( $data === NULL ) {
echo getError() . "\n";
} else {
//print_r( $data );
}
break;
case 'drop':
$engineTimer = new Timer();
// load engine
require_once('./inc/engine.php');
// and drop data
if( ! dropData() )
echo getError() . "\n";
$engineTimer->stop();
break;
case 'showConfig':
$engineTimer = new Timer();
// load engine
require_once('./inc/engine.php');
// and drop data
$data = getConfig();
$engineTimer->stop();
// print the data for aestetic pleasure
if( $data === NULL ) {
echo getError() . "\n";
} else {
print_r( $data );
}