{"id":26678182,"url":"https://github.com/telexintegrations/i-notify","last_synced_at":"2025-03-26T05:15:10.029Z","repository":{"id":278979051,"uuid":"934352810","full_name":"telexintegrations/I-notify","owner":"telexintegrations","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-03T11:29:18.000Z","size":503,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-03T12:26:56.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/telexintegrations.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-17T17:28:02.000Z","updated_at":"2025-03-03T11:29:21.000Z","dependencies_parsed_at":"2025-02-23T00:21:59.478Z","dependency_job_id":null,"html_url":"https://github.com/telexintegrations/I-notify","commit_stats":null,"previous_names":["telexintegrations/i-notify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FI-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FI-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FI-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FI-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telexintegrations","download_url":"https://codeload.github.com/telexintegrations/I-notify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245591534,"owners_count":20640692,"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-03-26T05:15:09.404Z","updated_at":"2025-03-26T05:15:10.012Z","avatar_url":"https://github.com/telexintegrations.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Deletion Monitor [I-notify](https://telex-app.onrender.com/docs)\n\n## Overview\nThis project monitors file deletions in a specified directory using `auditd`, logs events to a PostgreSQL database, and sends alerts via a Telex Webhook.\n![Alt text](Screenshot_2025-02-24-12-03-13-670_com.android.chrome~2.jpg)\n## Features\n- Monitors file deletions in a specified directory.\n- Logs deleted files to a PostgreSQL database.\n- Sends alerts to a Telex Webhook.\n- Uses `auditd` for real-time monitoring.\n- Runs in a virtual environment.\n- Can be configured as a systemd service to run in the background.\n\n## Installation\n\n### 1. Clone the Repository\n```sh\ngit clone \u003crepository-url\u003e\ncd \u003crepository-folder\u003e\n```\n\n### 2. Create and Activate a Virtual Environment\n```sh\npython3 -m venv venv\nsource venv/bin/activate  # On macOS/Linux\nvenv\\Scripts\\activate  # On Windows\n```\n\n### 3. Install Dependencies\nEnsure you have Python installed. Then, install the required dependencies:\n```sh\npip install -r requirements.txt\n```\n\n### 4. Set Up Environment Variables\nCreate a `.env` file in the project root with the following content:\n```\nWATCHED_FOLDER=/home/ubuntu/test_directory\nTELEX_WEBHOOK_URL=http://127.0.0.1:5000/telex-webhook\nDB_NAME=file_monitor\nDB_USER=postgres\nDB_PASSWORD=yourpassword\nDB_HOST=localhost\nDB_PORT=5432\n```\nReplace the values as needed.\nOR\n```mv .sampleenv .env```\nUsing the sample database and telex channel link\n\n### 5. Set Up PostgreSQL Database\nEnsure PostgreSQL is running and create the necessary table:\n```sh\npsql -U postgres -d file_monitor -c \"CREATE TABLE IF NOT EXISTS file_deletions (id SERIAL PRIMARY KEY, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, file_path TEXT NOT NULL, deleted_by TEXT NOT NULL);\"\n```\n\n### 6. Run the Monitor\nStart the script using:\n```sh\nsudo python file_monitor.py\n```\nOR\nStart the script using:\n```sh\nsudo venv/bin/python3 file_monitor.py\n```\n### 7. Testing the Integration\nStart the script using:\n```sh\n./curl-test-telex\n```\n\nThe script will continuously monitor for file deletions and log them.\n\n## Running as a systemd Service\nTo keep the script running in the background, you can set it up as a systemd service.\n\n### 1. Create a systemd Service File\nCreate a new file `/etc/systemd/system/file_monitor.service` and add the following content:\n```\n[Unit]\nDescription=File Deletion Monitor\nAfter=network.target\n\n[Service]\nUser=ubuntu\nGroup=ubuntu\nWorkingDirectory=/home/ubuntu/\u003crepository-folder\u003e\nExecStart=/home/ubuntu/\u003crepository-folder\u003e/venv/bin/python /home/ubuntu/\u003crepository-folder\u003e/file_monitor.py\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\nReplace `\u003crepository-folder\u003e` with the actual folder name.\n\n### 2. Reload systemd and Enable the Service\n```sh\nsudo systemctl daemon-reload\nsudo systemctl enable file_monitor.service\nsudo systemctl start file_monitor.service\n```\n\n### 3. Check Service Status\n```sh\nsudo systemctl status file_monitor.service\n```\n\n## Troubleshooting\n- Ensure `auditd` is installed and running:\n  ```sh\n  sudo apt install auditd\n  sudo systemctl start auditd\n  ```\n- Check if the rule is set:\n  ```sh\n  auditctl -l\n  ```\n- Manually trigger an event to test:\n  ```sh\n  rm /home/ubuntu/test_directory/testfile.txt\n  ```\n\n## License\nMIT License\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fi-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelexintegrations%2Fi-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fi-notify/lists"}