def check(self, data=None, plugin=None, server=None):
        plugin_data = data.get('gauges', None)

        rules = alerts_model.get_alerts_for_plugin(plugin=plugin)

        if len(rules) > 0:
            for rule in rules:
                alert = plugin_alerts.check(data=plugin_data, rule=rule)

                if alert:
                    alerts_model.save_occurence(alert)


        # Global alerts
        rules = alerts_model.get_alerts(type='plugin_global')
        if len(rules) > 0:
            all_plugins = plugin_model.get_for_server(server_id=server['_id'])
            for rule in rules:
                valid_rule = self.check_tags(server=server, rule=rule)

                if valid_rule:
                    plugin_name = rule.get('plugin')
                    plugin_id = None

                    # Check if this server has a plugin with this name
                    for p in all_plugins.clone():
                        if p.get('name') == plugin_name:
                            plugin_id = p.get('_id')

                    if plugin_id:
                        alert = plugin_alerts.check(data=plugin_data, rule=rule)

                        if alert:
                            alerts_model.save_occurence(alert, server_id=server['_id'])