defaults = {
    'apt': {
        'packages': {
            'vnstat': {},
            'vnstati': {},
        },
    },
    'icinga2_api': {
        'vnstat': {
            'services': {
                'VNSTATD PROCESS': {
                    'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C vnstatd -c 1:',
                },
            },
        },
    },
    'nginx': {
        'vhosts': {
            'vnstat': {},
        },
    },
    'systemd-timers': {
        'timers': {
            'vnstat-generate-vnstati': {
                'when': '*:0/10',
                'command': '/usr/local/bin/generate-vnstati',
            },
        },
    },
    'vnstat': {
        'bandwidth': '1000',
    },
}


@metadata_reactor.provides(
    'vnstat/interface',
)
def get_default_interface(metadata):
    interfaces = sorted(metadata.get('interfaces', {}).keys())

    if interfaces:
        return {
            'vnstat': {
                'interface': interfaces[0],
            },
        }

    return {}
