PHPackages                             yidas/mtr-database - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. yidas/mtr-database

ActiveProject[Logging &amp; Monitoring](/categories/logging)

yidas/mtr-database
==================

MTR Batch processing storing in database with dashboard

1.1.0(2y ago)15504MITPHPPHP &gt;=5.4.0

Since Jun 24Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/yidas/mtr-database-php)[ Packagist](https://packagist.org/packages/yidas/mtr-database)[ Docs](https://github.com/yidas/mtr-database-php)[ RSS](/packages/yidas-mtr-database/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

MTR Database for PHP
====================

[](#mtr-database-for-php)

[MTR (My traceroute)](https://en.wikipedia.org/wiki/MTR_(software)) centralized monitoring dashboard with agent deployment

[![Latest Stable Version](https://camo.githubusercontent.com/5de14b11314a03a9b7937e5946aa891a58f007f118dcd0715907af3cf6cf41c9/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f6d74722d64617461626173652f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/mtr-database)[![License](https://camo.githubusercontent.com/356d606b0e7702b10f073223a877cd534b7c34d8217cab6af26dbf0885499344/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f6d74722d64617461626173652f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/mtr-database)

OUTLINE
-------

[](#outline)

- [Demonstration](#demonstration)
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Installation](#installation)
    - [Download](#download)
- [Setup](#setup)
    - [Database Setup](#database-setup)
    - [Agent Setup &amp; Launch](#agent-setup--launch)
    - [API for collector &amp; agents](#api-for-collector--agents)
    - [Dashboard](#dashboard)
- [Advanced Usage](#advanced-usage)
    - [Agent Configuration](#agent-configuration)
    - [Purge](#purge)
- [References](#references)

---

DEMONSTRATION
-------------

[](#demonstration)

[![](https://raw.githubusercontent.com/yidas/mtr-database-php/main/img/demo-dashboard-overview.png)](https://raw.githubusercontent.com/yidas/mtr-database-php/main/img/demo-dashboard-overview.png)[![](https://raw.githubusercontent.com/yidas/mtr-database-php/main/img/demo-dashboard-table-details.png)](https://raw.githubusercontent.com/yidas/mtr-database-php/main/img/demo-dashboard-table-details.png)

---

INTRODUCTION
------------

[](#introduction)

Easy to deploy agents and collect MTR data into a database for monitoring via a web dashboard with charts.

[![Basic Flow](https://camo.githubusercontent.com/c92f0ef8f344bf3e42f7fc44a3a94a0b8a647ab73ffcd4cb81c748bee97789a2/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f79696461732f6d74722d64617461626173652d7068702f6d61696e2f696d672f6172636869746563747572652d6469616772616d2e706c616e74756d6c3f763d32)](https://camo.githubusercontent.com/c92f0ef8f344bf3e42f7fc44a3a94a0b8a647ab73ffcd4cb81c748bee97789a2/68747470733a2f2f7777772e706c616e74756d6c2e636f6d2f706c616e74756d6c2f70726f78793f7372633d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f79696461732f6d74722d64617461626173652d7068702f6d61696e2f696d672f6172636869746563747572652d6469616772616d2e706c616e74756d6c3f763d32)

---

REQUIREMENTS
------------

[](#requirements)

This library requires the following:

- MTR library (CLI) 0.9+
- PHP 5.4.0+|7.0+

---

INSTALLATION
------------

[](#installation)

### Download

[](#download)

#### Composer Installation

[](#composer-installation)

Using Composer to install is the easiest way with auto-installer:

```
composer create-project --prefer-dist yidas/mtr-database
```

#### Wget Installation

[](#wget-installation)

You could see [Release](https://github.com/yidas/mtr-database-php/releases) for picking up the package with version, for example:

```
$ wget https://github.com/yidas/mtr-database-php/archive/master.tar.gz -O mtr-database-phpi.tar.gz
```

After download, uncompress the package:

```
$ tar -zxvf mtr-database-php.tar.gz
```

SETUP
-----

[](#setup)

### Database Setup

[](#database-setup)

After the download, you could start to set up the `config.inc.php` with your database connection:

```
...
    'database' => [
        'host' => '',
        'driver'    => 'mysql',
        'database'  => 'mtr_database',
        'username'  => '',
        'password'  => '',
        'table' => 'records',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
    ],
...
```

Then run `install.php` which will help you to install the database &amp; table:

```
$ php install.php
Installation completed
```

### Agent Setup &amp; Launch

[](#agent-setup--launch)

The default setting of the agent can be configurated in `config.inc.php`:

```
...
    'general' => [
        'mtrCmd' => 'mtr',
        'timezone' => 'Asia/Taipei',
        'category' => 'agent-01',   // Category mark for distinguishing
    ],
    'mtr' => [
        'host' => 'your.host',
        'period' => 10,     // Minute
        'count' => 60,      // Report-cycles
        'tcp' => false,     // TCP mode
        'port' => 443,      // Port number for TCP mode
    ],
    'api' => [
        'key' => '',            // API key must be the same bewteen agent and collector
        'agent' => [
            'enabled' => false, // To send MTR data to collector via API Agent (deafult is database)
            'reportUrl' => '',  // Collector's API URL
        ],
        'collector' => [
            'enabled' => false, // To receive MTR data from agent via API
        ],
    ],
...
```

After the setting, enjoy to run or set `launch.php` with your prefered arguments in crontab:

```
$php launch.php
Process success
```

Set crontab into `/etc/cron.d/mtr-database`:

```
# Launch and record MTR every 10 miniutes by default ('period' => 10)
*/10 * * * * root php /var/www/html/mtr-database/launch.php >/dev/null 2>&1

# Purge data before 90 days by default (Optional)
00 00 * * * root php /var/www/html/mtr-database/purge.php >/dev/null 2>&1
```

> The default batch period is configured to be 10 minutes, so we can set the batch to be executed every 10 minutes.

### API for collector &amp; agents

[](#api-for-collector--agents)

Regarding the introduction structure diagram, it's better to collect agents' MTR data via API (Default is database).
The endpoint path of collector (`reportUrl`) is `/collect.php`, you could place the project in the web path such as `/var/www/html/mtr-database/index.php`.

Configuration for collector, the database setting is required:

```
    'api' => [
        'key' => 'your-own-api-key',            // API key must be the same bewteen agent and collector
        'agent' => [
            'enabled' => false, // To send MTR data to collector via API Agent (deafult is database)
            'reportUrl' => '',  // Collector's API URL
        ],
        'collector' => [
            'enabled' => true,  // To receive MTR data from agent via API
        ],
    ],
    'database' => [
```

Configuration for agents:

```
    'api' => [
        'key' => 'your-own-api-key',            // API key must be the same bewteen agent and collector
        'agent' => [
            'enabled' => true, // To send MTR data to collector via API Agent (deafult is database)
            'reportUrl' => 'https://your.host/mtr-database/collect.php',  // Collector's API URL
        ],
        'collector' => [
            'enabled' => false, // To receive MTR data from agent via API
        ],
    ],
```

### Dashboard

[](#dashboard)

The endpoint path of MTR Dashboard is `/index.php` and it's disable by default, you could place the project in the web path such as `/var/www/html/mtr-database/index.php`.

Turn the `enabled` on and set the username and password for the authentication in `config.ini.php`, the database setting is required:

```
...
    'dashboard' => [
        'enabled' => true,
        'username' => '',
        'password' => '',
        'categories' => [''],   // Category list for selection
    ],
    'database' => [
...
```

> `categories` will enable you to query specific data by category settings or query all data with default blank values.

---

ADVANCED USAGE
--------------

[](#advanced-usage)

### Agent Configuration

[](#agent-configuration)

The configuration file `config.inc.php` allows you to set the default settings for MTR launching. However, you can also specify parameters immediately in the command to be run.

#### Host

[](#host)

Host parameter allows you to specify the target host to be tracked with `-h --host` parameter:

```
php launch.php --host="yourhost.local"
```

#### Period

[](#period)

Period argument allocate the number of minutes between crontab intervals with `-p --period` parameter:

```
# Launch and record MTR every 5 miniutes
*/5 * * * * root php /var/www/html/mtr-database/launch.php --period=5 >/dev/null 2>&1
```

In addition, Count argument will distribute the sending count between the interval according to the Period setting with `-c --report-cycles` parameter:

```
# Launch and record MTR every 1 miniutes, and each report will send 10 count (send every 6 seconds)
*/1 * * * * root php /var/www/html/mtr-database/launch.php --period=1 --report-cycles=10 >/dev/null 2>&1
```

#### TCP

[](#tcp)

TCP argument allows you to use MTR TCP mode with specified port, `-T --tcp` for enabling TCP mode and `-P --port` for setting port:

```
php launch.php --tcp -port=443
```

#### Category

[](#category)

Category allows to categorize each monitor command and supports filtering from the dashboard, which also can be achieved by using the `--category` parameter:

```
php launch.php --category="Monitor-A1"
```

### Purge

[](#purge)

Running `purge.php` will delete old records older than the given number of days. You can use the `-d --days` parameter to set with (default is 90 days):

```
00 00 * * * root php /var/www/html/mtr-database/purge.php --days=30 >/dev/null 2>&1
```

---

REFERENCES
----------

[](#references)

- [MTR - Github](https://github.com/traviscross/mtr)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1005 days

Total

2

Last Release

783d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b30d2b2c0b53aef65fad4af56cd3c7912d3db2b612890c706fe79448717f6aba?d=identicon)[yidas](/maintainers/yidas)

---

Top Contributors

[![yidas](https://avatars.githubusercontent.com/u/12604195?v=4)](https://github.com/yidas "yidas (7 commits)")

---

Tags

chartdashboardhealth-checkinternet-connectionlatencymonitoringmtrtracepathtraceroutemonitoringspeedlatencyinternet-connectionmtr

### Embed Badge

![Health badge](/badges/yidas-mtr-database/health.svg)

```
[![Health](https://phpackages.com/badges/yidas-mtr-database/health.svg)](https://phpackages.com/packages/yidas-mtr-database)
```

###  Alternatives

[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[liip/monitor-bundle

Liip Monitor Bundle

4728.7M16](/packages/liip-monitor-bundle)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
