Outils pour utilisateurs

Outils du site


report:zabbix:developerguide

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
report:zabbix:developerguide [2026/02/04 18:39] – [Defining indicators] adminreport:zabbix:developerguide [2026/04/23 10:29] (Version actuelle) florence
Ligne 1: Ligne 1:
-<html><!-- nomoodle --></html>{{ :blocks:logo-apl.png? nolink |}}<html><!-- /nomoodle --></html>+ 
 +<html><!-- nomoodle --></html>{{:report:logo-apl-transparent.png?400|}}<html><!-- /nomoodle --></html>
  
  
Ligne 43: Ligne 44:
  
    function xmldb_<plugin_frankenname>_after_install() {    function xmldb_<plugin_frankenname>_after_install() {
 +   
        [...]        [...]
 +   
        // Register zabbix indicators if installed.        // Register zabbix indicators if installed.
        // Note will only work with report_zabbix "pro" version.        // Note will only work with report_zabbix "pro" version.
Ligne 84: Ligne 85:
        
    class daily_<indicatorset>_indicators extends zabbix_indicator {    class daily_<indicatorset>_indicators extends zabbix_indicator {
-      [...]+       [...]
    }    }
  
Ligne 98: Ligne 99:
    * ''<indicatorset>_indicators'' for full range values.    * ''<indicatorset>_indicators'' for full range values.
    * ''<range>_<indicatorqet>_indicators'' for values collected on a <range> limited scope (f.e. daily, scannning data on 24 hours in the past).    * ''<range>_<indicatorqet>_indicators'' for values collected on a <range> limited scope (f.e. daily, scannning data on 24 hours in the past).
 +
 +===Describing submodes===
  
 Now describe your submodes as a static constant: Now describe your submodes as a static constant:
Ligne 105: Ligne 108:
 Each submode is a single measurement and a single value sent to Zabbix. Each submode is a single measurement and a single value sent to Zabbix.
  
-----+===Constructor=== 
 + 
 +The constructor only defines the Zabbix value namespace that will be prepended to all submodes. Zabbix model will use the FQDN of the indicator values for defining items. 
 + 
 +    public function __construct() { 
 +        parent::__construct(); 
 +        $this->key = 'moodle.<indicatorset>'; 
 +    } 
 + 
 +===Acquiring measures=== 
 + 
 +Here is the most important part of the implementation. For each submode listed in the ''submodes'' static attribute, You will provide an acquisition handler that must get a single value. 
 + 
 +    /** 
 +     * the function that contains the logic to acquire the indicator instant value. 
 +     * @param string $submode to target an aquisition to an explicit submode, elsewhere  
 +     */ 
 +    public function acquire_submode($submode) { 
 +        global $DB; 
 +    
 +        if(!isset($this->value)) { 
 +            $this->value = new Stdclass; 
 +        } 
 +    
 +        if (is_null($submode)) { 
 +            $submode = $this->submode; 
 +        } 
 +    
 +        switch ($submode) { 
 +    
 +            case 'submode1':
 +    
 +                $submodevalue = [...]; // Whatever gets a single value in Moodle. 
 +    
 +                $this->value->$submode = $submodevalue; 
 +                break; 
 +            } 
 +    
 +            default: { 
 +                if ($CFG->debug == DEBUG_DEVELOPER) { 
 +                    throw new coding_exception("Indicator has a submode that is not handled in acquire_submode()."); 
 +                } 
 +            } 
 +        } 
 + 
 +Once each submode case is written, that's all done ! 
 + 
 <html><!-- nomoodle --></html> <html><!-- nomoodle --></html>
 +----
  
 [[:report:zabbix|Back to Zabbix Report index]] - [[:plugins|Back to plugin index]] - [[:start|Back to catalog]] [[:report:zabbix|Back to Zabbix Report index]] - [[:plugins|Back to plugin index]] - [[:start|Back to catalog]]
  
 <html><!-- /nomoodle --></html> <html><!-- /nomoodle --></html>
report/zabbix/developerguide.1770230341.txt.gz · Dernière modification : de admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki