Skip to content

Zabbix Agent implemented in PHP for long living php-servers

Notifications You must be signed in to change notification settings

wizardjedi/php-zabbix-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-zabbix-agent Build badge image codecov Quality Gate Status

Zabbix Agent implemented in PHP for long living php-servers

1. Create composer.json file

{
   "require" : {
        "a1s/php-zabbix-agent" : "dev-master"
   },
   "minimum-stability": "dev",
   "prefer-stable": true,
   "repositories": [
        {
            "url": "https://github.com/wizardjedi/php-zabbix-agent.git",
            "type": "git"
        }
   ]
}

2. Update composer deps

$ composer update

3. Add autoload.php to your app

include("vendor/autoload.php");

4. Simple script

<?php

include("vendor/autoload.php");

$agent = ZabbixAgent::create(10051);

$agent->start();

$agent->setItem("some.key", ZabbixTimeDuration::now());

while (true) {
    echo "Usefull payload\n";

    $agent->tick();

    usleep(500000);
}

5. Main classes

  • ZabbixPrimitiveItem - holds primitive values like int, string, float. Return var_export()'ed string for object or array
  • ZabbixTimeDuration - holds duration from moment in past to current time.
    • Use acceptIfNewer($timeValue) to move moment near in past
  • ZabbixAvgRate - calculats rate of processing
    • Use acquire($count) method to inform item of processed objects count.

6. CI project page

Checkout project build status on: https://travis-ci.org/wizardjedi/php-zabbix-agent

About

Zabbix Agent implemented in PHP for long living php-servers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages