Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I don't want use docker #4

Open
pangqiss1986 opened this issue May 13, 2019 · 8 comments
Open

I don't want use docker #4

pangqiss1986 opened this issue May 13, 2019 · 8 comments

Comments

@pangqiss1986
Copy link

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!

@carbolymer
Copy link
Owner

check available options here:
https://github.com/carbolymer/mtr-monitor/blob/master/mtr-monitor.sh#L10

You don't need to create schema in influxdb. Everything is done in https://github.com/carbolymer/mtr-monitor/blob/master/save_data.py

You just need to set correct port and host in mtr-monitor.sh

@pangqiss1986
Copy link
Author

this is my mtr-monitor.sh
#!/bin/bash

number of pings sent

CYCLES=30

inverval between MTR tests in seconds

INTERVAL=30
MTR_HOSTS=("114.114.114.114")

if you need to change it, change also in influx-cli.sh

INFLUXDB_HOST="localhost"
INFLUXDB_PORT=8086

END OF CONFIG

function monitor_mtr() {
for MTR_HOST in "${MTR_HOSTS[@]}"; do
( mtr --report --json --report-cycles $CYCLES $MTR_HOST | ./save_data.py --host $INFLUXDB_HOST --port $INFLUXDB_PORT ) &
done
}

which mtr &>/dev/null
if [ $? -eq 1 ]; then
echo "mtr is not available on this system - it is required for this script to work"
exit 1
fi

while true; do
monitor_mtr
sleep $INTERVAL
done

THE save_data.py must use python3?

@carbolymer
Copy link
Owner

looks fine, and yes you should use python 3

@pangqiss1986
Copy link
Author

THANK YOU!

@pangqiss1986
Copy link
Author

sorry,I have two question....
NO.1:
(py3) [root@localhost mtr]# ./mtr-monitor.sh
mtr: unrecognized option '--json'
mtr: unrecognized option '--json'
mtr: unrecognized option '--json'
mtr: unrecognized option '--json'
Traceback (most recent call last):
File "./save_data.py", line 65, in
main()
File "./save_data.py", line 38, in main
mtr_result = json.load(sys.stdin)
File "/usr/local/lib/python3.6/json/init.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/local/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

NO.2
grafana version is 6.1.4 THE grafana_dashboard_mtr.json import is
Templating init failed
Datasource named ${DS_TBD_INFLUX MTR} was not found

can you help me...thank!!!

@carbolymer
Copy link
Owner

  1. which mtr version you have? you need >=0.87

  2. You need to setup datasource manually in grafana

@pangqiss1986
Copy link
Author

the grafana_dashboard_mtr.json import is not support grafana6.1.4.....

@teesa-git
Copy link

@pangqiss1986 @carbolymer The same quessiton No.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants