Server Stats

From INAP Dropzone API
Revision as of 20:59, 9 April 2013 by Rwakeman (Talk | contribs)
Jump to: navigation, search

The server stats command returns performance stats for a server over a given time period.

Contents

Path

  • /server/stats/{$start}/{$end}/{$aggregatePeriod}/{$serverid}
  • /server/stats/{$start}/{$end}/{$serverid}
  • /server/stats/{$start}/{$serverid}
  • /server/stats/{$serverid}

Method

Availability

Required Data Parameters

  • {$serverid}: The server ID that is returned when using the list command.

Optional Data Parameters

  • {$aggregatePeriod}: The amount of time in seconds to use to "smooth" the returned data. Defaults to 600 (10 minutes) which is about how often stats are stored to the database and as such is the smallest time period available. Higher aggregatePeriod values will return less data points compared to the amount stored and the data points will contained averaged and cumulative values (depending on the nature of each stat) from the raw data it contains. Each returned data point has a 'ticks' field that contains the number of raw data points used to create the data.
  • {$end}: A unix timestamp of the end of the time period from which you want stats. Defaults to PHP's time(). If this is less than the {$start} time you will be returned an error.
  • {$start}: A unix timestamp of the start of the time period from which you want stats. Defaults to {$end} - 3600 (one hour before the {$end} value).

Returned Data

The data returned will be an associative array where each key is a unix timestamp and the value is the aggregated data for that time. Some pieces of data to note:

  • last_raw_stat contains all the raw data from the previous point.
  • interval_start is the timestamp for the beginning of the time period aggregated for the data point.
  • interval_end is the timestamp for the end of the time period aggregated for the data point.
  • interval_length is the difference between interval_end and interval_start
  • ticks is the number of raw data points from the database that were used to create the returned data point.
<?
Array
(
    [success] => 'true',
    [data] => Array
        (
            [1365537644] => Array
                (
                    [tick_ids] => Array
                        (
                            [0] => MongoId Object
                                (
                                    [$id] => 516475b6bb8d32b953001331
                                )

                        )

                    [format] => flat1
                    [aggregation] => raw
                    [server_id] => 212981
                    [agent] => dom0d
                    [revision] => 2.20
                    [hypervisor] => qemu
                    [hypervisor_version] => 0.14.1
                    [uptime] => 6634187.65
                    [ts] => MongoDate Object
                        (
                            [sec] => 1365538224
                            [usec] => 0
                        )

                    [load1] => 0
                    [load5] => 0.01
                    [load15] => 0.05
                    [memused] => 4675832
                    [memfree%] => 42.82
                    [swapused] => 5060
                    [swapfree%] => 99.87
                    [localused] => 19881256
                    [localfree%] => 95.89
                    [disk_ios_pending] => 0
                    [time_user] => 19
                    [time_nice] => 0
                    [time_system] => 5
                    [time_idle] => 4679
                    [time_iowait] => 0
                    [time_irq] => 0
                    [time_softirq] => 0
                    [time_steal] => 0
                    [time_guest] => 13
                    [disk_reads_completed] => 0
                    [disk_read_sectors] => 0
                    [disk_read_bytes] => 0
                    [disk_writes_completed] => 336
                    [disk_write_sectors] => 7488
                    [disk_write_bytes] => 3833856
                    [interface_public_rx_packets] => 107
                    [interface_private_rx_packets] => 5567
                    [interface_public_rx_bytes] => 19285
                    [interface_private_rx_bytes] => 679315
                    [interface_public_rx_errors] => 0
                    [interface_private_rx_errors] => 0
                    [interface_public_rx_drop] => 0
                    [interface_private_rx_drop] => 20
                    [interface_public_tx_packets] => 500
                    [interface_private_tx_packets] => 280
                    [interface_public_tx_bytes] => 36414
                    [interface_private_tx_bytes] => 71063
                    [interface_public_tx_errors] => 0
                    [interface_private_tx_errors] => 0
                    [interface_public_tx_drop] => 0
                    [interface_private_tx_drop] => 0
                    [interval_start] => 1365537644
                    [interval_end] => 1365538224
                    [interval_length] => 580
                    [ticks] => 1
                )

        )
)
Personal tools