@@ -9,7 +9,7 @@ def get_realtime_stats(
99 ne_pk : str ,
1010 stat_type : str ,
1111 stat_name : str ,
12- stat_filter : str ,
12+ stat_filter : str = "" ,
1313) -> dict :
1414 """Get real time statistics from appliance based on query parameters
1515
@@ -23,65 +23,90 @@ def get_realtime_stats(
2323 - POST
2424 - /realtimeStats/{nePk}
2525
26- * Tunnel stats: Set ``stat_type`` to ``tunnel``. Set ``stat_name``
27- to one of the tunnel names or ``pass-through`` or
28- ``pass-through-unshaped``. ``stat_filter`` is not used for
29- tunnel statistics.
30- * TrafficType stats: Set the ``stat_type`` to ``trafficType`` to
31- retrieve two aggregate real-time stats: optimized, all-traffic.
32- For optimized, set ``stat_name`` to ``0`` and for all-traffic,
33- set ``stat_name`` to ``3``. ``stat_filter`` is not used.
34- * Application stats: Set ``stat_type`` to ``app``. Set ``stat_name``
35- to application name. ``stat_filter`` is required.
36- * DSCP stats: Set ``stat_type`` to ``dscp``, set name to one of DSCP
37- values from ``0`` to ``63``. ``stat_filter`` is required.
38- Possible ``stat_filter`` values are ``0`` for optimized_traffic,
39- ``1`` for pass_through_shaped, ``2`` for pass_through_unshaped,
40- and ``3`` for all_traffic
41- * MOS stats: Set ``stat_name`` to a tunnel id and set ``stat_type``
42- to ``tunnel``
43- * Traffic Class Stats: set ``stat_type`` to ``trafficClass``, set
44- ``stat_name`` to one of traffic classes from ``0`` to ``9``.
45- ``stat_filter`` is required.
46- * Flow stats: set ``stat_type`` to ``flow``, ``stat_name`` to ``0``
47- for TCP accelerated, ``1`` for TCP unaccelerated, and ``2`` for
48- non-TCP flows. ``stat_filter`` is required. Accepted values for
49- ``stat_filter`` values are ``0`` for optimized_traffic, ``1`` for
50- pass_through_shaped, ``2`` for pass_through_unshaped, and ``3``
51- for all_traffic
52- * Shaper stats: Set ``stat_type`` to ``shaper``. Set ``stat_name``
53- to one of traffic classes from ``0`` to ``9``. Use ``stat_filter``
54- to specify traffic direction: ``0`` for Outbound and ``1`` for
55- Inbound)
56- * Drops stats: Set ``stat_type`` to ``drops``. Set ``stat_name`` to
57- empty string.
58- * Interface stats: Set ``stat_type`` to ``interface``. Set
59- ``stat_name`` to interface name. Use ``stat_filter`` to filter
60- traffic type: ``0`` for optimized_traffic, ``1`` for
61- pass_through_shaped, ``2`` for pass_through_unshaped, and ``3``
62- for all_traffic
6326
6427 .. note::
65- Appliances store per second statistics for three seconds. You must
66- poll at a frequency faster than three seconds to make sure to not
67- have gaps in the results. The result format for all statistics
68- looks like: ``{'nameofstat': [time, value], [time,value],...}``
69- where you get statistics for last three seconds.
28+
29+ Appliances store per second statistics for only 3 seconds. You
30+ must poll at a frequency faster than 3 seconds to not have gaps
31+ in the results when trying to collect continious values.
32+
33+
34+ * For **Tunnel stats**: Set ``stat_type`` to ``tunnel`` and set
35+ ``stat_name`` to one of the tunnel names or ``pass-through`` or
36+ ``pass-through-unshaped``. ``stat_filter`` is not used for tunnel
37+ statistics.
38+
39+ * For **TrafficType stats**: Set the ``stat_type`` to
40+ ``trafficType`` to retrieve two aggregate real-time stats:
41+ optimized and all-traffic. For optimized, set ``stat_name`` to
42+ ``0`` and for all-traffic, set ``stat_name`` to ``3``.
43+ ``stat_filter`` is not used.
44+
45+ * For **Application stats**: Set ``stat_type`` to ``app``. Set
46+ ``stat_name`` to application name. ``stat_filter`` is required.
47+ Accepted values are ``0`` for optimized traffic, ``1`` for
48+ passthrough shaped, ``2`` for passthrough unshaped, and ``3`` for
49+ all traffic.
50+
51+ * For **DSCP stats**: Set ``stat_type`` to ``dscp``, set
52+ ``stat_name`` to one of DSCP values from ``0`` to ``63``.
53+ ``stat_filter`` is required. Accepted values are ``0`` for
54+ optimized traffic, ``1`` for passthrough shaped, ``2`` for
55+ passthrough unshaped, and ``3`` for all traffic.
56+
57+ * For **Traffic Class Stats**: set ``stat_type`` to 'trafficClass',
58+ set ``stat_name`` to one of traffic classes from ``0`` to ``9``.
59+ ``stat_filter`` is required. Accepted values are ``0`` for
60+ optimized traffic, ``1`` for passthrough shaped, ``2`` for
61+ passthrough unshaped, and ``3`` for all traffic.
62+
63+ * For **Flow stats**: set type to ``flow``, name to ``0`` for TCP
64+ accelerated, ``1`` for TCP unaccelerated and ``2`` for non-TCP
65+ flows. ``3`` for all traffic. ``stat_filter`` is required.
66+ Accepted values are ``0`` for optimized traffic, ``1`` for
67+ passthrough shaped, ``2`` for passthrough unshaped, and ``3``
68+ for all traffic.
69+
70+ * For **Shaper stats**: Set ``stat_type`` to ``shaper``. Set
71+ ``stat_name`` to one of traffic classes from ``0`` to ``9``.
72+ ``stat_filter`` to traffic direction, ``0`` for Outbound and ``1``
73+ for Inbound.
74+
75+ * For **Drops stats**: Set ``stat_type`` to ``drops``. Set
76+ ``stat_name`` to empty string
77+
78+ * For **Interface stats**: set type to ``interface``, and
79+ ``stat_name`` to interface name. Use ``stat_filter`` to filter
80+ traffic type, ``0`` for optimized traffic, ``1`` for
81+ passthrough shaped, ``2`` for passthrough unshaped, and ``3``
82+ for all traffic.
7083
7184 :param ne_pk: Network Primary Key (nePk) of appliance, e.g. ``3.NE``
7285 :type ne_pk: str
73- :param stat_type: Type of statistic to retreive, accepted values
74- include ``tunnel``, ``trafficType``, ``app``, ``flow``,
75- ``dscp``, ``trafficClass``, ``shaper``, and ``drops``
86+ :param stat_type: Category/Type of statistics to retrieve, accepted
87+ values included ``tunnel``, ``trafficType``, ``app``, ``flow``,
88+ ``dscp``, ``trafficClass``, ``shaper``, ``drops``, and
89+ ``interface``
7690 :type stat_type: str
7791 :param stat_name: Name of value to retrieve, accepted values
78- dependent on value of param ``type ``
92+ dependent on value of param ``stat_type ``
7993 :type stat_name: str
80- :param stat_filter: Filter results, accepted values are ``0``,
81- ``1``, ``2``, ``3``, functions dependent on value of param
82- ``type`` and ``name``
83- :type stat_filter: str
84- :return: Returns nested dictionary
94+ :param stat_filter: Required for certain stat types, accepted values
95+ are ``0``, ``1``, ``2``, ``3``, function of which is dependent
96+ on value of ``stat_type`` and ``stat_name``, defaults to ""
97+ :type stat_filter: str, optional
98+ :return: Dictionary of realtime stats for specified parameters \n
99+ * keyword **<name_of_stat>** (`list`): 3 second stat object,
100+ number of keys varies based on stat type queried \n
101+ * [`list`]: First second list of stat timestamp and value \n
102+ * [0] (`int`): Epoch timestamp in microseconds
103+ * [1] (`int`): Stat value, unit dependent on stat type
104+ * [`list`]: Second second list of stat timestamp and value \n
105+ * [0] (`int`): Epoch timestamp in microseconds
106+ * [1] (`int`): Stat value, unit dependent on stat type
107+ * [`list`]: Third second list of stat timestamp and value \n
108+ * [0] (`int`): Epoch timestamp in microseconds
109+ * [1] (`int`): Stat value, unit dependent on stat type
85110 :rtype: dict
86111 """
87112 data = {"type" : stat_type , "name" : stat_name , "filter" : stat_filter }
0 commit comments