Difference between revisions of "CHAOS"

From AAISP Support Site
Jump to: navigation, search
[unchecked revision][quality revision]
m
m (Getting CQM Graphs)
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
CHAOS is our API - it's still work in progress, and further features will be added. We'll add to this section of the wiki with examples.
+
'''CHAOS''' is our API - it's still work in progress, and further features will be added.
  
==Getting CQM Graphs==
+
==CHAOS Version 1==
  
This is a quick example of getting cqm graphs from CHAOS.
+
'''Disabled'''
  
In short, the Info command is used to get the graph URLs. The HTML provides a form to enter the credentials or you can edit the javascript to hardcode these.
+
Version 1 is no longer available for use. Use version 2 instead.
  
CHAOS is currently limited to only showing DSL graphs (eg, not SIMs) and only for lines on the login, ie a 'Manager' or 'Group' login.
+
==CHAOS Version 2.x==
  
HTML:
+
CHAOS is an application interface (API) for machine to machine interaction with our control and ordering systems. It provides a means to perform the following key operations:-
<source lang=html5>
+
*Access information about an existing service, eg your remaining quota
<!DOCTYPE html>
+
*Adjust settings on an existing service
  <head lang='en'>
+
*Obtain usage data relating to an existing service
    <title>Graphs</title>
+
*Obtain sync rates of a DSL line
    <script type="text/javascript" src="jquery-1.8.3.min.js"></script>
+
*Obtain VoIP call rate card
    <script src='chaosgraphs.js'></script>
+
*Order a cease of an existing service
  </head>
+
*Order a change to an existing service
  <body>
+
*Check availability of new services
    <form id='login'>
+
*Order a new service, including creating a new account
      <input type='text' name='username' placeholder='username' autofocus />
+
*etc.
      <input type='password' name='password' placeholder='password' />
 
      <input type='submit' value='Login' />
 
    </form>
 
    <hr />
 
    <div id='results'></div>
 
  </body>
 
</html>
 
</source>
 
  
Javascript (chaosgraphs.js), you'll also need jquery:
+
The control systems cover a wide range of services, including broadband, ethernet, telephony, domains, email, mobile SIMs, and so on.  
  
<source lang=javascript>
+
Whilst CHAOS may initially not provide access to all of these services, it is intended to be a general platform that can be extended over time to provide a comprehensive machine to machine interface to all of our services.
//Function to get service data from chaos using the "info" command
 
function getgraphs(username,password)
 
{
 
  $("#results").html("<p><img src='images/loading-small.gif' alt='Loading' /></p>"); //Show a loading image while wai
 
ting for chaos
 
  if(!username) { var username = $("input[type='text'][name='username']").val(); }
 
  if(!password) { var password = $("input[type='password'][name='password']").val(); }
 
  //AJAX request for "info" command
 
  $.ajax({
 
    type: "POST",
 
    url: "https://chaos.aa.net.uk/info",
 
    xhrFields: { withCredentials: true },
 
    contentType: 'application/json',
 
    data: JSON.stringify({username:username,password:password}),
 
    success: function(data) {
 
      var chaos = data;
 
      var html = "";
 
      console.log(chaos);
 
      if(chaos.error != undefined) {
 
        //If there is an error display it
 
        html+="<p class='error'>"+chaos.error+"</p>";
 
      }
 
      else {
 
        //If there is no error, loop through the response and create graphs
 
        for(var i = 0; i < chaos.login.length; i++) {
 
          if(chaos.login[i].broadband_count != 0) {
 
            for(var j = 0; j < chaos.login[i].broadband.length; j++) {
 
              var bb = chaos.login[i].broadband[j];
 
              html+=bb.circuit+"<br />";
 
              html+="<img src='"+bb.cqm_png.replace(/http:/g,"https:")+"' alt='CQM graph "+j+"' /><hr />";
 
            }
 
          }
 
          else { html+="No lines"; }
 
        }
 
      }
 
      $("#results").html(html);
 
      //Put the results into a div
 
    }
 
  });
 
}
 
  
$(document).ready(function() {
+
===Further Information===
  //Run the getgraphs() function when the form is submitted
+
Manual: http://aa.net.uk/pdf/CHAOS2.pdf
  $("#login").submit(function(e) {
+
 
    e.preventDefault();
+
==Uses==
    getgraphs();
+
Here are some projects that are using the CHAOS API:
    //Or you could run getgraphs with a static username and password e.g.
+
*'''Munin Plugin by Nat Morris'''
    //getgraphs('myusername','mypassword');
+
**[https://github.com/natm/munin-plugins-aaisp Code on Github], [https://munin.hw.esgob.com/broadband-day.html Example]
  });
+
**Just need to provide one account & password, it will automatically graph multiple lines and produce combined graphs etc.
});
+
*'''MQTT Service by Nat Morris'''
</source>
+
**[https://github.com/natm/aaisp-to-mqtt Code on Github]
 +
** Publish circuit statistics to an [https://en.wikipedia.org/wiki/MQTT MQTT] broker, makes it very easy to integrate with home automation projects such as [https://home-assistant.io/ Home Assistant] and [http://www.openhab.org/ openHAB].
 +
 
 +
 
 +
[[Category:Control Pages]]

Latest revision as of 12:10, 22 August 2019

CHAOS is our API - it's still work in progress, and further features will be added.

CHAOS Version 1

Disabled

Version 1 is no longer available for use. Use version 2 instead.

CHAOS Version 2.x

CHAOS is an application interface (API) for machine to machine interaction with our control and ordering systems. It provides a means to perform the following key operations:-

  • Access information about an existing service, eg your remaining quota
  • Adjust settings on an existing service
  • Obtain usage data relating to an existing service
  • Obtain sync rates of a DSL line
  • Obtain VoIP call rate card
  • Order a cease of an existing service
  • Order a change to an existing service
  • Check availability of new services
  • Order a new service, including creating a new account
  • etc.

The control systems cover a wide range of services, including broadband, ethernet, telephony, domains, email, mobile SIMs, and so on.

Whilst CHAOS may initially not provide access to all of these services, it is intended to be a general platform that can be extended over time to provide a comprehensive machine to machine interface to all of our services.

Further Information

Manual: http://aa.net.uk/pdf/CHAOS2.pdf

Uses

Here are some projects that are using the CHAOS API:

  • Munin Plugin by Nat Morris
    • Code on Github, Example
    • Just need to provide one account & password, it will automatically graph multiple lines and produce combined graphs etc.
  • MQTT Service by Nat Morris