Index: trunk/.htaccess =================================================================== --- trunk/.htaccess (revision trunk,102) +++ trunk/.htaccess (revision trunk,187) @@ -10,2 +10,17 @@ php_value max_execution_time 300 php_value allow_url_fopen "On" + + + AuthType Basic + AuthName "ADEI Authentication" + AuthBasicProvider file + AuthUserFile /var/www/localhost/htdocs/adei/admin/.htpasswd + Require valid-user + + + AuthType Basic + AuthName "ADEI Authentication" + AuthBasicProvider file + AuthUserFile /var/www/localhost/htdocs/adei/admin/.htpasswd +# Require valid-user + Index: trunk/ToDo =================================================================== --- trunk/ToDo (revision trunk,182) +++ trunk/ToDo (revision trunk,187) @@ -13,4 +13,26 @@ - Support for Database names + +KATRIN +====== +- Quite often, on update instead of KATRIN data, the error message "MySQL + server has gone away" is displayed at KATRIN page. + +- Can you please, test if your PHP module is loaded and otherwise skip + loading KATRIN extensions. Basically, if module is not present you should + remove "katrin" from the list of modules in config.php ($MODULES variable) + +- The hangup is happening due invalid axis_id returned by your service. I + made a fix to ADEI, so it will no hang anymore in any case. However, it + is still better to fix. You are returning following properties which are + related to axis: + "axis":["counts\/sec"],"color":["black"],"name":["counts\/sec"] + However, in the "axis" array the axis id's of KNOWN axis should be + returned. Known axis are listed in config.php or can be additionally + added by the READER code, like in IPEReader. And anyway only + alpha-numeric characters are allowed in ids, no "/". + If you want just a default axis you should use '0' as an id. So, in this + case I think you just need to return + "axis":["0"],"color":["black"],"name":["counts\/sec"] Version 0.0.8 (DATA Handling) @@ -102,4 +124,10 @@ distributed uniformely over time. On each position the first item after time is displayed. The time stamp is shown on as well. + +VERSION 0.0.15 (Monitoring) +============== +1. Port conky monitoring system to web and mozilla prism + a) Lua scripts execution from cron + b) Lua + conky to html translation script ---------------------------------------------------------------------------- Index: trunk/setups/katrin/classes/kdbfileidentifier.php =================================================================== --- trunk/setups/katrin/classes/kdbfileidentifier.php (revision trunk,171) +++ trunk/setups/katrin/classes/kdbfileidentifier.php (revision trunk,187) @@ -8,17 +8,29 @@ { public $self = 0; - - function __construct($arg1, $arg2 = null) + + function __construct($arg1 = null, $arg2 = null) { - switch (func_num_args()) { - case 1: - $r = new_KDBFileIdentifier($arg1); - break; - default: - $r = new_KDBFileIdentifier($arg1->GetName() . "/" . $arg2); + if (!extension_loaded("kdbphp")) { + throw new ADEIException("KDBPhp extension is not loaded!"); } + + $r = new_KDBFileIdentifier(); + + if (func_num_args() == 1) { + KDBFileIdentifier_SetFileName($arg1); + } + elseif (func_num_args() == 2) { + KDBFileIdentifier_SetRun($arg1); + KDBFileIdentifier_SetFileName($arg2); + } + $this->self = $r; } - + + function SetRun(KDBRunIdentifier $run) + { + KDBFileIdentifier_SetRun($this->self, $run->self); + } + function GetRun() { @@ -26,10 +38,25 @@ return new KDBRunIdentifier($run); } - + + function SetFileName($filename) + { + KDBFileIdentifier_SetFileName($this->self, $filename); + } + function GetFileName() { return KDBFileIdentifier_GetFileName($this->self); } - + + function SetFileType($type) + { + KDBFileIdentifier_SetFileType($this->self, $type); + } + + function GetFileType() + { + return KDBFileIdentifier_GetFileType($this->self); + } + function AsString() { Index: trunk/setups/katrin/classes/kdbphp.php =================================================================== --- trunk/setups/katrin/classes/kdbphp.php (revision trunk,171) +++ trunk/setups/katrin/classes/kdbphp.php (revision trunk,187) @@ -1,4 +1,4 @@ @@ -29,4 +29,28 @@ } +function vectord_to_array($v) +{ + $a = array(); + + if (is_resource($v)) { + for ($i = 0; $i < vectord_size($v); $i++) { + $a[] = vectord_get($v, $i); + } + } + + return $a; +} + +function vectord_from_array(array $a) +{ + $size = count($a); + $r = new_vectord($size); + for ($i = 0; $i < $size; $i++) { + vectord_set($r, $i, $a[$i]); + } + + return $r; +} + class KDBPhp { @@ -35,4 +59,7 @@ function __construct() { + if (!extension_loaded("kdbphp")) { + throw new ADEIException("KDBPhp extension is not loaded!"); + } try { $this->_cPtr = KDBPhp_Self(); @@ -73,5 +100,5 @@ } - + //function GetFileServer() //{ @@ -90,5 +117,5 @@ if ($file->GetRun()->IsValid()) { $runname = $file->GetRun()->GetName(); - $message = + $message = "File \"$filename\" does not exist for subrun $runname."; } @@ -108,5 +135,5 @@ readfile($path); } - + function GetAbsolutePath(KDBFileIdentifier $file) { @@ -128,4 +155,24 @@ } } + + function HaveRuns($from, $to) + { + try { + return KDBPhp_HaveRuns($this->_cPtr, $from, $to); + } + catch (Exception $e) { + throw new ADEIException($e->getMessage()); + } + } + + function HaveCountrates($from, $to) + { + try { + return KDBPhp_HaveCountrates($this->_cPtr, $from, $to); + } + catch (Exception $e) { + throw new ADEIException($e->getMessage()); + } + } } Index: trunk/setups/katrin/classes/kdbrunidentifier.php =================================================================== --- trunk/setups/katrin/classes/kdbrunidentifier.php (revision trunk,171) +++ trunk/setups/katrin/classes/kdbrunidentifier.php (revision trunk,187) @@ -1,4 +1,4 @@ @@ -6,38 +6,42 @@ { public $self = 0; - + function __construct($text) { + if (!extension_loaded("kdbphp")) { + throw new ADEIException("KDBPhp extension is not loaded!"); + } + if (is_resource($text)) { $this->self = $text; } else { - $this->self = new_KDBRunIdentifier($text); + $this->self = new_RunIdentifier($text); } } - + function GetRun() { - return KDBRunIdentifier_GetRun($this->self); + return RunIdentifier_GetRun($this->self); } - + function GetSubRun() { - return KDBRunIdentifier_GetSubRun($this->self); + return RunIdentifier_GetSubRun($this->self); } - + function GetRunName() { - return KDBRunIdentifier_GetRunName($this->self); + return RunIdentifier_GetRunName($this->self); } - + function GetName() { - return KDBRunIdentifier_GetName($this->self); + return RunIdentifier_GetName($this->self); } - + function IsValid() { - return KDBRunIdentifier_IsValid($this->self); + return RunIdentifier_IsValid($this->self); } } Index: trunk/setups/katrin/classes/readers/katrinreader.php =================================================================== --- trunk/setups/katrin/classes/readers/katrinreader.php (revision trunk,171) +++ trunk/setups/katrin/classes/readers/katrinreader.php (revision trunk,187) @@ -1,7 +1,7 @@ -require_once "../KDBPhp.php"; +ADEI::RequireClass("KDBPhp", true); abstract class KATRINData implements Iterator @@ -9,5 +9,5 @@ public $_cPtr = NULL; private $iterator = NULL; - + abstract protected function create($kdb, $from, $to, $v); @@ -22,5 +22,5 @@ $to = $ivl->GetWindowEnd(); $pixels = $items; - + try { $v = vectori_from_array(array_keys($pixels)); @@ -46,5 +46,5 @@ try { $r = KDBDataIter_Current($this->_cPtr); - $a = vectori_to_array($r); + $a = vectord_to_array($r); return $a; } @@ -73,5 +73,5 @@ } } - + function key() { @@ -123,8 +123,9 @@ $this->items['countrates'][] = array('name' => $name); } - + $this->items['runs'] = array(); $this->items['runs'][] = array('name' => "Run numbers"); - $this->items['runs'][] = array('name' => "Sequence numbers"); + $this->items['runs'][] = array('name' => "Run numbers (no subruns)"); + $this->items['runs'][] = array('name' => "Activity"); $this->groups = array( @@ -211,5 +212,5 @@ $item['uid'] = $items[$i]['uid']; } - + if ($flags & REQUEST::NEED_AXISINFO) { if ($grp->GetGroupID() == "countrates") { @@ -220,5 +221,5 @@ } } - + $res[] = $item; } @@ -226,13 +227,13 @@ return $res; } - + function GetMaskList(LOGGROUP $grp = NULL, $flags = 0) { //print "KATRINReader::GetMaskList"; - + $grp = $this->CheckGroup($grp); $masks = array(); - + if ($grp->GetGroupID() == "runs") { } @@ -245,5 +246,5 @@ } $masks[] = $mask; - + $mask = array(); $mask["id"] = "ipe"; @@ -257,5 +258,5 @@ } $masks[] = $mask; - + $mask = array(); $mask["id"] = "uw"; @@ -268,7 +269,7 @@ $mask["mask"] = implode(",", $items); } - $masks[] = $mask; - } - + $masks[] = $mask; + } + return array_merge(parent::GetMaskList($grp, $flags), $masks); } @@ -277,16 +278,9 @@ DATAFilter $filter = NULL, &$filter_data = NULL) { - print "KATRINReader::GetRawData\n"; - print "$from $to\n"; - - - if ($filter) { - var_dump($filter); - } $grp = $this->CheckGroup($grp); $ivl = $this->CreateInterval($grp); $ivl->Limit($from, $to); - + if ($filter) { $mask = $filter->GetItemMask(); @@ -339,17 +333,12 @@ function HaveData(LOGGROUP $grp = NULL, $from = 0, $to = 0) { - try { - if (is_null($grp) || $grp->GetGroupID() == "runs") { - return KDBPhp_HaveRuns($this->kdb->_cPtr, $from, $to); - } - else if ($grp->GetGroupID() == "countrates") { - return KDBPhp_HaveCountrates($this->kdb->_cPtr, $from, $to); - } - else { - return FALSE; - } - } - catch (Exception $e) { - throw new ADEIException($e->getMessage()); + if (is_null($grp) || $grp->GetGroupID() == "runs") { + return $this->kdb->HaveRuns($from, $to); + } + else if ($grp->GetGroupID() == "countrates") { + return $this->kdb->HaveCountrates($from, $to); + } + else { + return FALSE; } } Index: trunk/setups/katrin/config.php =================================================================== --- trunk/setups/katrin/config.php (revision trunk,171) +++ trunk/setups/katrin/config.php (revision trunk,187) @@ -38,16 +38,13 @@ "database" => array ("katrinpse_archiv"), "multibase" => true, -// "database" => array ("katrinpse_archiv_20080331", "katrinpse_archiv_20071221", "katrinpse_archiv_20070924", "katrinpse_archiv_20070710"), -// "database" => array ("katrinpse_archiv_1", "katrinpse_archiv_2", "katrinpse_archiv_3", "katrinpse_archiv_4", "katrinpse_archiv_5", "katrinpse_archiv_6"), - "disconnected" => false +// "disconnected" => true ), "toskanadb" => array ( - "title" => _("PreSpektrometer Zeus8"), + "title" => _("PreSpektrometer/Zeus8"), "reader" => "ZEUS", "driver" => "odbc", "sqldrv" => "mssql", "subdrv" => "FreeTDS", - //"host" => "192.168.8.6", - "host" => "itpfmdb1.ka.fzk.de", + "host" => "ipepdvmssqldb1.ka.fzk.de", "port" => 1433, "user" => 'souren', @@ -55,6 +52,23 @@ "database" => array ("prespektrometer_rep"), "timeout" => 200000, - "ping" => true - ), + "ping" => true, +// "disconnected" => true + ), + "opcreader" => array( + "title" => _("MainSpektrometer/OPC"), + "reader" => "DBReader", + "driver" => "odbc", + "sqldrv" => "mssql", + "subdrv" => "FreeTDS", + "host" => "ipepdvmssqldb1.ka.fzk.de", + "port" => 1433, + "database" => array ("dbMagnet-archive", "dbMagnet-archive_rep", "KatrinOPCTest"), + "user" => 'souren', + "password" => '$souren$', + "multibase" => false, + "timeout" => 200000, + "ping" => true, +// "disconnected" => true + ), "detector" => array ( "title" => _("KATRIN Detector"), @@ -63,9 +77,5 @@ "sqldrv" => "mssql", "subdrv" => "FreeTDS", -// "host" => "128.95.93.87", -// "database" => array ("katrin"), -// "timeout" => 1500000, // us -// "ping" => true, // host and port should be specified - "host" => "192.168.8.6", + "host" => "ipepdvmssqldb1.ka.fzk.de", "database" => array ("katrin_rep"), "port" => 1433, @@ -77,36 +87,11 @@ // "disconnected" => true ), - "heiko" => array ( - "title" => _("Magnetometer (ZEUS)"), - "reader" => "ZEUS", - "driver" => "odbc", - "sqldrv" => "mssql", - "subdrv" => "FreeTDS", - "host" => "192.168.8.6", - "database" => array ("dbMagnet-archive"), - "port" => 1433, - "user" => 'souren', - "password" => '$souren$', - "multibase" => false, - "timeout" => 200000, - "ping" => true -// "disconnected" => true - ), - "opcreader" => array( - "title" => _("Magnetometer"), - "reader" => "DBReader", - "driver" => "odbc", - "sqldrv" => "mssql", - "subdrv" => "FreeTDS", - "host" => "192.168.8.6", - "port" => 1433, - "database" => array ("dbMagnet-archive"), - "user" => 'souren', - "password" => '$souren$', - "multibase" => false, - "timeout" => 200000, - "ping" => true - ) -); + "kdb" => array( + "title" => _("KATRIN Database"), + "reader" => "KATRINreader", + "database" => array ("kps") + ) +); + if (is_array($READER_DB)) $READER_DB = array_merge($READER_DB_KATRIN, $READER_DB); @@ -143,7 +128,11 @@ "overcome_reader_faults" => true, // Use CACHE if connection to reader is failed "use_cache_timewindow" => true, - "channel_uids" => "/^4\d\d[\-_]/", "timestamp_channels" => true, // Groups is prefixed with two channels with accquisition timestamps (may give a number) - "alarm_severity" => 0 + "alarm_severity" => 0, + "channel_uids" => "/^5\d\d[\-_]/", + "axis" => array( + "/^522-RTP/i" => "temperature", + "/^522-RP[PV]/i" => "vacuum" + ) ); @@ -169,9 +158,9 @@ ), "groups" => array( - "/^(.*)$/" => 'mda.Wt$LiveData\$${1}' + "/^(.*)$/" => 'mda.[Wt$LiveData\$${1}]' ), "columns" => array( "time" => "WsDateTimeTicks", - "data" => "/^Ws_/" + "data" => "/^Ws(Ch)?_/" ), "timezone" => "Europe/Berlin", @@ -187,3 +176,35 @@ ); +$OPTIONS["opcreader__dbMagnet-archive_rep"] = array( + "mask_table" => array( + "table" => 'mda.[Wt$ConfigData$Masks]', + "id" => "WsTID", + "gid" => "WsTable", + "properties" => array( + "name" => "WsName", + "mask" => "WsChannels" + ) + ) +); + +$OPTIONS["opcreader__KatrinOPCTest"] = array( + "tables" => array( + "/^Wv\\\$LiveData\\\$(.*)$/" => array( + 'gid' => '${1}', + 'title' => '${1}' + ) + ), + "groups" => array( + "/^(.*)$/" => '[Wv$LiveData\$${1}]' + ), + "columns" => array( + "time" => "WsDateTimeTicks", + "data" => "/^\d+/" + ) +); + +$OPTIONS["kdb"] = array( + "date_limit" => "2009-11-00 00:00:00" +); + ?> Index: trunk/setups/katrin/services/katrin.php =================================================================== --- trunk/setups/katrin/services/katrin.php (revision trunk,171) +++ trunk/setups/katrin/services/katrin.php (revision trunk,187) @@ -1,4 +1,4 @@ @@ -8,5 +8,5 @@ ADEI::RequireClass("KDBFileIdentifier", true); ADEI::RequireClass("KDBPhp", true); -ADEI::RequireClass("KDBRunIdentifier", "true"); +ADEI::RequireClass("KDBRunIdentifier", true); ADEI::RequireClass("INTERVAL"); @@ -86,25 +86,34 @@ case 'file': - if (!isset($_GET['filename'])) - throw new ADEIException("No filename specified"); - $filename = $_GET['filename']; + $file = new KDBFileIdentifier(); if (isset($_GET['run'])) { $identifier = new KDBRunIdentifier($_GET['run']); - $file = new KDBFileIdentifier($identifier, $filename); - $path = $kdb->GetAbsolutePath($file); - } - else { - $file = new KDBFileIdentifier($filename); - $path = $kdb->GetAbsolutePath($file); + $file->SetRun($identifier); } - if (isset($_GET['download']) && $_GET['download'] == "yes") { - $download = true; - } - else { - $download = false; + if (isset($_GET['filename'])) { + $file->SetFilename($_GET['filename']); } - PrintFile($path, $download); + if (isset($_GET['type'])) { + $type = $_GET['type']; + if ($type == "orca") { + $file->SetFileType(kTypeOrca); + } + if ($type == "orcaroot") { + $file->SetFileType(kTypeOrcaRoot); + } + if ($type == "crun") { + $file->SetFileType(kTypeCrun); + } + if ($type == "header") { + $file->SetFileType(kTypeHeader); + } + if ($type == "plot") { + $file->SetFileType(kTypePlot); + } + } + + PrintFile($kdb->GetAbsolutePath($file), $download); break; Index: trunk/setups/katrin/wiki.xml =================================================================== --- trunk/setups/katrin/wiki.xml (revision trunk,171) +++ trunk/setups/katrin/wiki.xml (revision trunk,187) @@ -782,5 +782,7 @@ ... ... -... +... +... Index: trunk/setups/katrin/xslt/katrin.xsl =================================================================== --- trunk/setups/katrin/xslt/katrin.xsl (revision trunk,171) +++ trunk/setups/katrin/xslt/katrin.xsl (revision trunk,187) @@ -7,28 +7,35 @@ - + services/katrin.php?target=file& + type=plot& run=& filename= - - - - .png - - _blank - - + + + - _pv.png + .png - 0 - - - + _blank + + + + _pv.png + + 0 + + + + - + + + + + @@ -37,12 +44,22 @@ - services/katrin.php?target=file& + services/katrin.php?target=file + &download=yes - run= - & + &run= + - filename= - - &download=yes + + &type= + + + + &filename= + + + + &board= + + @@ -56,4 +73,63 @@ + + + db_server= + + &db_name= + + &db_group= + + + &db_mask= + + + + &window= + + + + + + + + + + + + javascript:adei.config.Load(' + + &module=graph&setup=katrin', true) + + + + services/getimage.php? + + &hide_axes=1&precision=LOW&width= + + &height= + + + + + + + + + + + + + 0 + + + + + + + + + +

:

@@ -61,16 +137,13 @@ - - - + + - - - + +
:
-

@@ -236,9 +309,4 @@ - - - Run number: - - @@ -260,6 +328,4 @@ Z: cm - Crate: -
@@ -273,4 +339,5 @@
+ @@ -279,9 +346,4 @@

Subrun

- Subrun number: - - - - Timestamp: @@ -337,5 +399,5 @@ div.cmt { background-color: rgb(0,0,0); - color:white; + color:white; } div.pics { @@ -356,5 +418,5 @@ - +