Skip to content

Instantly share code, notes, and snippets.

@jocoonopa
Last active March 22, 2016 02:10
Show Gist options
  • Save jocoonopa/eb2fd33a18b4c63cf79c to your computer and use it in GitHub Desktop.
Save jocoonopa/eb2fd33a18b4c63cf79c to your computer and use it in GitHub Desktop.

DB Schema

{
    "Node":  {
        "des": "欲檢查之節點",
        "schema": {
            "id": {
                "type": "INT[primaryKey]", 
                "des": "索引", 
                "default": "autoincrement", 
                "example": "1"
            },
            "name": {
                "type": "TEXT", 
                "des": "節點名稱", 
                "default": "NOT ALLOW NULL", 
                "example": "Mail Server"
            },
            "port": {
                "type": "INT[foreign_key][cascade]",
                "des": "埠號",
                "example": "80"
            }
            "group_id": {
                "type": "INT[foreign_key][cascade]", 
                "des": "隸屬群組之索引", 
                "default": "NOT ALLOW NULL", 
                "example": "內勤同仁"
            },
            "l_ip": {
                "type": "string", 
                "des": "內網ip,
                    Class A:10.0.0.0    - 10.255.255.255
                    Class B:172.16.0.0  - 172.31.255.255
                    Class C:192.168.0.0 - 192.168.255.255
                ", 
                "default": "NULL", 
                "example": "最簡單的如 192.168.100.246,亦可輸入遮罩 192.168.100.1/26,系統會檢查 192.168.100.193 ~ 192.168.100.254之每個節點(去頭去尾)"
            },
            "o_ip": {
                "type": "string", 
                "des": "外網ip", 
                "default": "NULL", 
                "example": "219.87.132.162"
            },
            "domain_name": {
                "type": "string",
                "des": "網址",
                "default": "NULL",
                "example": "chinghwa.com.tw"
            },
            "is_icmp": {
                "type": "INT", 
                "des": "ICMP 是否有開啟[1: 開啟, 0:關閉]", 
                "default": "1", 
                "example": "1"
            },
            "des": {
                "type": "text", 
                "des": "節點介紹說明", 
                "default": "NULL", 
                "example": "192.168.100.17 是官網的內部 ip,對外為 219.87.131.170,從 80 PORT Forward 進來"
            }
        }
    },

    "NodeGroup": {
        "id": {
            "type": "INT[primaryKey]", 
            "des": "索引", 
            "default": "autoincrement", 
            "example": "1"
        },
        "name": {
            "type": "TEXT", 
            "des": "節點群組名稱", 
            "default": "NOT ALLOW NULL", 
            "example": "內勤同仁"
        },
        "des": {
            "type": "TEXT", 
            "des": "節點群組介紹說明", 
            "default": "NULL", 
            "example": "內勤同仁的ip"
        }
    },

    "Job": {
        "id": {
            "type": "INT[primaryKey]", 
            "des": "索引", 
            "default": "autoincrement", 
            "example": "1"
        },
        "cron": {"des" => "????"} 
    }
}

#Features:

##F1: 可背景執行定時任務,時間到了會執行檢查任務,並且送出 Notification

##F2: 可手動點擊執行單一 節點 或是整個 節點群組 的檢查任務,並且顯示檢查的結果。

##F3: 如果 ping/telent 不到節點時(亦即檢查結果為失敗),會秀出該節點 tracert 的資訊

##F4:

若節點有指定 port, 會執行 telnet 指令進行檢查, 若無設定 port, 則會依據 is_icmp 決定使用 ping 或是 telnet 進行檢測

====== #Questions:

##Q1: SQLlite 是否有支援外鍵?

Ans: Yes

##Q2: Android 可直接在程式碼執行 linux 指令嗎?

Ans: 可參考此篇

##Q3: 手機可以像一般 linux 系統一樣設定排程嗎?

Ans: AlarmManager

====== #Todo

DB

  • How to use sqllite
  • create schema
  • CRUD operation

How to fetch data bind into view?

Linux cmd exec

  • How to exec commands
  • How to get exec result
  • How to analize result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment