Code Duplication    Length = 31-32 lines in 3 locations

src/ConnectionsPlugin.php 1 location

@@ 14-45 (lines=32) @@
11
12
namespace OSInet\Beanstalkd\Munin;
13
14
class ConnectionsPlugin extends BasePlugin
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

src/JobsRatePlugin.php 1 location

@@ 14-44 (lines=31) @@
11
12
namespace OSInet\Beanstalkd\Munin;
13
14
class JobsRatePlugin extends BasePlugin
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function config()
20
    {
21
        $ret = <<<'EOT'
22
graph_title Job Rate
23
graph_vlabel Jobs per ${graph_period}
24
graph_category Beanstalk
25
graph_args --lower-limit 0
26
graph_scale no
27
queue_jobs.label Jobs
28
queue_jobs.type DERIVE
29
queue_jobs.min 0
30
EOT;
31
32
        return $ret;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function data()
39
    {
40
        $stats = $this->server->stats();
41
        $ret = sprintf("queue_jobs.value %d\n", $stats['total-jobs']);
42
        return $ret;
43
    }
44
}
45

src/TimeoutsPlugin.php 1 location

@@ 14-45 (lines=32) @@
11
12
namespace OSInet\Beanstalkd\Munin;
13
14
class TimeoutsPlugin extends BasePlugin
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function config()
20
    {
21
        $ret = <<<'EOT'
22
graph_title Job Timeouts
23
graph_vlabel Timeouts per ${graph_period}
24
graph_category Beanstalk
25
graph_args --lower-limit 0
26
graph_scale no
27
timeouts.label Timeouts
28
timeouts.type DERIVE
29
timeouts.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("timeouts.value %d\n", $stats['job-timeouts']);
43
        return $ret;
44
    }
45
}
46