Get monitor data of the instance. If instance name is
    missing, will show all the instance monitor data on the region.

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f list_monitor_data aliyun
        salt-cloud -f list_monitor_data aliyun name=AY14051311071990225bd

def list_monitor_data(kwargs=None, call=None):
    '''
    Get monitor data of the instance. If instance name is
    missing, will show all the instance monitor data on the region.

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f list_monitor_data aliyun
        salt-cloud -f list_monitor_data aliyun name=AY14051311071990225bd
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_monitor_data must be called with -f or --function.'
        )

    if not isinstance(kwargs, dict):
        kwargs = {}

    ret = {}
    params = {
        'Action': 'GetMonitorData',
        'RegionId': get_location()
    }
    if 'name' in kwargs:
        params['InstanceId'] = kwargs['name']

    items = query(params=params)

    monitorData = items['MonitorData']

    for data in monitorData['InstanceMonitorData']:
        ret[data['InstanceId']] = {}
        for item in data:
            ret[data['InstanceId']][item] = six.text_type(data[item])

    return ret