PHP code example of memcrab / metrics

1. Go to this page and download the library: Download memcrab/metrics library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

memcrab / metrics example snippets


$influxDBListenerUrl = 'http://127.0.0.1:8186/api/v2/write';
Metric::obj()->init($influxDBListenerUrl, ENVIRONMENT !== 'local');

Metric::obj()->write('cpu_usage', [
        'host' => 'server01'
    ],
    [
        'usage' => 45
    ],
    time()
);