Completed
Push — master ( 9dca89...cdca22 )
by Frédéric G.
01:10
created

ConnectionsPlugin::data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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-2018 Ouest Systèmes Informatiques (OSInet)
9
 * @license Apache License 2.0 or later
10
 */
11
12
namespace OSInet\Beanstalkd\Munin;
13
14 View Code Duplication
class ConnectionsPlugin extends BasePlugin
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function config()
20
    {
21
        $ret = <<<EOT
22
graph_title Open connections
23
graph_vlabel Connections
24
graph_category Beanstalk
25
graph_args --lower-limit 0
26
graph_scale no
27
connections.label Connections
28
connections.type GAUGE
29
connections.min 0
30
31
EOT;
32
33
        return $ret;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function data()
40
    {
41
        $stats = $this->server->stats();
42
        $ret = sprintf("connections.value %d\n", $stats['current-connections']);
43
        return $ret;
44
    }
45
}
46