{"id":17030323,"url":"https://github.com/vsoch/watchme-system","last_synced_at":"2025-04-12T12:11:58.363Z","repository":{"id":141668098,"uuid":"179764365","full_name":"vsoch/watchme-system","owner":"vsoch","description":"An example reproducible monitor for system metrics using the watchme client","archived":false,"fork":false,"pushed_at":"2019-05-12T15:08:42.000Z","size":17297,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T06:51:12.355Z","etag":null,"topics":["reproducible-monitoring","version-control","watchme"],"latest_commit_sha":null,"homepage":"https://vsoch.github.io/watchme-system/","language":"Jupyter Notebook","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/vsoch.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":"2019-04-05T22:48:28.000Z","updated_at":"2020-07-04T15:48:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"373b1ce8-da1e-45f6-a19d-bc7ea5782cff","html_url":"https://github.com/vsoch/watchme-system","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/vsoch%2Fwatchme-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fwatchme-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fwatchme-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fwatchme-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsoch","download_url":"https://codeload.github.com/vsoch/watchme-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565077,"owners_count":21125417,"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":["reproducible-monitoring","version-control","watchme"],"created_at":"2024-10-14T08:06:10.182Z","updated_at":"2025-04-12T12:11:58.343Z","avatar_url":"https://github.com/vsoch.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# System Watcher\n\nThis is an example watcher to record system metrics, ranging from memory, to\nnetworking, python interpreter, sensors (battery, fans, temperature), and\nusers. You can explore each of the folders to see the (json) data exported, \non an hourly bases, and automated with cron, from my system:\n\n - [task-cpu](task-cpu)\n - [task-memory](task-memory)\n - [task-network](task-network)\n - [task-python](task-python)\n - [task-sensors](task-sensors)\n - [task-system](task-system)\n - [task-users](task-users)\n\nYou can also see an example of using local hooks and a container to generate \na nice visual.\n\n - [Hooks](#hooks)\n\n\n### What is WatchMe?\n\nWatchMe is a [tool for reproducible monitoring](https://vsoch.github.io/watchme).\nThis means that you can create one or more tasks to monitor web or system resources,\nand collection version controlled results (git) at a regular interval (cron). \nFor more details, see the [documentation base](https://vsoch.github.io/watchme)\n\n\n## Clone\n\nTo clone this repository (and start with the watchers here), you can\nfirst install watchme:\n\n```bash\n$ pip install watchme[psutils]\n```\n\nand then get the repository:\n\n```bash\n              # repository                                # watcher name\n$ watchme get https://www.github.com/vsoch/watchme-system system\nAdded watcher watchme-system\n```\n\nConfirm that it was added:\n\n```bash\n$ watchme list\nair-quality\nsystem\n```\n\nThis will install the data to your $HOME/.watchme folder by default, unless\nyou've exported another `WATCHME_BASE_DIR`. Before you run the task, \ntake a look at the data that has already been collected. For eack task\nfolder, you can export changes for a file like this \n\n```bash\n#              \u003cwatcher\u003e \u003ctask\u003e    \u003cfilename\u003e\n$ watchme export system task-users vanessa-thinkpad-t460s_vanessa.json\n```\n\nIf you expect the data in the files to be json (and want to parse it into the result)\nthen do this:\n\n```bash\n$ watchme export system task-users vanessa-thinkpad-t460s_vanessa.json --json\n```\n\nThere is a `TIMESTAMP` file that is kept in each folder as a record of when \nit was last run. You can then run the task manually in test mode to see output\n\n```bash\n$ watchme run system --test\n```\n\nBut likely you want to activate and schedule the task to run.\n\n\n### Schedule the Task\n\nInstead of a manual run, you likely want to run the task and look for changes \nover time. You can do that like this:\n\n```bash\n$ watchme schedule system @hourly\n```\n\nAnd then check that an entry has been added to crontab:\n\n```bash\n$ crontab -l\n@hourly watchme run system # watchme-system\n```\n\nFinally, ensure that the watcher is active:\n\n```bash\n$ watchme activate system\n```\n\n## Creation\n\nIf you want to reproduce creating this watcher, it looks something like this:\n\nInstall Watchme\n\n```bash\n$ pip install watchme[psutils]\n```\n\nInitialize the base folder at $HOME/.watchme\n\n```bash\n$ watchme init\n```\n\nCreate the system watcher:\n\n```bash\n$ watchme create system\n```\n\nAnd then install each of the tasks as follows:\n\n```bash\nwatchme add task-cpu func@cpu_task active@true type@psutils\nwatchme add task-memory func@memory_task active@true type@psutils\nwatchme add task-network func@net_task skip@net_connections,net_if_address active@true type@psutils\nwatchme add task-python func@python_task active@true type@psutils\nwatchme add task-sensors func@sensors_task active@true type@psutils\nwatchme add task-system func@system_task active@true type@psutils\nwatchme add task-users func@users_task active@true type@psutils\n```\n\nYou can easily export a current configuration file (how I produced the commands above).\n\n\n```bash\n$ watchme inspect system --add-command\n```\n\nNote that for the psutils watcher, the export above would include file_name, but\nyou don't need to (it's added automatically with your host and username.\n\n## Export Data\n\nAs an example, I created this watcher with the commands above, and \ndecided to export data (after about a day and a half) and do an analysis to\nshow change in metrics about my computer over time. This simple example will serve\nto show that WatchMe is useful to answer research questions, as it collected my data\nfor me without me needing to do anything. Here are the commands to export each of the data\nfiles:\n\n```bash\n$ mkdir -p data\n$ for task in cpu memory network python sensors system users\ndo\n    watchme export system task-$task --out data/task-$task.json vanessa-thinkpad-t460s_vanessa.json --json\ndone\n```\n\n## Hooks\n\nIf you want to deploy a set of images from your watcher to GitHub pages, that is very\neasy to do! Just copy the [hooks/pre-push](hooks/pre-push) hook into your .git/hooks\nfolder, like this:\n\n```bash\n$ cp hooks/pre-push .git/hooks\n```\n\nAnd you are good to go! The hook will pull a container to do the generation, if it\ndoens't exist already. The files are generated in the [docs](docs) folder, and you\nshould activate GitHub pages for that folder to see (a very simple) set of images.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fwatchme-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsoch%2Fwatchme-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fwatchme-system/lists"}