Skip to main content

Гібридний підхід до виявлення аномалій у мережевій інфраструктурі на основі порогових правил та алгоритму Isolation Forest (скорочено)

Анотація:
У даній статті розглядається ефективний підхід до моніторингу мережевої інфраструктури через Grusher, що поєднує детерміновані порогові правила (threshold-based detection) та методи машинного навчання, зокрема алгоритм Isolation Forest. Запропонована архітектура дозволяє не лише фіксувати критичні збої, але й виявляти ранні ознаки деградації обладнання. Особлива увага приділяється процесу підготовки ознак, стратегії навчання моделей та мінімізації хибних спрацювань.

Вступ
Сучасні мережеві системи потребують не лише реактивного моніторингу, але й проактивного виявлення потенційних збоїв. Традиційні системи, засновані виключно на статичних порогах, не здатні виявляти поступову деградацію або нетипові відхилення, що залишаються в межах допустимих значень. Це зумовлює необхідність інтеграції методів машинного навчання для аналізу поведінкових патернів.

Архітектура системи

Запропонована система базується на двоступеневій моделі аналізу:

  • Детермінований рівень (Threshold-based detection)
    Цей рівень відповідає за виявлення критичних станів на основі заздалегідь визначених правил. Наприклад, падіння напруги нижче встановленого рівня інтерпретується як аварійна ситуація. Основна перевага швидкість і однозначність реакції.
  • Імовірнісний рівень (Machine Learning)
    Алгоритм Isolation Forest використовується для виявлення аномалій, що не виходять за межі порогових значень, але відрізняються від історично нормальної поведінки. Це дозволяє виявляти приховані проблеми, такі як поступове зниження оптичної потужності або нестандартні температурні профілі.

Для підвищення точності моделі використовуються такі типи ознак:

  • Абсолютні значення: температура, напруга, RX/TX потужність та ін.
  • Динамічні характеристики: відхилення від ковзного (зміюючого) середнього (delta)
  • Стабілізаційний шум: додавання незначного випадкового значення для уникнення вироджених випадків

Такий підхід дозволяє моделі враховувати як поточний стан, так і динаміку змін.

Навчання здійснюється індивідуально для кожного пристрою або метрики. Це дозволяє врахувати специфіку експлуатаційних умов.

  • Використовується вибірка з 1000-2000 останніх записів
  • Застосовується offline learning модель щоразу перенавчається з нуля
  • Попередня модель повністю замінюється новою

Для підвищення якості навчання пропонується:

  • виключати останні 12-24 години даних (training lag)
  • використовувати лише записи зі статусом «норма»
  • уникати навчання під час активних збоїв

Виявлення аномалій (Inference)

Процес аналізу включає:

  1. Отримання останніх значень метрик
  2. Розрахунок відхилень від історичних середніх
  3. Оцінку аномальності за допомогою моделі
  4. Інтерпретацію результату через експертні правила (Predictors)

Таким чином, система не лише визначає факт аномалії, але й надає пояснення, наприклад: «різке падіння RX при зростанні bias ймовірна деградація лазера».

Зменшення хибних спрацювань

Для мінімізації false positives застосовуються:

  • окремі моделі для кожного пристрою
  • комбінування ML-рішень з експертною логікою
  • розділення рівнів сповіщень:
    • критичні (threshold) миттєві алерти
    • аналітичні (ML) для планового обслуговування

Практичні аспекти впровадження

Рекомендована частота навчання:

  • SFP-модулі: раз на тиждень
  • ONU: раз на 3-7 днів
  • системні метрики: щоденно

Аналіз даних в ідеальних умовах повинен виконуватись регулярно (кожні 5-10 хвилин). Однак на завжди це реально впровадити в сили багатьох обмежень.

Спосіб запуску навчання та аналізу через CLI

sudo -u www-data php artisan ml:analyze-metrics
sudo -u www-data php artisan ml:analyze-onu
sudo -u www-data php artisan ml:analyze-sfp

sudo -u www-data php artisan ml:train-metrics
sudo -u www-data php artisan ml:train-onu
sudo -u www-data php artisan ml:train-sfp

Висновки

Поєднання детермінованих правил та алгоритмів машинного навчання забезпечує високий рівень надійності систем моніторингу. Запропонований підхід дозволяє:

  • виявляти аномалії на ранніх стадіях
  • прогнозувати можливі збої
  • зменшувати кількість хибних спрацювань
  • оптимізувати процес технічного обслуговування

Використання затримки навчання (training lag) додатково підвищує стійкість моделі до деградаційних процесів та запобігає адаптації до аварійних станів.

 

Translated via Google

A hybrid approach to anomaly detection in network infrastructure based on threshold rules and the Isolation Forest algorithm (short article)

Abstract:
This article discusses an effective approach to monitoring network infrastructure through Grusher, which combines deterministic threshold-based detection and machine learning methods, in particular the Isolation Forest algorithm. The proposed architecture allows not only to record critical failures, but also to detect early signs of equipment degradation. Special attention is paid to the process of feature training, model training strategy, and minimizing false positives.

Introduction
Modern network systems require not only reactive monitoring, but also proactive detection of potential failures. Traditional systems based solely on static thresholds are unable to detect gradual degradation or atypical deviations that remain within acceptable values. This necessitates the integration of machine learning methods for analyzing behavioral patterns.

System Architecture

The proposed system is based on a two-stage analysis model:

  • Deterministic level (Threshold-based detection)
    This level is responsible for detecting critical states based on predefined rules. For example, a voltage drop below a set level is interpreted as an emergency. The main advantage is the speed and unambiguousness of the response.
  • Probabilistic level (Machine Learning)
    The Isolation Forest algorithm is used to detect anomalies that do not exceed the threshold values, but differ from historically normal behavior. This allows you to detect hidden problems, such as a gradual decrease in optical power or non-standard temperature profiles.

The following types of features are used to increase the accuracy of the model:

  • Absolute values: temperature, voltage, RX/TX power, etc.
  • Dynamic characteristics: deviation from the moving average (delta)
  • Stabilization noise: adding a small random value to avoid degenerate cases

This approach allows the model to take into account both the current state and the dynamics of changes.

Training is carried out individually for each device or metric. This allows you to take into account the specifics of operating conditions.

  • A sample of the last 1000-2000 records is used
  • Offline learning is used – the model is retrained from scratch each time
  • The previous model is completely replaced by a new one

To improve the quality of training, it is suggested to:

  • exclude the last 12-24 hours of data (training lag)
  • use only records with the status “normal”
  • avoid training during active failures

Detection of anomalies (Inference)

The analysis process includes:

  • Obtaining the latest metric values
  • Calculating deviations from historical averages
  • Estimating the anomaly using the model
  • Interpreting the result through expert rules (Predictors)

Thus, the system not only determines the fact of the anomaly, but also provides an explanation, for example: “a sharp drop in RX with increasing bias is a probable laser degradation.”

Reducing false positives

To minimize false positives, the following are used:

  • separate models for each device
  • combining ML solutions with expert logic
  • separation of notification levels:
    • critical (threshold) – instant alerts
    • analytical (ML) – for scheduled maintenance

Practical aspects of implementation

  • SFP modules: once a week
  • ONU: once every 3-7 days
  • system metrics: daily

Data analysis under ideal conditions should be performed regularly (every 5-10 minutes). However, this is not always realistic to implement due to many limitations.

Method of launching training and analysis via CLI

sudo -u www-data php artisan ml:analyze-metrics
sudo -u www-data php artisan ml:analyze-onu
sudo -u www-data php artisan ml:analyze-sfp

sudo -u www-data php artisan ml:train-metrics
sudo -u www-data php artisan ml:train-onu
sudo -u www-data php artisan ml:train-sfp

Conclusions

The combination of deterministic rules and machine learning algorithms provides a high level of reliability of monitoring systems. The proposed approach allows:

  • to detect anomalies at early stages
  • to predict possible failures
  • to reduce the number of false positives
  • to optimize the maintenance process

The use of a training lag further increases the model's resistance to degradation processes and prevents adaptation to emergency conditions.