2017 © Pedro Peláez
 

library papi

PApi - PHP Api client library for Prometheus

image

cdn77/papi

PApi - PHP Api client library for Prometheus

  • Friday, June 1, 2018
  • by Majkl578
  • Repository
  • 5 Watchers
  • 2 Stars
  • 125 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 45 % Grown

The README.md

PApi - PHP Api client library for Prometheus

Build Status, (*1)

Targets to provide simple means for obtaining data from Prometheus API., (*2)

Stable for Prometheus 1.x and <= v2.2 api spec NOTICE: some endpoints are only available in newer versions of Prometheus. For detailed list see table of available calls below., (*3)

Instalation

Use composer to add PApi as dependency:, (*4)

$ composer install cdn77/papi

Usage

Create a client

<?php
use PApi\Client;

require __DIR__ . '/vendor/autoload.php';

$client = new Client([
    'host' => 'my-prometheus.com',
]);

Available options

Name Default value Description
scheme http Host scheme
host localhost Host address
port 9090 Host port
path /api/v1/ Path to base API endpoint
timeout 30 Timeout for requests
username null HTTP Auth username
password null HTTP Auth password
connectionHeaders [] Connection headers
connectionType CurlConnection::class Class to use for connection. See below

Available connection classes

  • CurlConnection - pure php curl implementation. Used by default.
  • GuzzleConnection - using guzzle 6.3+ library.

Available calls

PApi currently has methods for all available endpoints provided by Prometheus., (*5)

Call Code Prometheus compatibility Official doc
Query $client->getQuery('up', new \DateTimeImmutable('now'); >=1.0 doc
QueryRange $client->getQueryRange('up', new \DateTimeImmutable('today'), new \DateTimeImmutable('now'), '12h'); >=1.0 doc
Series $client->getSeries(['up'], new \DateTimeImmutable('-1 minute'), new \DateTimeImmutable('now'); >=1.0 doc
Label Values $client->getLabelValues('job'); >=1.0 doc
Targets (active only) $client->getTargets(); >=1.0 doc
Alert Managers $client->getAlertManagers(); >=1.0 doc
Create snapshot $client->createSnapshot(); >=2.1 doc
Delete series $client->deleteSeries(['up'], new DateTimeImmutable('today'), new DateTimeImmutable('now'); >=2.1 doc
Clean tombstones $client->cleanTombstones(); >=2.1 doc
Get Config $client->getConfig(); >=2.2 doc
Get Flags $client->getFlags(); >=2.2 doc

The Versions

01/06 2018
01/06 2018

v2.0

2.0.0.0

PApi - PHP Api client library for Prometheus

  Sources   Download

MIT

The Requires

 

The Development Requires

api php client prometheus

31/05 2018

v1.0

1.0.0.0

PApi - PHP Api client library for Prometheus

  Sources   Download

MIT

The Requires

 

The Development Requires

api php client prometheus

05/01 2018

v0.2.0

0.2.0.0

PApi - PHP Api client library for Prometheus

  Sources   Download

MIT

The Requires

 

The Development Requires

api php client prometheus

15/12 2017

v0.1.0

0.1.0.0

PApi - PHP Api client library for Prometheus

  Sources   Download

MIT

The Requires

 

The Development Requires

api php client prometheus