{"id":18283404,"url":"https://github.com/ungdev/yoctometeo-alerting","last_synced_at":"2025-04-09T05:42:39.373Z","repository":{"id":151607113,"uuid":"34081141","full_name":"ungdev/yoctometeo-alerting","owner":"ungdev","description":"Alerting system based on the Yoctometeo module.","archived":false,"fork":false,"pushed_at":"2017-07-30T15:43:38.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-02-15T00:18:36.302Z","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/ungdev.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":"2015-04-16T21:18:44.000Z","updated_at":"2016-11-06T14:43:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c5bdd5e-3f3a-4d7c-842e-1fb519ce43eb","html_url":"https://github.com/ungdev/yoctometeo-alerting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ungdev%2Fyoctometeo-alerting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ungdev%2Fyoctometeo-alerting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ungdev%2Fyoctometeo-alerting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ungdev%2Fyoctometeo-alerting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ungdev","download_url":"https://codeload.github.com/ungdev/yoctometeo-alerting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987107,"owners_count":21028891,"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":"2024-11-05T13:09:24.631Z","updated_at":"2025-04-09T05:42:39.356Z","avatar_url":"https://github.com/ungdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yocto-meteo alerting\n\nThis program has been designed to alert administrators if environmental variables cross certain thresholds, using a Yocto-Meteo station device.\n\n## Installation guide\n\nFirst, install the Yoctopuce SDK for Python available in PyPi repositories :\n```\npip install yoctopuce\n```\n\nDepending on your needs, you might want to install the following dependency in order to send log messages to a Graylog server :\n```\npip install graypy\n```\n\nClone the repository in a target folder, e.g. /opt, and give ownership to the user whose identity will be used to run the program.\n\n## Running\n\n### Direct launch\nYou can launch it by hand, in which case execute a Python3 interpreter targeting `main.py`.\n\n### Systemd service\nA skeleton of systemd service descriptor is provided under `yoctometeo-alerting.service`.\nYou might want to edit the following parameters to suit your install :\n- User/Group : must match the aforementionned\n- WorkingDirectory/ExecStart : depending on the program path\n- StandardOutput/StandardOutput : where the outputs should be directed to, defaults to syslog\n\n\n## Configuration\n\nThe configuration is stored in a JSON-syntax file `config.json`. A sample skeleton may be found in the repository : `sample-config.json`.\nThis section will briefly summarize the available options.\n\n### sleep-time\n\nThe program will automatically perform a check sequence after the expiry of the delay since the last sequence completed.\nTo be expressed in milliseconds.\n\n### mail-server\n\nThis section defines the parameters required to send alerts through e-mails.\n```\n\"mail-server\": {\n    \"host\": \"smtp.example.tld\",\n    \"port\": \"465\",\n    \"tls\": \"yes\", // whether using TLS encryption\n    \"username\": \"ano.nymous\", //leave blank if no authentication is required\n    \"password\": \"Azerty\",\n    \"from-address\": \"yocto@example.tld\" // Originating e-mail address, will appear to the recipient\n}\n```\n\n### log-server\n\nThis section defines the parameters required to send alerts to a Graylog server. Optional.\n```\n\"log-server\": {\n    \"host\": \"log.example.tld\",\n    \"port\": 12201\n}\n```\n\n### addressees\n\nThis section defines the people who will receive the alerts, with their contact infos.\nIt is an array of objects defined as follow :\n```\n\"addressees\": [\n    {\n      \"name\": \"****\", // Name of the addressee\n      \"mail\": \"**@***\", // Email address\n      \"phone-number\": \"+336XXXXXXXXX\" // Phone number\n    }\n]\n```\n\n### modules\n\nThis section defines the YoctoMeteo devices used by the program. Here are the different components of this section.\n\n#### Module object\n\nThese objects define a module, as a hardware piece of equipment, with the following parameters :\n- The hardware ID, which can be found using YoctoPuce SDKs or demo softwares, it is used to uniquely identify a module.\n- The host identifier\n    - `[hostname]:[port]` for VirtualHub intallations\n    - `usb` for direct access through USB port (specific instructions to be found thereafter)\n- An array of sensor objects, whose description can be found in the next section\n\n```\n{\n  \"hardware-id\": \"****\",\n  \"host\": \"***\",\n  \"sensors\": []\n}\n```\n\n#### Sensor object\n\nThese objects define a sensor, meaning an environmental variable (not necessarily a separate physical equipment).\nOne must be defined for each variable to be monitored, for each module, with the following parameters :\n- The sensor type, to be chosed among the following :\n    - temperature\n    - humidity\n    - pressure\n- An array of alert objects, whose description can be found in the next section\n\n```\n{\n    \"type\": \"temperature|humidity|pressure\",\n    \"alerts\": []\n}\n```\n\n#### Alert object\n\nThese objects define an alert, meaning a threshold which, if crossed, will trigger an alerting action.\nSensors can handle multiple alerts, for instance lowlevel e-mail alert for a small overheating, and a hurry SMS alert for a fire-like problem.\nIt must be defined with the following parameters :\n- An identifier to remain unique among the program instance\n- The vector used to transmit the alert (if a log server has been defined, each and every alert will be forwarded to it), currently supported :\n    - E-mail\n    - SMS (to be implemented depending on your platform)\n- The alert level (used for the logging system), to be chosed among the following, by increasing degree of harm :\n    - warning\n    - error\n    - critical\n- The variable can pass **below** or **over** the threshold\n- The trigger threshold : crossing it in the aforementioned direction will trigger the alert\n- The reset threshold : crossing it in the direction opposite to the aforementioned will reset the alert\n\nThe interest of this double-threshold mechanism is to introduce a hysteresis,\nthus avoiding endless alert/end-of-alert messages when the value bounces arround the threshold.\n\n```\n{\n    \"alert-id\": 1,\n    \"alert-vector\": \"email\",\n    \"level\": \"warning\",\n    \"direction\": \"over\",\n    \"trigger\": 25,\n    \"reset\": 22\n}\n```\n\n## Direct USB connection\n\nIn order for USB access to work for users other than root, you should copy the file\n `51-yoctopuce_all.rules` in the `/etc/udev/rules.d` directory.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fungdev%2Fyoctometeo-alerting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fungdev%2Fyoctometeo-alerting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fungdev%2Fyoctometeo-alerting/lists"}