{"id":20634139,"url":"https://github.com/samn/run-and-report","last_synced_at":"2025-04-15T19:36:03.247Z","repository":{"id":8685876,"uuid":"10346821","full_name":"samn/run-and-report","owner":"samn","description":"Run a command and report to Riemann","archived":false,"fork":false,"pushed_at":"2018-05-11T16:42:42.000Z","size":13,"stargazers_count":14,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T00:11:58.227Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-28T22:15:37.000Z","updated_at":"2018-05-11T16:42:43.000Z","dependencies_parsed_at":"2022-09-11T04:21:35.424Z","dependency_job_id":null,"html_url":"https://github.com/samn/run-and-report","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/samn%2Frun-and-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samn%2Frun-and-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samn%2Frun-and-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samn%2Frun-and-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samn","download_url":"https://codeload.github.com/samn/run-and-report/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249139425,"owners_count":21219073,"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-16T14:23:57.520Z","updated_at":"2025-04-15T19:36:03.228Z","avatar_url":"https://github.com/samn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# run-and-report.py\n## *Run a command and report to [Riemann](http://riemann.io).*\n\n\n### Usage\n````\nUsage: run-and-report.py [options] -- command to run\n\nOptions:\n  -h, --help            show this help message and exit\n  --riemann-host=RIEMANN_HOST\n                        The address of Riemann\n  --riemann-port=RIEMANN_PORT\n                        The port Riemann is running on\n  --tags=TAGS           Optional tags for the event\n  --ttl=TTL             An optional TTL for the event (in seconds)\n  --states=STATES       Describes a mapping of return codes and event states.\n                        e.g. ok:0,1|warn:2,3. Return codes without an explicit\n                        mapping are assumed error. default=ok:0\n  --service=SERVICE     An optional service to the event. Defaults to the\n                        basename of the command that's run\n  --debug               Output the event before it's sent to Riemann.\n  --metric-from-stdout  Use stdout as the metric rather than the elapsed\n                        command walltime.\n  --state-from-stdout   Use stdout as the state rather than the elapsed\n                        command walltime.\n  --tcp                 Use TCP transport instead of UDP.\n  --host=HOST           Specify hostname.\n  --omit-metric         Do not send the metric.\n  --attributes=ATTRIBUTES\n                        Comma separated list of key=value attribute pairs.\n                        e.g. foo=bar,biz=baz\n\n  SSL Options:\n    Setting all of these options will cause the connection to be created\n    over SSL.\n\n    --keyfile=KEYFILE   Path to PKCS8 private key file in PEM format\n    --certfile=CERTFILE\n                        Path to client certificate file in PEM format\n    --cafile=CAFILE     Path to certificate authorities file in PEM format\n````\n    \n`run-and-report.py` will run the command string and report that the event occurred.\nThe time it took to run the command will be the metric of the event, unless overridden by `--stdout`\nThe states argument defines the state of the event based on the return code of the command.\n    \n\n### Examples\n````\nsamn@salmon:~ $ run-and-report.py --states \"beauty:2,3|ok:0,1\" --debug -- ls /dogs\n{'description': '\\n    STDOUT \u003e\u003e\u003e\\n    \\n    \u003c\u003c\u003c\\n\\n    STDERR \u003e\u003e\u003e\\n    ls: cannot access /dogs: No such file or directory\\n\\n    \u003c\u003c\u003c\\n    ', 'service': 'ls', 'tags': [], 'metric': 0.0027740001678466797, 'state': 'beauty', 'host': 'salmon', 'attributes': {'command': 'ls /dogs', 'return_code': 2}}\n````    \n\n````\nsamn@salmon:~ $ run-and-report.py --debug --service 'dogs are cool' --tags dogs,dogges -- 'echo 1 \u0026\u0026 ls /dogs || echo 2'\n{'description': '\\n    STDOUT \u003e\u003e\u003e\\n    1\\n2\\n\\n    \u003c\u003c\u003c\\n\\n    STDERR \u003e\u003e\u003e\\n    ls: cannot access /dogs: No such file or directory\\n\\n    \u003c\u003c\u003c\\n    ', 'service': 'dogs are cool', 'tags': ['dogs', 'dogges'], 'metric': 0.0026619434356689453, 'state': 'ok', 'host': 'salmon', 'attributes': {'command': 'echo 1 \u0026\u0026 ls /dogs || echo 2', 'return_code': 0}}\n````\n    \n### Requirements\n\n* `bernhard` - Python Riemann client\n    * requires python-protobuf\n\n### Is it any good?\nsure \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamn%2Frun-and-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamn%2Frun-and-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamn%2Frun-and-report/lists"}