NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `1111` `lsa` `ncnu` # Week 16 (2022/12/29) [TOC] - Book mode: https://hackmd.io/@ncnu-opensource/book --- # Monitor >監控 - 為甚麼需要監控網路設備呢? >因為網路發生異常會導致服務中斷,就會影響使用者的可用性 - 遠端監控設備就可以不受地區限制來排除問題 ## SNMP - 簡單網路管理協定(Simple Network Management Protocol: SNMP)自IETF(Internet Engineering Task Force)所定義 - 是一個進行蒐集和管理網路設備的協定 - 在 OSI 第七層應用程式層,並透過 UDP 161 port 進行請求 - 功能 - Monitor network performance - Audit network usage - Detect network fault - Detect inappropriate access - Configure remote device - 使用SNMP管理的網路主要由 3 個元件所組成 ![](https://i.imgur.com/RPJGvaf.png) 1. 網路管理系統 - network management system - 位安裝於管理端(manager)的軟體,用以向代理者查詢被管理裝置的相關資訊 - SNMP 管理器主要功能 - 查詢代理者 - 從代理者獲得回應 - 在代理者中設定變數 - 確認來自代理者的異常事件 2. 被管理裝置 - Managed Device - 指網路中被監控的設備節點 - 例如: 路由器、交換器、伺服器、印表機、NAS、防火牆、WLAN控制器 3. 代理者 - agent - 為安裝於被管理裝置的軟體,負責監控及回傳被監控設備的相關資訊 - SNMP 代理程式能主要功能 - 收集有關其本地環境的管理資訊 - 儲存和擷取 MIB 中定義的管理資訊 - 向管理器傳送事件 - 充當一些非SNMP可管理網路節點的proxy - 每個 SNMP Agent 都有一個描述受控裝置參數資訊資料庫,SNMP Agent 是以便述方式呈現被管理裝置的相關資訊,每個變數皆有其唯一的物件識別碼(Objrct Identifier;OID),而 OID 是以階層方式被描述於管理資訊庫(Management Information Base;MIB) 而 OID 是以階層(NMS) - SNMP的管理系統(NMS)會使用這個設備參數的資料庫。向Agent請求設備的資訊並根據NMS的需求,轉換資訊。而管理器跟Proxy之間共同使用的資料庫就是MIB。 :::info ## MIB架構 - 以樹狀結構,包含物件辨別碼(OID) - 每一個 OID 都是唯一的識別碼 > 例如OID為1.3.6.1.4.1.9代表Cisco 公司 - 樹狀最頂端的OID可以取得最多的狀態資訊 ![](https://i.imgur.com/wpYedmL.png) >[圖片來源](https://www.researchgate.net/figure/Example-of-an-OID-tree-structure-Leskiw-2017_fig17_320865749) ::: ## SNMP 指令 - 從 NMS 可以透過 SNMP 協定 - GET - 從網路管理系統向設備傳送,可讀取設備上的數值 - GET NEXT - 取得MIB tree 下一個OID 值 - GET BULK - 從MIB中取得大量資料 - SET - 管理員可修改或設定設備的數值 >遠端設定一直 SSH 進來的人 - TRAPS - Agent 對SNMP管理系統發出的事件指令 >讓系統主動發送警告 - INFORM - SNMP 管理系統接收指令後回傳確認 - RESPONSE - 回傳 SNMP 網路管理系統執行的值或訊號 ## SNMP 原理 ![](https://i.imgur.com/AmBXCuX.png) >[圖片來源](https://www.cc.ntu.edu.tw/chinese/epaper/0047/20181220_4707.html) - 管理端經由UDP傳送request至代理者(port161),代理者透過來源端傳送 response至管理端 - 當被監控設備發現異常時,代理者可以由UDP主動傳送notif - 管理端一方面可經由 GetGetNext 或GetBulk 指令向代理者撷取被監控設備的相關資訊,另一 方面亦可透過代理者經由 Trap 或Inform 指令主動傳送資料,此外,管理端使用 Set 指令以達到 系統管理之目的。 ## DEMO - 查看有被監控的裝置 `sudo vim snmpsd.conf` ## Cacti - 即時監控 - 基於web的開源網路監視和繪圖工具。使用SNMP ## Nagious - 即時監控 ## Grafana - 圖形化顯示 - 支援多種資料庫 - 特色 - 長期分析製圖 - 容易上手 - 較多外掛插件,可朔性高 ## Prometheus - 長期分析 - 以時間時序為主的多為杜資料模型,以 Metric 資料名稱與 key/values 來呈現 - 透過 PromQL 查詢語言,取得時序資料 - 大部分用來抓資料、做成資料庫 - 透過 HTTP 協定 pull 模式蒐集時序資料 - 支援多種圖形與儀表板 - 除了 SNAP 預設的監督資源外也可以自訂監測項目,也可以收集/var/log內容作成資料庫 > SSH 登入次數、server error log......

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully