How to use the PerfOps CLI?

Ping, Traceroute, MTR your resource from a command line

PerfOps CLI is a tool that allows you to perform all "run" tests, at our more than 250 servers placed worldwide and get desired types of results (location based, resolver based etc). 

An installation process is different depending on your OS:

Ubuntu/Debian

curl -s https://packagecloud.io/install/repositories/p1/perfops/script.deb.sh | sudo bash
apt-get install perfops

RHEL/CentOS/Fedora

curl -s https://packagecloud.io/install/repositories/p1/perfops/script.rpm.sh | sudo bash
yum install perfops

MacOS

brew tap ProspectOne/perfops
brew install perfops
perfops --help


Once you get it installed you can use it without any option to get the Available Commands list:

root@*******:/# perfops
Usage:
perfops [flags]
perfops [command]

Examples:
perfops traceroute --from "New York" google.com

Available Commands:
credits Displays the remaing credits
curl Run a curl test on a domain name or IP address
dnsperf Find the time it takes to resolve a DNS record on a target
help Help about any command
latency Run a ICMP latency test on a domain name or IP address
list Get a locations where PerfOps nodes are present
mtr Run a MTR test on a domain name or IP address
ping Run a ping test on a domain name or IP address
resolve Resolve a DNS record on a domain name
traceroute Run a traceroute test on a domain name or IP address

Flags:
--debug Enables debug output
-h, --help help for perfops
-K, --key string The PerfOps API key (default is $PERFOPS_API_KEY)
-v, --version Prints the version information of perfops

Use "perfops [command] --help" for more information about a command.


If you type 'perfops' with a command and the --help flag will explain that command usage:

root@********:/# perfops curl --help
Run a curl test on a target, e.g., google.com or 8.8.8.8.

Usage:
perfops curl [target] [flags]

Examples:
perfops curl --http2 bing.com

Flags:
-F, --from string A continent, region (e.g eastern europe), country, US state or city
-I, --head Fetch the headers only
-h, --help help for curl
--http2 Use HTTP version 2
-k, --insecure Allow curl to proceed for server connections considered insecure
-J, --json Print the result of a command in JSON format
-L, --limit int The maximum number of nodes to use (default 1)
-N, --nodeid ints A comma separated list of node IDs to run a test from

Global Flags:
--debug Enables debug output
-K, --key string The PerfOps API key (default is $PERFOPS_API_KEY)
-v, --version Prints the version information of perfops


So, if you perform Curl to, for example, 'perfops.net', and want only headers and JSON-formatted result (--json flag), you perform:

root@********:/# perfops curl --head --json perfops.net
{"id":"917bee312dc005ffc439270e64b9eeed","requested":"perfops.net","finished":true,"items":[{"id":"2d13cc8ca56f0bbc054bb1159c595659","result":{"node":{"id":355,"as_number":40676,"latitude":-23.55150660815269,"longitude":-46.63182965087879,"city":"São Paulo","sub_region":"","country":{"id":185,"name":"Brazil","iso":"BR","isoNumeric":76,"continent":{"id":6,"name":"South America","iso":"SA"}}},"output":"HTTP/1.1 301 Moved Permanently\nContent-Length: 36\nContent-Type: text/plain\nDate: Wed, 15 Apr 2020 16:24:32 GMT\nLocation: https://perfops.net/\nAge: 81075\nConnection: keep-alive\nServer: Netlify\nCache-Control: public,max-age=600\nX-NF-Request-ID: b5695c26-380f-40cb-b96f-3dce15dd6d92-24896504","finished":true,"timing":{"total":"0.649495","dns":"0.010575","connect":"0.330181","ttfb":"0.649388"}}}]} 


Or, without JSON:

root@********:/# perfops curl --head perfops.net
Node153, AS50673, Amsterdam, Netherlands
HTTP/1.1 301 Moved Permanently
Content-Length: 36
Content-Type: text/plain
Date: Thu, 16 Apr 2020 11:03:36 GMT
Location: https://perfops.net/
Age: 13956
Connection: keep-alive
Server: Netlify
Cache-Control: public,max-age=600
X-NF-Request-ID: 093f5a34-d103-4bab-9fcb-e70ca2fe1c26-23710112


And if you need to ping that resource:

root@********:/# perfops ping perfops.net
Node303, AS262448, São Paulo, Brazil
PING perfops.net (54.206.19.82) 56(84) bytes of data.
64 bytes from 54.206.19.82: icmp_seq=1 ttl=39 time=310 ms
64 bytes from 54.206.19.82: icmp_seq=2 ttl=39 time=310 ms
64 bytes from 54.206.19.82: icmp_seq=3 ttl=39 time=310 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 800ms
rtt min/avg/max/mdev = 310.495/310.564/310.658/0.460 ms


Or you want to run latency (ICMP test) from 5 random locations (--limit flag):

root@********:/# perfops --limit 5 latency perfops.net
Node303, AS262448, São Paulo, Brazil
310.854
Node135, AS16276, Beauharnois, Canada
8.661
Node112, AS14061, Bangalore, India
211.047
Node12, AS20473, Seattle, United States
60.707
Node294, AS136557, Auckland, New Zealand
220.276


But, if you continue to perform tests without authorization key - you will get:

root@294bfc19893d:/# perfops ping perfops.net
Error: The requested limit is bigger than remaining test attempts: 0. 


The thing is, guests (unauthorized users) are able to perform only 10 tests per hour, so if you need more results - use your API Key, provided at the Settings page.


To use your API key add it with -K (--key) flag:

root@********:/# perfops --key your_perfops_api_key --limit 5 ping perfops.net
Node85, AS42331, Kiev, Ukraine
PING perfops.net (167.99.129.42) 56(84) bytes of data.
64 bytes from 167.99.129.42: icmp_seq=1 ttl=55 time=56.6 ms
64 bytes from 167.99.129.42: icmp_seq=2 ttl=55 time=56.4 ms
64 bytes from 167.99.129.42: icmp_seq=3 ttl=55 time=56.5 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 802ms
rtt min/avg/max/mdev = 56.442/56.540/56.655/0.087 ms

Node295, AS199524, Luxembourg, Luxembourg
PING perfops.net (104.248.63.231) 56(84) bytes of data.
64 bytes from 104.248.63.231: icmp_seq=1 ttl=52 time=80.7 ms
64 bytes from 104.248.63.231: icmp_seq=2 ttl=52 time=80.0 ms
64 bytes from 104.248.63.231: icmp_seq=3 ttl=52 time=80.2 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 802ms
rtt min/avg/max/mdev = 80.045/80.371/80.789/0.387 ms

Node313, AS40676, Johannesburg, South Africa
PING perfops.net (18.230.52.212) 56(84) bytes of data.
64 bytes from 18.230.52.212: icmp_seq=1 ttl=51 time=334 ms
64 bytes from 18.230.52.212: icmp_seq=2 ttl=51 time=333 ms
64 bytes from 18.230.52.212: icmp_seq=3 ttl=51 time=334 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 800ms
rtt min/avg/max/mdev = 333.647/334.036/334.384/0.302 ms

Node138, AS62904, Phoenix, United States
PING perfops.net (192.81.212.192) 56(84) bytes of data.
64 bytes from 192.81.212.192: icmp_seq=1 ttl=48 time=63.4 ms
64 bytes from 192.81.212.192: icmp_seq=2 ttl=48 time=63.4 ms
64 bytes from 192.81.212.192: icmp_seq=3 ttl=48 time=63.5 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 801ms
rtt min/avg/max/mdev = 63.458/63.495/63.553/0.209 ms

Node337, AS16509, Sydney, Australia
PING perfops.net (54.206.19.82) 56(84) bytes of data.
64 bytes from 54.206.19.82: icmp_seq=1 ttl=63 time=0.744 ms
64 bytes from 54.206.19.82: icmp_seq=2 ttl=63 time=0.775 ms
64 bytes from 54.206.19.82: icmp_seq=3 ttl=63 time=0.755 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 800ms
rtt min/avg/max/mdev = 0.744/0.758/0.775/0.012 ms


Notice,
API credits are consumed, so if you need more than provided by your plan - you can buy additional Credit packs or contact our team to discuss how to migrate to a Custom plan.

You can also check your remaining API credits with 'credits' command (that won't consume anything :)):

root@********:/# perfops --key your_perfops_api_key credits

Remaining credits: 488


You can also use `--from` flag to perform location-based test, like:

root@********:/# perfops --key your_perfops_api_key ping --from "London" perfops.net
Node19, AS59764, London, United Kingdom
PING perfops.net (142.93.108.123) 56(84) bytes of data.
64 bytes from 142.93.108.123: icmp_seq=1 ttl=55 time=17.9 ms
64 bytes from 142.93.108.123: icmp_seq=2 ttl=55 time=17.9 ms
64 bytes from 142.93.108.123: icmp_seq=3 ttl=55 time=18.2 ms

--- perfops.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 801ms
rtt min/avg/max/mdev = 17.905/18.020/18.204/0.171 ms


We have one of our test servers based in London, so you've got the result. There is the `list` command that returns you lists of countries and cities our nodes placed at (JSON format).

root@********:/# perfops list countries
[{"id":15,"name":"Egypt","iso":"EG","isoNumeric":"818","continent":{"id":1,"name":"Africa","iso":"AF"}},{"id":45,"name":"South Africa","iso":"ZA","isoNumeric":"710","continent":{"id":1,"name":"Africa","iso":"AF"}},{"id":62,"name":"China","iso":"CN","isoNumeric":"156","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":64,"name":"India","iso":"IN","isoNumeric":"356","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":65,"name":"Indonesia","iso":"ID","isoNumeric":"360","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":68,"name":"Israel","iso":"IL","isoNumeric":"376","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":69,"name":"Japan","iso":"JP","isoNumeric":"392","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":73,"name":"South Korea","iso":"KR","isoNumeric":"410","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":78,"name":"Malaysia","iso":"MY","isoNumeric":"458","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":86,"name":"Russia","iso":"RU","isoNumeric":"643","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":88,"name":"Singapore","iso":"SG","isoNumeric":"702","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":93,"name":"Turkey","iso":"TR","isoNumeric":"792","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":95,"name":"United Arab Emirates","iso":"AE","isoNumeric":"784","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":99,"name":"Albania","iso":"AL","isoNumeric":"8","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":102,"name":"Austria","iso":"AT","isoNumeric":"40","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":105,"name":"Belgium","iso":"BE","isoNumeric":"56","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":107,"name":"Bulgaria","iso":"BG","isoNumeric":"100","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":109,"name":"Cyprus","iso":"CY","isoNumeric":"196","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":110,"name":"Czechia","iso":"CZ","isoNumeric":"203","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":111,"name":"Denmark","iso":"DK","isoNumeric":"208","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":112,"name":"Estonia","iso":"EE","isoNumeric":"233","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":113,"name":"Finland","iso":"FI","isoNumeric":"246","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":114,"name":"France","iso":"FR","isoNumeric":"250","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":116,"name":"Germany","iso":"DE","isoNumeric":"276","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":117,"name":"Greece","iso":"GR","isoNumeric":"300","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":118,"name":"Hungary","iso":"HU","isoNumeric":"348","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":119,"name":"Iceland","iso":"IS","isoNumeric":"352","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":120,"name":"Ireland","iso":"IE","isoNumeric":"372","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":121,"name":"Italy","iso":"IT","isoNumeric":"380","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":122,"name":"Latvia","iso":"LV","isoNumeric":"428","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":124,"name":"Republic of Lithuania","iso":"LT","isoNumeric":"440","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":125,"name":"Luxembourg","iso":"LU","isoNumeric":"442","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":128,"name":"Republic of Moldova","iso":"MD","isoNumeric":"498","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":131,"name":"Netherlands","iso":"NL","isoNumeric":"528","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":132,"name":"Norway","iso":"NO","isoNumeric":"578","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":133,"name":"Poland","iso":"PL","isoNumeric":"616","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":134,"name":"Portugal","iso":"PT","isoNumeric":"620","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":135,"name":"Romania","iso":"RO","isoNumeric":"642","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":138,"name":"Slovakia","iso":"SK","isoNumeric":"703","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":140,"name":"Spain","iso":"ES","isoNumeric":"724","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":141,"name":"Sweden","iso":"SE","isoNumeric":"752","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":142,"name":"Switzerland","iso":"CH","isoNumeric":"756","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":143,"name":"Ukraine","iso":"UA","isoNumeric":"804","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":144,"name":"United Kingdom","iso":"GB","isoNumeric":"826","continent":{"id":3,"name":"Europe","iso":"EU"}},{"id":150,"name":"Canada","iso":"CA","isoNumeric":"124","continent":{"id":4,"name":"North America","iso":"NA"}},{"id":161,"name":"Mexico","iso":"MX","isoNumeric":"484","continent":{"id":4,"name":"North America","iso":"NA"}},{"id":163,"name":"Panama","iso":"PA","isoNumeric":"591","continent":{"id":4,"name":"North America","iso":"NA"}},{"id":168,"name":"United States","iso":"US","isoNumeric":"840","continent":{"id":4,"name":"North America","iso":"NA"}},{"id":169,"name":"Australia","iso":"AU","isoNumeric":"36","continent":{"id":5,"name":"Oceania","iso":"OC"}},{"id":175,"name":"New Zealand","iso":"NZ","isoNumeric":"554","continent":{"id":5,"name":"Oceania","iso":"OC"}},{"id":185,"name":"Brazil","iso":"BR","isoNumeric":"76","continent":{"id":6,"name":"South America","iso":"SA"}},{"id":195,"name":"Hong Kong","iso":"HK","isoNumeric":"344","continent":{"id":2,"name":"Asia","iso":"AS"}},{"id":196,"name":"Taiwan","iso":"TW","isoNumeric":"158","continent":{"id":2,"name":"Asia","iso":"AS"}}]

or

root@294bfc19893d:/# perfops list cities
[{"name":"Sydney","country":{"name":"Australia"},"continent":{"name":"Oceania"}},{"name":"Haarlem","country":{"name":"Netherlands"},"continent":{"name":"Europe"}},{"name":"Frankfurt","country":{"name":"Germany"},"continent":{"name":"Europe"}},{"name":"London","country":{"name":"United Kingdom"},"continent":{"name":"Europe"}}

This list is pretty big, so we won't show the whole response :)


So, feel free to use continent/country/city name to perform your location-based tests.