orf / gping Goto Github PK
View Code? Open in Web Editor NEWPing, but with a graph
License: MIT License
Ping, but with a graph
License: MIT License
Hi there. As the title says, i've just tried the last version under Windows 10 20H2 without success:
gping host = blank window with blinking cursor. Tried with standard cmd shell and the new Windows Terminal: same results.
Hi, Installed it with cargo. (my os is 64 bit)
when I do gping somehost
I only see the blinking cursor in the top left. Normal ping works.
Also tested it as root / with sudo.
here is a demo video: https://youtu.be/RusyEIyL_K4
I'm a Gentoo developer and would like to start distributing this Gentoo. However, it is not yet licensed. Can I recommend GPL-2.
I get this error when I try to run gping
on 64 bit Arch Linux.
Traceback (most recent call last):
File "/usr/bin/gping", line 11, in <module>
sys.exit(run())
File "/usr/lib/python3.5/site-packages/gping/pinger.py", line 251, in run
for ping in it(url):
File "/usr/lib/python3.5/site-packages/gping/pinger.py", line 225, in _linux
yield round(float(linux_re.search(line).group(1)))
AttributeError: 'NoneType' object has no attribute 'group'
$ pip3 install pinggraph
Collecting pinggraph
Downloading pinggraph-0.0.4-py3-none-any.whl
Installing collected packages: pinggraph
Successfully installed pinggraph-0.0.4
$ gping ping.sunet.se
Traceback (most recent call last):
File "/usr/local/bin/gping", line 7, in <module>
from gping.pinger import run
File "/usr/local/lib/python3.5/site-packages/gping/pinger.py", line 10, in <module>
from colorama import Fore, init
ImportError: No module named 'colorama'
(OSX 10.11, python 3.5.0)
Say I wanted to modify it to gcurl for bandwidth plotting. Roughly poll this in the event loop? https://github.com/alexcrichton/curl-rust/blob/65cb1c2c78321a1aedb919ee2b4225879f89f594/curl-sys/lib.rs#L78
I've installed gping using snap on an Ubunti 16.04 host with the following cmd:
sudo snap install gping && sudo snap connect gping:network-observe
If i do run
gping -I INTERFACENAME NAME-OF-TARGET
Please check the attached image for the output
I do know that NAME-OF-TARGET is pingable at that moment using classic ping command.
Most ping tools report microsecond resolution which is necessary for modern wired networks.
If you ping the default gateway over a low latency medium (LAN) you get latencies that result in a division by zero:
$ gping 192.168.1.1
Traceback (most recent call last):
File "/mnt/Stuff/workplace/python/pinggraph/bin/gping", line 11, in <module>
sys.exit(run())
File "/mnt/Stuff/workplace/python/pinggraph/local/lib/python2.7/site-packages/gping/pinger.py", line 305, in run
_run()
File "/mnt/Stuff/workplace/python/pinggraph/local/lib/python2.7/site-packages/gping/pinger.py", line 331, in _run
plotted = plot(width, height, buff, host)
File "/mnt/Stuff/workplace/python/pinggraph/local/lib/python2.7/site-packages/gping/pinger.py", line 149, in plot
yellow_zone_idx = round(max_scaled * (100 / max_ping))
ZeroDivisionError: float division by zero
mtr also has graphs:
Though obviously they are of a different type (and aren't as pretty), they do convey some similar (though more detailed) information.
BTW, I would love an mtr that had an additional display mode that could switch among a set of gping-like graphs for each hop. /CC @traviscross & @rewolf
On Linux Mint I get the following error:
gping google.com
Traceback (most recent call last):
File "/usr/local/bin/gping", line 7, in
from gping.pinger import run
File "/usr/local/lib/python3.4/dist-packages/gping/pinger.py", line 11, in
from colorama.ansitowin32 import winterm
ImportError: cannot import name 'winterm'
Can you give any hints on how this could be solved?
Steps to reproduce: Start gping, resize terminal window vertically until it is very small.
Traceback (most recent call last):
File "/snap/gping/13/bin/gping", line 11, in
load_entry_point('pinggraph==1.0', 'console_scripts', 'gping')()
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 313, in run
run()
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 343, in run
plotted = plot(width, height, buff, host)
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 201, in plot
blank=True
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 100, in box
self.line(last_point, point, paint=paint, character=" " if blank else None)
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 79, in line
self.vertical_line(character, from.x, from.y, to.y, paint)
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 72, in vertical_line
self[column, y] = (next(data_iter), paint)
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 52, in setitem
self.data[int(-y)][int(x)] = data
IndexError: list index out of range
Hi detailed stats are shown in the animated gif but there doesn't appear to be instructions as to how to enable them?
JT
This looks newer than #2 and #11, though it seems similar.
Traceback (most recent call last):
File "/usr/local/bin/gping", line 11, in
sys.exit(run())
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 314, in run
_run()
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 339, in _run
for line in it(options):
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 264, in _inner
result = func(line)
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 293, in darwin_ping
return round(float(darwin_re.search(line).group(5)))
AttributeError: 'NoneType' object...
I see this once in awhile, but not sure what triggers it. I'll try adding some debug output...
Thanks for making a snap of gping! It's pretty.
Unfortunately under strict confinement it fails. Looks like you need an extra plug and binary perhaps?
Traceback (most recent call last):
File "/snap/gping/6/bin/gping", line 11, in <module>
load_entry_point('pinggraph==1.0', 'console_scripts', 'gping')()
File "/snap/gping/6/lib/python3.5/site-packages/gping/pinger.py", line 313, in run
_run()
File "/snap/gping/6/lib/python3.5/site-packages/gping/pinger.py", line 338, in _run
for line in it(options):
File "/snap/gping/6/lib/python3.5/site-packages/gping/pinger.py", line 251, in _inner
ping = subprocess.Popen(args, stdout=subprocess.PIPE)
File "/snap/gping/6/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/snap/gping/6/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
alan@hal:~$ snappy-debug.security scanlog
sysctl: permission denied on key 'kernel.printk_ratelimit'
= AppArmor =
Time: Aug 3 01:40:37
Log: apparmor="DENIED" operation="open" profile="snap.gping.gping" name="/proc/24006/mounts" pid=24006 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /proc/24006/mounts (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/mounts'
* add one of 'mount-observe, network-control' to 'plugs'
= AppArmor =
Time: Aug 3 01:40:37
Log: apparmor="DENIED" operation="exec" profile="snap.gping.gping" name="/bin/ping" pid=24022 comm="python3" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0
File: /bin/ping (exec)
Suggestions:
* adjust snap to ship 'ping'
* adjust program to use relative paths if the snap already ships 'ping'
Just shows a blank screen ...
Installed via snap install gping
on Ubuntu and running gives me this error:
Traceback (most recent call last):
File "/snap/gping/13/bin/gping", line 11, in <module>
load_entry_point('pinggraph==1.0', 'console_scripts', 'gping')()
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 313, in run
_run()
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 338, in _run
for line in it(options):
File "/snap/gping/13/lib/python3.5/site-packages/gping/pinger.py", line 251, in _inner
ping = subprocess.Popen(args, stdout=subprocess.PIPE)
File "/snap/gping/13/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/snap/gping/13/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I use Windows 8.1 with Python 3.5.0 and get the following error when CTRL+Cing gping:
Traceback (most recent call last):
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\dennis_lpt\AppData\Local\Programs\Python\Python35\Scripts\gping.exe\__main__.py", line 9, in <module>
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\site-packages\gping\pinger.py", line 251, in run
for ping in it(url):
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\site-packages\gping\pinger.py", line 213, in _windows
line = ping.stdout.readline().decode()
KeyboardInterrupt
It's just an esthetic issue, not impairing anything at all. Thought it might be worth reporting.
Using master (commit b2aecf2) I get the following error when trying to run setup.py:
sudo ./setup.py
from: too many arguments
./setup.py: 4: ./setup.py: Syntax error: newline unexpected (expecting ")")
It's probably user error on the installation but snap and pip aren't an option for me.
Running Ubuntu 16.04.3 LTS x86-64
Python colorama 0.3.7 installed
I noticed we have the license (MIT) specified in Cargo.toml
, but it doesn't seem like the license itself has been added to the Rust/new master branch, yet.
Windows 10 64bit 1709 16299.431
Successfully installed colorama-0.3.9 pinggraph-1.1
Setting the interval with -i5
works with regular ping (5 seconds between pings), but the same flag passed to gping throws duplicated error messages:
[ ~ ]$ python3 --version
Python 3.5.0
[ ~ ]$ ping -i5 google.com
PING google.com (216.58.192.14): 56 data bytes
64 bytes from 216.58.192.14: icmp_seq=0 ttl=53 time=44.896 ms
64 bytes from 216.58.192.14: icmp_seq=1 ttl=53 time=36.484 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 36.484/40.690/44.896/4.206 ms
[ ~ ]$ gping -i5 google.com
usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize]
[-g sweepminsize] [-h sweepincrsize] [-i wait] [−k trafficclass]
[-l preload] [-M mask | time] [-m ttl] [-p pattern]
[-S src_addr] [-s packetsize] [-t timeout][-W waittime] [-z tos]
host
ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait]
[−k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr]
[-s packetsize] [-T ttl] [-t timeout] [-W waittime]
[-z tos] mcast-group
[ ~ ]$
Python has a curses module in the standard library that might simplify the code a bit and make the graph a bit prettier.
Can we do anything to remove flashes on refresh?
Maybe use a terminal command to move cursor to screen top instead of just prints?
Great tool :)
I'm using Windows 8.1 and downloaded Python 3.5.0 from https://www.python.org/downloads/windows/.
After installing pinggraph and statistics from pip3, I still got the following error:
λ gping 8.8.8.8
Traceback (most recent call last):
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\dennis_lpt\AppData\Local\Programs\Python\Python35\Scripts\gping.exe\__main__.py", line 5, in <module>
File "c:\users\dennis_lpt\appdata\local\programs\python\python35\lib\site-packages\gping\pinger.py", line 10, in <module>
from colorama import Fore, init
ImportError: No module named 'colorama'
After installing colorama via pip3, everything works.
Maybe you could add this to the readme?
So there is a fair bit to do to get to a 0.1 release. Here's a list of things I can think of:
ping whatever | gping
Getting what looks like a regex bug. Running on Mac OSX 10.11 with python 3.5
$ gping google.com
Traceback (most recent call last):
File "/usr/local/bin/gping", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python3.5/site-packages/gping/pinger.py", line 251, in run
for ping in it(url):
File "/usr/local/lib/python3.5/site-packages/gping/pinger.py", line 225, in _linux
yield round(float(linux_re.search(line).group(1)))
AttributeError: 'NoneType' object has no attribute 'group'
Since there is apparently a failed match the match is None which is why it errors.
gping 127.0.0.1
works as expected, but gping ::1
just gives a blank screen.
I just started using gping today. Great program. I was playing with the terminal window, trying to figure out how many ms a bar represents at different heights. If I make the terminal too small vertically, it crashes:
Traceback (most recent call last):
File "/usr/local/bin/gping", line 11, in
sys.exit(run())
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 314, in run
run()
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 344, in run
plotted = plot(width, height, buff, host)
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 202, in plot
blank=True
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 101, in box
self.line(last_point, point, paint=paint, character=" " if blank else None)
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 80, in line
self.vertical_line(character, from.x, from.y, to.y, paint)
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 73, in vertical_line
self[column, y] = (next(data_iter), paint)
File "/usr/local/lib/python3.6/site-packages/gping/pinger.py", line 53, in setitem
self.data[int(-y)][int(x)] = data
IndexError: list index out of range
Seems like 10 rows works, and less than that it crashes.
I'm running this on Mac with the Terminal app.
Are you planning to publish gping on homebrew ( https://brew.sh/ ) ?
That would ease the process of installing brew, then python 3, and then gping!
Most interactive terminal applications (htop, iftop, nethogs, less) accept the convention of terminating when the user presses the q
key.
Instead of using statistics.mean
that breaks compatibility between python2 and python3, we can simply implement a mean(data)
function that returns sum(data)/len(data)
I can send you a PR if you are okay with this.
My system language is russian, so terminal codepage is 866. When i'm trying to run script, i get:
Traceback (most recent call last): File "C:\Anaconda\lib\runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "C:\Anaconda\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Anaconda\Scripts\gping.exe\__main__.py", line 9, in <module> File "C:\Anaconda\lib\site-packages\gping\pinger.py", line 294, in run _run() File "C:\Anaconda\lib\site-packages\gping\pinger.py", line 281, in _run for ping in it(url): File "C:\Anaconda\lib\site-packages\gping\pinger.py", line 227, in _windows line = ping.stdout.readline().decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 0: invalid start byte
If change decode() to decode('CP866') or decode('win-1251') it works, but outputs nothing. (And i can't found where to change output encoding). Solution is to run chcp 65001
before executing script. Maybe add this to script by default? (But i don't know how exactly to do this, because subprocess.Popen(["chcp","65001"])
doesn't work - seems that chcp
is not executable file.)
Installed via cargo install gping
on ubuntu 18.04. gping 0.1.4
Ping response:
(base) _ ~ ping google.com
PING google.com (172.217.26.174) 56(84) bytes of data.
64 bytes from maa03s22-in-f174.1e100.net (172.217.26.174): icmp_seq=1 ttl=117 time=13.9 ms
64 bytes from maa03s22-in-f174.1e100.net (172.217.26.174): icmp_seq=2 ttl=117 time=13.7 ms
64 bytes from maa03s22-in-f174.1e100.net (172.217.26.174): icmp_seq=3 ttl=117 time=13.8 ms
64 bytes from maa03s22-in-f174.1e100.net (172.217.26.174): icmp_seq=4 ttl=117 time=13.7 ms
Sorry, my screenshot tool is only taking the top left portion of the screen. The p95 is 1.56ms, which for my connection is impossible.
The same issue occurs with all other hosts.
Because, Debian 😄
http://i.imgur.com/JhWc7oy.png
pip3 says that installation is successfull, but i can't use gping.
If I start gping for local devices (192.168.1.*/24) it works fine.
but if I try such as gping google.com I get the following error.
Traceback (most recent call last):
File "/usr/local/bin/gping", line 9, in <module>
load_entry_point('pinggraph==1.0', 'console_scripts', 'gping')()
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 313, in run
_run()
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 343, in _run
plotted = plot(width, height, buff, host)
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 181, in plot
u"█", column + 2, 2, 2 + bar_height, paint=_paint
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 72, in vertical_line
self[column, y] = (next(data_iter), paint)
StopIteration
How can I make it work?
Thanks
Hi. Nice script 👍 !
But, asking for help blocks completely the script:
$ gping -help
Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface]
[-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos]
[-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option]
[-w deadline] [-W timeout] [hop1 ...] destination
(nothing else, it stops here, blocked)
Then it consumes 100% of one core without doing anything:
(it might be a Python2 / pip2 specific problem, I have not tried with pip3)
When I try to ping a local address, I sometimes get 0 ms, and thus gping crashes with the following errormessage:
robert@ubuntu:~$ gping 192.168.0.2
Traceback (most recent call last):
File "/home/robert/.local/bin/gping", line 11, in <module>
sys.exit(run())
File "/home/robert/.local/lib/python3.5/site-packages/gping/pinger.py", line 305, in run
_run()
File "/home/robert/.local/lib/python3.5/site-packages/gping/pinger.py", line 331, in _run
plotted = plot(width, height, buff, host)
File "/home/robert/.local/lib/python3.5/site-packages/gping/pinger.py", line 149, in plot
yellow_zone_idx = round(max_scaled * (100 / max_ping))
ZeroDivisionError: division by zero
I restart gping a few times until the first echo response takes 1 or more ms, then gping starts and works as expected.
Hi
Installed gping, but does this Graph is ok in Ubuntu 16.04 ?
https://asciinema.org/a/YvT0tiLjpICwiTnSUqbd2uYoo
Hi, i know this may be very basic, but would it be possible that you explain how to install gping on MacOS Sierra, i know the OS already have Python 2.6 Installed and I also downloaded and upgraded to 3.5. The "pip3 install pingggraph" works, but when I try to lauch it using "gping 8.8.8.8" it says "-bash: gping: command not found"
Thanks in advance.
Regards!
I was hoping to use gping to debug intermittent connectivity issues, by running it on multiple hosts with multiple targets to figure out what part of my network occasionally breaks. However, it seems that if ping packets get lost, the display just stops, rather than showing the lost packets. This effectively means that gping is not usable for the case I had in mind. Would it make sense to explicitly show lost packets (this might need to have a timeout, to consider a packet lost after some time, or after the next reply is received, but probably also needs retroactively updating a packet later when it is received after all.
I've just discovered gping, and it's great. It would be even better if there were some simple axis label.
Also, is the current display linear or logarithmic?
$ gping
Traceback (most recent call last):
File "/usr/local/bin/gping", line 9, in <module>
load_entry_point('pinggraph==0.0.9', 'console_scripts', 'gping')()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 89
def line(self, from_: P, to: P, paint=None, character=None):
^
SyntaxError: invalid syntax
and
Traceback (most recent call last):
File "/usr/local/bin/gping", line 9, in <module>
load_entry_point('pinggraph==0.0.9', 'console_scripts', 'gping')()
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 293, in run
_run()
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 288, in _run
print("\n".join(c.process_colors()))
File "/usr/local/lib/python2.7/dist-packages/gping/pinger.py", line 138, in process_colors
r.write(d)
TypeError: unicode argument expected, got 'str'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.