{"id":23866163,"url":"https://github.com/inwinstack/calamari-alerting","last_synced_at":"2025-09-05T08:04:20.383Z","repository":{"id":99449736,"uuid":"48691974","full_name":"inwinstack/calamari-alerting","owner":"inwinstack","description":"Calamari alert service  for Ceph","archived":false,"fork":false,"pushed_at":"2016-02-01T05:03:41.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-03T09:39:41.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inwinstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-28T12:40:27.000Z","updated_at":"2016-04-10T18:08:00.000Z","dependencies_parsed_at":"2023-04-24T00:12:11.238Z","dependency_job_id":null,"html_url":"https://github.com/inwinstack/calamari-alerting","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inwinstack%2Fcalamari-alerting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inwinstack%2Fcalamari-alerting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inwinstack%2Fcalamari-alerting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inwinstack%2Fcalamari-alerting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inwinstack","download_url":"https://codeload.github.com/inwinstack/calamari-alerting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240183767,"owners_count":19761440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-03T09:39:57.828Z","updated_at":"2025-02-22T14:08:17.198Z","avatar_url":"https://github.com/inwinstack.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Calamari Alert Service \n本服務為 Calamri Alert Service 監控套件，會在指定作業系統底下提供一個 Calamari 的 Alert Service，來提供儲存系統的錯誤訊息，該服務應以 Python 撰寫且可獨立運作，即可能不運作於 Calamari 伺服器。當儲存系統發生錯誤時，該服務須執行之功能包含：\n* 寫入警告紀錄至資料庫\n* 寫入系統日誌 (Syslog)\n* 發送電子郵件\n\nInstallation\n------------\n首先安裝 Python pip 套件：\n```sh\n$ sudo apt-get install -y git python-pip\n```\n從 Git Server 將套件的 Repositiory 下載至安裝的本機端上：\n```sh\n$ git clone https://github.com/inwinstack/calamari-alerting.git\n$ cd calamari-alerting\n```\n\n之後安裝相關環境套件：\n```sh\n$ sudo apt-get update \n$ sudo apt-get install postgresql-contrib python-setuptools libpq-dev python-dev libmysqlclient-dev libxml2-dev libxslt1-dev -y \n```\n\n安裝資料庫系統，這邊採用 Postgresql：(Option)\n```sh\n$ sudo apt-get install postgresql \n```\n\u003e P.S 若與```Calamari-server```連接使用，請輸入```Calamari-server```的資料庫資訊。\n\n修改預設 User 密碼，這邊範例使用 Postgresql，若已有存在資料庫，則不用該步驟：(Option)\n```sh\n$ sudo -u postgres psql postgres\n$ \\password postgres\n$ \\q\n```\n\u003e 在執行上個步驟若出現”psql: could not connect to server: No such file or directory\nIs the server running locally and accepting\nconnections on Unix domain socket \"/var/run/postgresql/.s.PGSQL.5432\"?\n\n\u003e 可以執行以下步驟來解決，以 postgresql 9.3 為例：\n```sh\n$ LC_ALL=C sudo pg_createcluster 9.3 main ; sudo /etc/init.d/postgresql restart\n```\n\n\n建立一個名稱為```calamari-alert```的使用者：\n```sh\n$ SERVICE=\"calamari-alert\"\n$ sudo useradd --home-dir \"/var/lib/${SERVICE}\" --create-home --system --shell /bin/false ${SERVICE}\n```\n\n建立 log 與 conf 目錄，並複製 conf 檔案到 etc 底下：\n```sh\n$ sudo mkdir -p /var/log/${SERVICE}\n$ sudo mkdir -p /var/run/${SERVICE}\n$ sudo mkdir -p /etc/${SERVICE}\n$ sudo chown -R ${SERVICE}:${SERVICE} /var/log/${SERVICE}\n$ sudo chown -R ${SERVICE}:${SERVICE} /var/run/${SERVICE}\n$ sudo chown -R ${SERVICE}:${SERVICE} /etc/${SERVICE}\n$ sudo cp -r etc/calamari-alert/calamari-alert.conf /etc/${SERVICE}/\n```\n\n安裝```calamari-alert```服務套件：\n```sh\n$ sudo python setup.py install\n```\n\n編輯```/etc/calamari-alert/calamari-alert.conf```檔案，並修改一下：\n```sh\n[DEFAULT]\ndebug = True\n\nlog_format = %(asctime)s %(levelname)-5s [%(name)s] - \"%(message)s\"\nlog_date_format = %Y-%m-%d %H:%M:%S\nlog_dir = /var/log/calamari-alert\n\n[ssl]\nverify = False\nca_file_dir = /var/lib/calamari-alert/ssl\nca_files = apache.crt, apache.key\n\n[calamari]\nurl = http://calamari.example.com\nport = 80\nusername = example\npassword = example\n\n[database]\n# Example:\n# MySQL: connection = mysql://root:calamari@192.168.99.100/calamari\n# Postgresql: connection = postgresql://postgres:calamari@192.168.99.100/calamari\nconnection = postgresql://calamari:27HbZwr*g@192.168.99.100/calamari\n\n[email]\naddress = smtp.gmail.com\nport = 587\n\n# The 'mode' is setting smtp security, Two options 'None' and 'TLS'\nmode = TLS\nauth_account = True\nusername = example@gmail.com\npassword = example\n```\n\u003e 若使用```HTTPS```的話，請在```[ssl]```部分設定驗證的金鑰與目錄，或者透過設定```verify```來忽略驗證。\n\n\n複製```scripts/calamari-alert-service```到```/etc/init.d```底下：\n```sh\n$ sudo cp -r scripts/calamari-alert-service /etc/init.d/\n$ sudo chmod 775 /etc/init.d/calamari-alert-service\n```\n完成檔案複製後，使用 update-rc.d 指令設定開機啟動：\n```sh\n$ sudo update-rc.d calamari-alert-service defaults\n```\n\n啟動服務：\n```sh\n$ sudo service calamari-alert-service start\n* Starting ceph calamari-alert service ...                                                                                [ OK ]\n```\n\u003e Debug 可以使用```sudo service calamari-alert-service systemd-start```。\n\nLicense\n-------","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finwinstack%2Fcalamari-alerting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finwinstack%2Fcalamari-alerting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finwinstack%2Fcalamari-alerting/lists"}