Skip to content
Snippets Groups Projects
Select Git revision
  • 5c37f249097f99914721f79375047e4fe992f8d1
  • master default protected
  • Legacy_Php7
3 results

index.sample.php

Blame
  • index.sample.php 1.71 KiB
    <?php
    /* ______________________________________________________________________
     * 
     * A P P M O N I T O R  ::  CLIENT - CHECK  ::  SAMPLE
     * ______________________________________________________________________
     * 
     * this is a sample file for the appmonitor client
     * copy the sample file to index.php and modify it as needed (see ../readme.md).
     * 
     */
    
    require_once('classes/appmonitor-client.class.php');
    $oMonitor = new appmonitor();
    
    // set a name with application name and environment or hostname
    $oMonitor->setWebsite('[My CMS on host XY]');
    
    // how often the server should ask for updates
    $oMonitor->setTTL(300);
    
    // a general include ... the idea is to a file with the same actions on all
    // installations and hosts that can be deployed by a software delivery service 
    // (Puppet, Ansible, ...)
    @include 'general_include.php';
    
    // add any tag to add it in the filter list in the server web gui
    // $oMonitor->addTag('cms');
    // $oMonitor->addTag('production');
    
    // ----------------------------------------------------------------------
    
    // include default checks for an application
    // @require 'plugins/apps/[name-of-app].php';
    
    // add a few custom checks
    // $oMonitor->addCheck(...)
    $oMonitor->addCheck(
        array(
            "name" => "hello plugin",
            "description" => "Test a plugin ... plugins/checks/hello.php",
            "check" => array(
                "function" => "Hello",
                "params" => array(
                    "message" => "Here I am",
                ),
            ),
        )
    );
    
    // ----------------------------------------------------------------------
    
    $oMonitor->setResult();
    $oMonitor->render();
    
    // ----------------------------------------------------------------------