@@ -1793,3 +1793,60 @@ def modify_loadbalancer_backend_attributes(self, loadbalancer_backend,
17931793 self .req_checker .check_lb_backend_weight (body ['weight' ])
17941794
17951795 return self .send_request (action , body )
1796+
1797+ def get_monitoring_data (self , resource ,
1798+ meters ,
1799+ step ,
1800+ start_time ,
1801+ end_time ,
1802+ ** ignore ):
1803+ """ Get resource monitoring data.
1804+
1805+ @param resource: the ID of resource, can be instance_id, volume_id, eip_id or router_id.
1806+ @param meters: list of metering types you want to get.
1807+ If resource is instance, meter can be "cpu", "disk-os", "memory",
1808+ "'disk-%s' % attached_volume_id", "'if-%s' % vxnet_mac_address".
1809+ If resource is volume, meter should be "'disk-%s' % volume_id".
1810+ If resource is eip, meter should be "traffic".
1811+ If resource is router, meter should be "vxnet-0".
1812+ @param step: The metering time step, valid steps: "5m", "15m", "30m", "1h", "2h", "1d".
1813+ @param start_time: the starting time stamp. In the format YYYY-MM-DDThh:mm:ssZ.
1814+ @param end_time: the ending time stamp. In the format YYYY-MM-DDThh:mm:ssZ.
1815+ """
1816+ action = const .ACTION_GET_MONITOR
1817+ valid_keys = ['resource' , 'meters' , 'step' , 'start_time' , 'end_time' ]
1818+ body = filter_out_none (locals (), valid_keys )
1819+ if not self .req_checker .check_params (body ,
1820+ required_params = ['resource' , 'meters' , 'step' , 'start_time' , 'end_time' ],
1821+ integer_params = [],
1822+ list_params = ['meters' ]
1823+ ):
1824+ return None
1825+
1826+ return self .send_request (action , body )
1827+
1828+ def get_loadbalancer_monitoring_data (self , resource ,
1829+ meters ,
1830+ step ,
1831+ start_time ,
1832+ end_time ,
1833+ ** ignore ):
1834+ """ Get load balancer monitoring data.
1835+
1836+ @param resource: the ID of resource, can be loadbalancer_id, listener_id or backend_id.
1837+ @param meters: list of metering types you want to get, valid values: request, traffic.
1838+ @param step: The metering time step, valid steps: "5m", "15m", "30m", "1h", "2h", "1d".
1839+ @param start_time: the starting time stamp. In the format YYYY-MM-DDThh:mm:ssZ.
1840+ @param end_time: the ending time stamp. In the format YYYY-MM-DDThh:mm:ssZ.
1841+ """
1842+ action = const .ACTION_GET_LOADBALANCER_MONITOR
1843+ valid_keys = ['resource' , 'meters' , 'step' , 'start_time' , 'end_time' ]
1844+ body = filter_out_none (locals (), valid_keys )
1845+ if not self .req_checker .check_params (body ,
1846+ required_params = ['resource' , 'meters' , 'step' , 'start_time' , 'end_time' ],
1847+ integer_params = [],
1848+ list_params = ['meters' ]
1849+ ):
1850+ return None
1851+
1852+ return self .send_request (action , body )
0 commit comments