Giter Club home page Giter Club logo

codeigniter-serverdensity-api's Introduction

Codeigniter-ServerDensity-API
=============================
=============================

Usage
=====

This is a simple CodeIgniter wrapper for the ServerDensity API that allows you to view stats about your servers.

So far only basic stats are available, more wrappers will be added over time.

To use this library, drop the config into your Config folder and add the details, then add the Server_density_api.php file into your Libraries folder.


Notes
=====

For range values, times must be GMT formatted without a Timezone flag, i.e

date_default_timezone_set('Europe/London'); 
$start_time = gmdate("Y-m-d\TH:i:s",strtotime('-30 mins')); 
$end_time = gmdate("Y-m-d\TH:i:s"); 

UPDATE - For version 1.1 of the api, you are required to list the new server ID which is a string rather than an int. 

Call the get_servers method to find out your server ID

You can define to use version 1.0 or 1.1 of the api via

Example
=======

When an api call is made, the results are returned in JSON format. 
For more info on the API, read the official docs here - http://www.serverdensity.com/docs/api/usageguide/

1. Load the library
   
   $this->load->library('server_density_api');	

2. Make an API call
   
   For example to get physical memory for your server with an ID of 6 
   
   $memory = $this->server_density_api->get_physical_memory(6);

   $used_memory = $memory->metric->valueUsed;

   echo $used_memory;


Methods
=======

To call a method, use $this->server_density_api-> and then one of the methods below.

Alerts
Get latest alerts - get_latest_alerts();

Servers
Get servers - get_servers();
Get server details - get_server_details($server_id);
Get server stats - get_server_stats($server_id);

Load
Get server load - get_server_load($server_id);
Get server load range - get_server_load_range($server_id,$start_time,$end_time); 

Memory
Get physical memory - get_physical_memory($server_id);
Get physical memory range - get_physical_memory_range($server_id,$start_time,$end_time); 

Disk Usage
Get disk usage - get_disk_usage($server_id);
Get disk usage range - get_disk_usage_range($server_id,$start_time,$end_time);

Network traffic
Get network traffic - get_network_traffic($server_id);
Get network traffic range - get_networl_traffic_range($server_id,$start_time,$end_time);

MySQL
Get mysql status - get_mysql_status($server_id);
Get mysql status range - get_mysql_status_range($server_id,$start_time,$end_time);

Apache status
Get apache status - get_apache_status($server_id);
Get apache status range - get_apache_status_range($server_id,$start_time,$end_time);

v1.1 Only

Get latest metrics - get_metrics_latest($server_id,$metric_name);
Get metrics range - get_metrics_latest_range($server_id,$metric_name,$start_time,$end_time);
Metrics List - get_metrics_list($os);

codeigniter-serverdensity-api's People

Contributors

leonbarrett avatar

Stargazers

Sohail Ahmad Sohel avatar  avatar Alax Villmann avatar  avatar Tom Stoecklein avatar Anthony Herron avatar Stephen Schroeder avatar Ahmed Tohamy avatar

Watchers

 avatar 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.