Coder Social home page Coder Social logo

mtr-monitor's Introduction

MTR monitor

Simple MTR runner which stores data to InfluxDB and allows to preview stored data using Grafana dashboards

sample dashboard

Installation

Requrements

  • bash shell
  • python3
  • docker (optional - required for standalone grafana and influxdb)
  • mtr
  • influxdb python package - using the command pip3 install --upgrade influxdb

How to run

  1. Edit mtr-monitor.sh to adjust settings to your own liking
  2. Run sudo make install to install mtr-monitor to /opt/mtr-monitor
  3. Start the systemd service systemctl start mtr-monitor
  4. Open http://127.0.0.1:51111 to access Grafana UI

How to access InfluxDB

./influx-cli.sh will connect to the docker image and open CLI

Notes

The mtr-monitor.sh script when run for the first time downloads grafana and influxdb docker images and creates new containers for them. During consecutive runs it just starts already existing docker containers. The created containers will be always started when the docker service starts. If you want to change parameters of the container, e.g. ports, you need to remove them (e.g. docker container rm mtr-influxdb) and just start mtr-monitor.sh.

Make sure influxdb is seen in ther python site-packages: python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" | xargs ls

mtr-monitor's People

Contributors

benjamins-81 avatar carbolymer avatar jordanmackie avatar ryandeering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mtr-monitor's Issues

multiple issues

Hello,
trying to install on fresh debian 11, but i'm facing multiple issues.

first thing is that influxDB is not seen in python libs :
# python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" | xargs ls | grep -i influx
->returns nothing, but influxdb python module in installed :

# python3 -m pip list | grep -i infl

influxdb         5.3.1

other problems (that may be linked) : graphana dashboard does not conain anything related to mtr, and I have no influxdb datasource.

can you help me please ?
Regards

How to use with Docker

Hello, I have already docker running with: Telegraf, Grafana, Influxdb, how can I load mtr-monitor to be part of the docker container? thanks

External influxdb

Hey, I want to run mtr on my Raspberry Pi 4, but use an external instance of InfluxDB running on my server.
I'm not sure where to specify a bucket and credentials for such an external InfluxDB

I'm also curious, if mtr-monitor is compatible with the newer influxdb 2.0, or if I need a seconds instance running 1.7-alpine.

Beautiful piece of software tho

I don't want use docker

dear:
THE mtr monitor is very good!.BUT I don't want to use docker. Now I install influxdb.How can I create database ,tables,column?
and THE save_data.py hava you python2 ?
Thank you!

No --json option

Can you tell me which version of mtr you are using?

Thanks,
Frank

Unable to parse data and insert into InfluxDB

I slightly adjusted the mtr-monitor.sh to not create Docker containers because I have an existing InfluxDB in my environment. But the python script returns the following error:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
Traceback (most recent call last):
  File "./save_data.py", line 65, in <module>
    main()
  File "./save_data.py", line 61, in main
    HubEntry.commit()
  File "/usr/lib/python2.7/dist-packages/influxdb/helper.py", line 127, in commit
    rtn = client.write_points(cls._json_body_())
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 391, in write_points
    tags=tags)
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 436, in _write_points
    expected_response_code=204
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 278, in write
    headers=headers
  File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 248, in request
    raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"unable to parse '8.8.8.8,destination=8.8.8.8,hop=01-10.166.102.3 avg=3.56,best=0.38,last=6.53,loss=0.0,snt=30i,stdev=8.67,time=2018-12-12 11:16:06.119893,wrst=47.22': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=02-10.255.254.97 avg=0.79,best=0.45,last=0.86,loss=0.0,snt=30i,stdev=0.12,time=2018-12-12 11:16:06.119893,wrst=1.04': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=03-172.30.8.11 avg=0.59,best=0.39,last=0.67,loss=0.0,snt=30i,stdev=0.17,time=2018-12-12 11:16:06.119893,wrst=1.02': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=04-172.30.5.11 avg=0.79,best=0.54,last=0.77,loss=0.0,snt=30i,stdev=0.23,time=2018-12-12 11:16:06.119893,wrst=1.57': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=05-194.40.224.196 avg=1.53,best=1.29,last=1.65,loss=0.0,snt=30i,stdev=0.15,time=2018-12-12 11:16:06.119893,wrst=1.91': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=06-i79zhh-001-ten0-3-0-11.bb.ip-plus.net avg=2.12,best=1.8,last=2.12,loss=0.0,snt=30i,stdev=0.2,time=2018-12-12 11:16:06.119893,wrst=2.62': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=07-i79zhh-015-ae5.bb.ip-plus.net avg=4.62,best=1.7,last=1.92,loss=0.0,snt=30i,stdev=6.69,time=2018-12-12 11:16:06.119893,wrst=30.79': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=08-72.14.223.0 avg=3.03,best=2.69,last=3.03,loss=0.0,snt=30i,stdev=0.24,time=2018-12-12 11:16:06.119893,wrst=3.95': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=09-??? avg=0.0,best=0.0,last=0.0,loss=100.0,snt=30i,stdev=0.0,time=2018-12-12 11:16:06.119893,wrst=0.0': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=10-172.253.50.22 avg=3.99,best=3.7,last=4.5,loss=0.0,snt=30i,stdev=0.2,time=2018-12-12 11:16:06.119893,wrst=4.5': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=11-172.253.50.173 avg=4.34,best=3.43,last=3.7,loss=0.0,snt=30i,stdev=2.63,time=2018-12-12 11:16:06.119893,wrst=18.13': invalid number\nunable to parse '8.8.8.8,destination=8.8.8.8,hop=12-google-public-dns-a.google.com avg=2.12,best=1.95,last=1.95,loss=0.0,snt=30i,stdev=0.17,time=2018-12-12 11:16:06.119893,wrst=2.62': invalid number"}

I'm aware that I'm not using your script the way you wrote it, but maybe you have an idea if the problem is related to my InfluxDB (1.6.4) or to a different output of mtr (0.92)?

Save_Data.py Modification

I set mine up without any docker dependencies.

In my use case:
Python 3.9.2
MTR 0.94
InfluxDB 1.8.10
Grafana v10.1.1

Had to modify save_data.py line 45-48 thus:

    if hub['count'] < 10:
        hop = "0" + str(hub['count']) + "-" + hub['host']
    else:
        hop = str(hub['count']) + "-" + hub['host']

Python3 was unable to do a string conversion from int with string concatenation. Explicitly changed int to str.

Hope this helps someone out!

multiple ISPs

Hello, I was wondering how I could use this with multiple ISPs?
I have some other scripts that use multiple interfaces on my test box so I can specify which which gateway to use.
I know with mtr -I <interface> I can get it to exit out the specified interface, I just don't know how to code it here and send that data to influx.
With time, I could figure it out, but I'm sure there's someone smarter here that could figure it out before me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.