# vfhky/serv00_ct8_nezha architecture

> Architecture diagram of the GitHub repository vfhky/serv00_ct8_nezha, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vfhky/serv00_ct8_nezha
- Repository: https://github.com/vfhky/serv00_ct8_nezha

## Overview

##### Main System Components

a) Core Components:
- Nezha Monitoring System
- Dashboard Component
- Agent Component
- Host Management System
- Multi-Host Heartbeat System
- Process Monitor
- Backup System
- Notification System

##### Key Relationships to Highlight

a) Host Communication:
**Host A ⟷ Host B (SSH-based heartbeat)**

b) Monitoring Flow:
**Nezha Agent → Nezha Dashboard → Database**

c) Process Monitoring:
**Process Monitor → Monitored Processes**
**Process Monitor → Notification Systems**

d) Backup Flow:
**Dashboard DB → Cloud Storage Services**

##### Technical Details

- Port specifications (22 for SSH)
- Process monitoring paths
- Crontab scheduling indicators
- Database backup paths

##### The configuration-driven architecture

Keep the abstraction level focused on system interaction while maintaining enough detail to show the unique aspects of this monitoring solution, particularly the host-to-host heartbeat system and the process monitoring capabilities.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef host fill:#f9f,stroke:#333,stroke-width:2px
    classDef monitor fill:#9cf,stroke:#333,stroke-width:2px
    classDef backup fill:#ff9,stroke:#333,stroke-width:2px
    classDef notify fill:#f99,stroke:#333,stroke-width:2px
    classDef config fill:#ddd,stroke:#333,stroke-width:2px
    classDef util fill:#cfc,stroke:#333,stroke-width:2px

    subgraph Hosts["Host Layer"]
        Host1["Host: serv00"]:::host
        Host2["Host: ct8"]:::host
        Host3["Host: Other Hosts"]:::host
    end

    subgraph MonitoringSystem["Monitoring Layer"]
        NezhaD["Nezha Dashboard"]:::monitor
        NezhaA["Nezha Agent"]:::monitor
        ProcMon["Process Monitor"]:::monitor
        HeartBeat["Heartbeat System"]:::monitor
    end

    subgraph BackupSystem["Backup Layer"]
        QiniuS["Qiniu Storage"]:::backup
        TencentCOS["Tencent COS"]:::backup
        AliOSS["Ali OSS"]:::backup
    end

    subgraph NotifySystem["Notification Layer"]
        WeChatBot["WeChat Work Bot"]:::notify
        WeChatApp["WeChat Work App"]:::notify
        Telegram["Telegram"]:::notify
        PushPlus["PushPlus"]:::notify
    end

    subgraph Config["Configuration"]
        HostConf["Host Config"]:::config
        HeartConf["Heartbeat Config"]:::config
        MonitorConf["Monitor Config"]:::config
        SysConf["System Config"]:::config
    end

    subgraph Utils["Utilities"]
        Logger["Logger"]:::util
        PyUtils["Python Utils"]:::util
        ShUtils["Shell Utils"]:::util
    end

    %% Connections
    Host1 <--> Host2
    Host2 <--> Host3
    Host3 <--> Host1

    NezhaA --> NezhaD
    HeartBeat --> Host1
    HeartBeat --> Host2
    HeartBeat --> Host3
    ProcMon --> NezhaD

    NezhaD -.-> QiniuS
    NezhaD -.-> TencentCOS
    NezhaD -.-> AliOSS

    ProcMon --> WeChatBot
    ProcMon --> WeChatApp
    ProcMon --> Telegram
    ProcMon --> PushPlus

    HostConf --> HeartBeat
    HeartConf --> HeartBeat
    MonitorConf --> ProcMon
    SysConf --> NezhaD

    %% Click Events
    click NezhaD "https://github.com/vfhky/serv00_ct8_nezha/blob/main/download_nezha.sh"
    click NezhaA "https://github.com/vfhky/serv00_ct8_nezha/blob/main/download_nezha_v1.sh"
    click HeartBeat "https://github.com/vfhky/serv00_ct8_nezha/blob/main/heart_beat_entry.sh"
    click ProcMon "https://github.com/vfhky/serv00_ct8_nezha/blob/main/process_monitor.sh"
    click QiniuS "https://github.com/vfhky/serv00_ct8_nezha/blob/main/qiniu_backup.py"
    click TencentCOS "https://github.com/vfhky/serv00_ct8_nezha/blob/main/qcloud_cos_backup.py"
    click AliOSS "https://github.com/vfhky/serv00_ct8_nezha/blob/main/ali_oss_backup.py"
    click WeChatBot "https://github.com/vfhky/serv00_ct8_nezha/blob/main/qywx_notify.py"
    click WeChatApp "https://github.com/vfhky/serv00_ct8_nezha/blob/main/qywx_app_notify.py"
    click Telegram "https://github.com/vfhky/serv00_ct8_nezha/blob/main/tg_notify.py"
    click PushPlus "https://github.com/vfhky/serv00_ct8_nezha/blob/main/pushplus_notify.py"
    click HostConf "https://github.com/vfhky/serv00_ct8_nezha/blob/main/config/host.eg"
    click HeartConf "https://github.com/vfhky/serv00_ct8_nezha/blob/main/config/heartbeat.eg"
    click MonitorConf "https://github.com/vfhky/serv00_ct8_nezha/blob/main/config/monitor.eg"
    click SysConf "https://github.com/vfhky/serv00_ct8_nezha/blob/main/config/sys.eg"
    click Logger "https://github.com/vfhky/serv00_ct8_nezha/blob/main/logger_wrapper.py"
    click PyUtils "https://github.com/vfhky/serv00_ct8_nezha/blob/main/utils.py"
    click ShUtils "https://github.com/vfhky/serv00_ct8_nezha/blob/main/utils.sh"

    %% Legend
    subgraph Legend
        H["Host"]:::host
        M["Monitor"]:::monitor
        B["Backup"]:::backup
        N["Notify"]:::notify
        C["Config"]:::config
        U["Utility"]:::util
    end
```
