StoreDocumentationSpecialsLatest PostsContactOther Stuff
Last Update: Jan 24th, 2019
Php

ET/BWMGR PHP API

The ET/BWMGR v5.0 user interface is built with php 5.3, and offers unprecedented flexibility in developing user applications that can interface with the Bandwidth Management Subsystems.

The bwmgr class provides a complete interface to all information in the driver. You can get settings, rules and stats and you can also change settings and create rules.

$bwmgr = new bwmgr();
$status=$bwmgr->status();
print_r($status)

stdClass Object
(
[version] => 5.2
[build] => 022
[bwmgr_running] => 1
[module_time] => 1451081059
[unburst] => 10
[track_all] => 1
[dns_count] => 0
[small_pkt_pri] => 0
[stats_period] => 5
[max_streams] => 50000
[hi_streams] => 1
[mem_used] => 4679536
[streams_in_use] => 0
[max_buffers] => 15000
[bufs_in_use] => 0
[high_bufs] => 0
[alerts_pending] => 0
[count_headers] => 0
[appliance_type] => R2400HL
[hyperthreading] => 1
[license] => 1408781910
[license_limit] => 1000
[expires] => 1451344400
[key_interface] => igb0
[sniffing] => enabled
[urlparams] => enabled
[boottime] => 1451125437
[cpu] => Intel(R) Xeon(R) CPU E3-1276 v3 @ 3.60GHz
)

With the API, you can easily add rules from a PHP application, without having to call a clunky CLI.

$args->ifname='em0';
$args->x = 100;
$args->name = 'AcmeCorp';
$args->bwprofile='Default''
$bwmgr->addrule($args);

Getting real-time statistics is always a challenge for user-level applications, but our API makes it easy.

$args->name="http";
$ret=$bwmgr->getstats($args);
print_r($ret);

stdClass Object
(
[protocol] => http
[stats] => stdClass Object
(
[cur_rx_bytes] => 48579
[cur_tx_bytes] => 165403
[cur_rx_packets] => 232
[cur_tx_packets] => 172
[cur_drops] => 0
[cur_seconds] => 2
[period] => 20
[tot_rx_bytes] => 113064518
[tot_tx_bytes] => 420473856
[tot_rx_packets] => 514614
[tot_tx_packets] => 473215
[tot_drops] => 0
[last_rx_bytes] => 45228
[last_tx_bytes] => 289216
[last_rx_packets] => 285
[last_tx_packets] => 275
[lastdrops] => 0
[bps] => stdClass Object
(
[bps_in] => 27752
[bps_out] => 94512
)

)

[cmd] => getstats
)

the name parameter can be any protocol, tag or rule. You can also specify an ifname (interface name) and index for rules that don't have names.

Event API

The Monitor generates events which can used by applications to generate actions. Events are generated every 5 seconds and can be pulled with the getMonitorEvents() function:

$events = getMonitorEvents();
print_r($events->events);

(
[0] => Array
(
[timestamp] => 1451178422
[event] => HOST
[sport] => 0
[dport] => 0
[ip] => 17.1.1.32
[ip_dns] =>
[dst_ip] =>
[dst_dns] =>
[mac] => e8:ea:6a:06:1c:26
[hostname] =>
[dnsreq] =>
[agent] =>
[url] =>
[org] => Apple Inc.
[country] => US
[city] => Cupertino
)

[1] => Array
(
[timestamp] => 1451178422
[event] => HOST
[sport] => 0
[dport] => 0
[ip] => 17.1.1.30
[ip_dns] =>
[dst_ip] =>
[dst_dns] =>
[mac] => 00:e0:ed:1f:80:20
[hostname] =>
[dnsreq] =>
[agent] =>
[url] =>
[org] => Apple Inc.
[country] => US
[city] => Cupertino
)

)

The above example shows a new host discovery; the event includes the organization, Country and City from the database and the DNS if available. If a new DNS request is pending, a separate event will be generate when it is resolved.

Writing Applications

You can create "commands" by writing programs with the cli interface, or create web-based utilities

API Reference

Comment Policy Add Comment

Next: Frame Relay FAQ