ConnectionsPlugin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A data() 0 4 1
A config() 0 3 1
1
<?php
2
3
/**
4
 * @file
5
 * Munin plugin for Beanstalkd connections monitoring
6
 *
7
 * @author: Frédéric G. MARAND <[email protected]>
8
 * @copyright (c) 2014-2020 Ouest Systèmes Informatiques (OSInet)
9
 * @license Apache License 2.0 or later
10
 */
11
12
declare(strict_types=1);
13
14
namespace OSInet\Beanstalkd\Munin;
15
16
class ConnectionsPlugin extends BasePlugin
17
{
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function config(): string
23
    {
24
        return <<<CONFIG
25
graph_title Open connections
26
graph_vlabel Connections
27
graph_category Beanstalk
28
graph_args --lower-limit 0
29
graph_scale no
30
connections.label Connections
31
connections.type GAUGE
32
connections.min 0
33
34
CONFIG;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function data(): string
41
    {
42
        $stats = $this->server->stats();
43
        return sprintf("connections.value %d\n", $stats['current-connections']);
44
    }
45
}
46