danozdotnet / netupmon Goto Github PK
View Code? Open in Web Editor NEWnetwork uptime monitor
License: MIT License
network uptime monitor
License: MIT License
To make it work on OSX:
Add this to the detect OS thingy:
darwin*)
OS="darwin";
[[ "$FPING" ]] && PING="fping -c 1 -t $TIMEOUT -u -q" || PING="ping -c1 -t1";;
here's the OSTYPE if you need it:
[duck@Adria] Scripts$ echo $OSTYPE
darwin15
Also for the date in the ConvertDATE function:
[[ "$OS" == "darwin" ]] && printf "%s" "$(date -r "$1" +"%d/%m/%Y %H:%M:%S")"
(the date command is the same as the BSD one)
fping detection is broken too.
[duck@Adria] Scripts$ type fping 2>/dev/null 2>&1
fping is hashed (/opt/local/sbin/fping)
[duck@Adria] Scripts$ type fping2 >/dev/null 2>&1
[duck@Adria] Scripts$
Changing the line: FPING=$(type fping 2>/dev/null 2>&1)
to: FPING=$(type fobviouslywrongping 2>/dev/null 2>&1)
to make it fail, it still seems to return true. For now I'm running it in ping only mode.
An option to reset the counters.
eg. ./netupmon.sh --reset
Possible typo on line 34: FPING=$(type fping2 >/dev/null 2>&1)
EdgeRouter:
vbash-4.1$ type fping2 >/dev/null 2>&1
vbash-4.1$ type fping 2>/dev/null 2>&1
fping is /usr/bin/fping
OSX
[duck@Adria] Scripts$ type fping2 >/dev/null 2>&1
[duck@Adria] Scripts$ type fping 2>/dev/null 2>&1
fping is hashed (/opt/local/sbin/fping)
Bonus points: When running the script, announce that it's using fping instead of ping, if the above fails for any reason, it'll go back to using ping, but without letting you know.
When you make the above change, fping will output to the console like so:
vbash-4.1$ ./danozping.sh -t
8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 10.9/10.9/10.9
4.2.2.2 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 165/165/165
208.67.222.222 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 10.8/10.8/10.8
8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 10.8/10.8/10.8
4.2.2.2 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 165/165/165
208.67.222.222 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 11.9/11.9/11.9
8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 9.99/9.99/9.99
4.2.2.2 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 165/165/165
208.67.222.222 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 9.28/9.28/9.28
8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 9.86/9.86/9.86
4.2.2.2 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 165/165/165
208.67.222.222 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 11.2/11.2/11.2
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.