Git Product home page Git Product logo

cedexis.radar's Introduction

cedexis.radar

This package provides a library that can be used to conduct Cedexis Radar measurements in any language that supports Python bindings. It also provides a script that can be used to run a Radar session from the command line.

To make practical use of its features, you should sign up for a free Cedexis account. Your Cedexis customer id is a required argument to the main API call and the command line tool.

Requires: Python 2.7+

Installation

Using pip

The preferred method on platforms that support it is to install the package using pip:

$ pip install cedexis.radar

From source

You can also install the package from source:

$ cd /tmp
$ git clone https://github.com/cedexis/cedexis.radar
$ cd cedexis.radar
$ python setup.py install

Command Line Tool

Installation includes a command line tool called cedexis-radar-cli, which is a shim for the "main" function in the cedexis.radar.cli module.

Usage

Example:

$ cedexis-radar-cli -c 10660
2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1]
cedexis.radar.cli (INFO): Config file used:
cedexis.radar.cli (INFO): Command line args: Namespace(api_key='sandbox', config_file='', customer_id=10660, provider_id=None, secure=False, tracer=None, zone_id=1)
cedexis.radar (INFO): 2 providers measured

Full argument list:

Argument Description
--help/-h

HELP

Show a help message and exit

--zone-id/-z

ZONE_ID

Your Cedexis Zone ID (defaults to 1)

--customer-id/-c

CUSTOMER_ID

Your Cedexis Customer ID

--api-key/-k

API_KEY

Reserved for future use

--secure/-s

Use HTTPS

If specified, only measure providers configured with HTTPS probes

--tracer/-t

TRACER

An optional value to be included in the user agent string. Useful for troubleshooting.

--provider-id/-p

PROVIDER_ID

Measure a specific provider and quit

--config-file/-f

CONFIG_FILE

Path to a configuration file

Configuration File

The tool uses an optional configuration file to setup logging. You may specify the path to this file either using the --config-file/-f command line argument, or by setting the CEDEXIS_RADAR_CONFIG environment variable. The --config-file/-f argument always takes precedence over the environment variable setting.

The configuration file is JSON-formatted. The example below shows how to setup verbose output to a file and reduced output to the console.

{
    "customer": {
        "zone_id": 1,
        "customer_id": 10660
    },
    "logging": {
        "version": 1,
        "disable_existing_loggers": false,
        "formatters": {
            "console_formatter": {
                "format": "%(name)s (%(levelname)s): %(message)s"
            },
            "file_formatter": {
                "format": "%(asctime)s - %(name)s (%(levelname)s): %(message)s"
            }
        },
        "handlers": {
            "console": {
                "class": "logging.StreamHandler",
                "level": "INFO",
                "formatter": "console_formatter"
            },
            "file": {
                "class": "logging.FileHandler",
                "level": "DEBUG",
                "formatter": "file_formatter",
                "filename": "/home/freddy/logs/cedexis.radar.log"
            }
        },
        "root": {
            "level": "DEBUG",
                "handlers": [ "console", "file" ]
        }
    }
}

If you don't pass the --config-file/-f argument and the CEDEXIS_RADAR_CONFIG environment variable is not set, or if you pass the --config-file/-f argument with no value, the script uses default settings. The default settings produce minimal logging to the screen and no file logging.

Unit Tests

It's easy to run the unit test suite using nose. Here's an example for Python 3 on Ubuntu 13.10. It should be simple to adapt this example to other operating systems and versions of Python.

# Make sure you've got nose installed
$ pip3 install nose

# Run tests
$ nosetests-3.3 --with-xunit

About Cedexis

Founded in 2009, Cedexis optimizes web performance across data centers, content delivery networks (CDNs) and clouds, for companies that want to ensure 100% availability and extend their reach to new global markets.

We provide real-time, data-driven, global traffic management solutions. Optimize clouds, data centers and CDN content delivery to improve the availability, latency and throughput of your website and other Internet-connected apps, for every user on the globe.

Please visit us at www.cedexis.com.

cedexis.radar's People

Contributors

joshcody avatar

Watchers

James Cloos avatar

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.