{"id":18811721,"url":"https://github.com/logicmonitor/lm_python","last_synced_at":"2025-04-13T20:31:36.916Z","repository":{"id":10291897,"uuid":"12411246","full_name":"logicmonitor/lm_python","owner":"logicmonitor","description":"LogicMonitor python module","archived":false,"fork":false,"pushed_at":"2017-02-09T18:08:18.000Z","size":176,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-02T09:48:10.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.logicmonitor.com","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/logicmonitor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-27T16:21:48.000Z","updated_at":"2023-05-09T16:41:38.000Z","dependencies_parsed_at":"2022-09-10T02:12:02.167Z","dependency_job_id":null,"html_url":"https://github.com/logicmonitor/lm_python","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/logicmonitor%2Flm_python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm_python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm_python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm_python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicmonitor","download_url":"https://codeload.github.com/logicmonitor/lm_python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223604537,"owners_count":17172315,"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-07T23:27:25.549Z","updated_at":"2024-11-07T23:27:26.029Z","avatar_url":"https://github.com/logicmonitor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lm_python\nLogicMonitor is a cloud-based, full stack, IT infrastructure monitoring\nsolution that allows you to manage your infrastructure from the cloud.\nlm_python contains a set of stand-alone scripts which can be used to manage\nyour LogicMonitor account programmatically. These scripts are intended to be\nfunctional examples of interaction with the LogicMonitor API in python.\n\n## Prerequisites\nIn order to use these scripts there are a few things you will need.\n- Access to a LogicMonitor account\n- Sufficient permissions to perform the desired action\n- Python version 2.7 or later\n\n## Overview\nThis repository is not a complete set of scripts required to fully manage your\nLogicMonitor account, nor does it cover the full extent of the LogicMonitor\nAPI. Here's what we have so far.\n\n## Setup\nInstall the lm_python package using a python package tool or clone the\nrepository from github and install the package locally\n\n#### Package example\n```\n$\u003e pip install logicmonitor_core\n```\n\n#### github example\n```\n$\u003e git clone https://github.com/logicmonitor/lm_python.git\n$\u003e cd lm_python\n$\u003e python setup.py install\n```\n\n#### Platform specific tools\nThe following scripts are for managing specific types of device\n\n**Linux collector management:**\n- collector_add\n- collector_remove\n- collector_sdt\n\n#### Platform agnostic tools\n**Host management:**\n- device_add\n- device_remove\n- device_update\n- device_sdt\n- device_info\n\n** device group management:**\n- devicegroup_add\n- devicegroup_remove\n- devicegroup_update\n- devicegroup_sdt\n- devicegroup_info\n\n### collector_add.py\nThis idempotent script creates a new LogicMonitor collector for a Linux device.\nThis script assumes that you are running the script on the machine that you\nare wanting to install a new collector. For more information about collector\nmanagement [click here](http://help.logicmonitor.com/the-new-ui/settings/collectors/what-is-the-logicmonitor-collector/).\n\n```\n$\u003e python ./examples/collector_add.py -h\nusage: collector_add.py [-h] -c COMPANY -u USER -p PASSWORD\nrequired arguments:\n    -c COMPANY,  --company COMPANY      LogicMonitor account\n    -u USER,     --user USER            LogicMonitor user name\n    -p PASSWORD, --password PASSWORD    LogicMonitor password\noptional arguments:\n    -h,          --help                 Show this help message and exit\n```\n\n### collector_remove.py\nThis idempotent script removes and existing LogicMonitor collector from a\nLinux device. This script assumes that you are running the script on the\nmachine that you want to remove a collector from. For more information about\ncollector management\n[click here](http://help.logicmonitor.com/the-new-ui/settings/collectors/what-is-the-logicmonitor-collector/).\n\n```\n$\u003e python ./examples/collector_remove.py -h\nusage: collector_remove.py [-h] -c COMPANY -u USER -p PASSWORD\nrequired arguments:\n    -c COMPANY,  --company COMPANY      LogicMonitor account\n    -u USER,     --user USER            LogicMonitor user name\n    -p PASSWORD, --password PASSWORD    LogicMonitor password\noptional arguments:\n    -h,          --help                 Show this help message and exit\n```\n\n### collector_sdt.py\nThis script sets places a collector in scheduled down time (SDT) or\nmaintenance mode. This script assumes that you are running the script on the\nsame machine as the collector to SDT. This script is not\nidempotent and the same collector can be put into SDT multiple times.\nFor more information about collector management\n[click here](http://help.logicmonitor.com/the-new-ui/settings/collectors/what-is-the-logicmonitor-collector/).\n\n```\n$\u003e python ./examples/collector_sdt.py -h\nusage: collector_sdt.py [-h] -c COMPANY -u USER -p PASSWORD [-d DURATION] [-s STARTTIME]\nrequired arguments:\n    -c COMPANY,  --company COMPANY      LogicMonitor account\n    -u USER,     --user USER            LogicMonitor user name\n    -p PASSWORD, --password PASSWORD    LogicMonitor password\noptional arguments:\n    -h,           --help                Show this help message and exit\n    -d DURATION,  --duration DURATION   SDT duration\n    -s STARTTIME, --starttime STARTTIME SDT start time\n```\n\n### device_add.py\nThis idempotent script adds a new device to monitoring in your LogicMonitor\naccount. This addition includes setting device properties and group membership.\nIf the groups required for the addition of this device do not exist, they will\nbe created. For more information on managing devices\n[click here](http://help.logicmonitor.com/the-new-ui/devices/).\n\n```\n$\u003e python ./examples/device_add.py -h\nusage: device_add.py [-h] -c COMPANY -u USER -p PASSWORD -C COLLECTOR\n                   [-H HOSTNAME] [-d DISPLAYNAME] [--description DESCRIPTION]\n                   [-P PROPERTIES] [-g GROUPS [GROUPS ...]] [-a ALERTENABLE]\nrequired arguments:\n    -c COMPANY,   --company COMPANY                     LogicMonitor account\n    -u USER,      --user USER                           LogicMonitor user name\n    -p PASSWORD,  --password PASSWORD                   LogicMonitor password\n    -C COLLECTOR, --collector COLLECTOR                 Collector FQDN\noptional arguments:\n  -h,             --help                                Show this help message and exit\n  -H HOSTNAME,    --hostname HOSTNAME                   Device hostname\n  -d DISPLAYNAME, --displayname DISPLAYNAME             Device display name\n  -P PROPERTIES,  --properties PROPERTIES               A dictionary of properties to set for the device\n  -a ALERTENABLE, --alertenable ALERTENABLE             Turn alerting on or off\n  -g GROUPS [GROUPS ...], --groups GROUPS [GROUPS ...]  Groups the device should be a member of\n  --description DESCRIPTION                             Text description of the device\n```\n\n### device_remove.py\nThis idempotent script removes a device from monitoring in your LogicMonitor\naccount. Note: this does not remove device groups that contain this device even\nif they were created by adding this device. For more information on managing devices\n[click here](http://help.logicmonitor.com/the-new-ui/devices/).\n\n```\n$\u003e python ./examples/device_remove.py -h\nusage: device_remove.py [-h] -c COMPANY -u USER -p PASSWORD [-C COLLECTOR]\n                      [-H HOSTNAME] [-d DISPLAYNAME]\nrequired arguments:\n    -c COMPANY,     --company COMPANY             LogicMonitor account\n    -u USER,        --user USER                   LogicMonitor user name\n    -p PASSWORD,    --password PASSWORD           LogicMonitor password\noptional arguments:\n    -h, --help                                    Show this help message and exit\n    -C COLLECTOR,   --collector COLLECTOR         Collector FQDN\n    -H HOSTNAME,    --hostname HOSTNAME           Device hostname\n    -d DISPLAYNAME, --displayname DISPLAYNAME     Device display name\n```\n\n### device_update.py\nThis idempotent script updates a device already being monitored by your LogicMonitor account.\n[click here](http://help.logicmonitor.com/the-new-ui/devices/).\n\n```\n$\u003e python ./examples/device_update.py -h\nusage: device_update.py [-h] -c COMPANY -u USER -p PASSWORD [-C COLLECTOR]\n                      [-H HOSTNAME] [-d DISPLAYNAME]\n                      [--description DESCRIPTION] [-P PROPERTIES]\n                      [-g GROUPS [GROUPS ...]] [-a ALERTENABLE]\nrequired arguments:\n    -c COMPANY,     --company COMPANY                       LogicMonitor account\n    -u USER,        --user USER                             LogicMonitor user name\n    -p PASSWORD,    --password PASSWORD                     LogicMonitor password\noptional arguments:\n    -h,             --help                                  Show this help message and exit\n    -C COLLECTOR,   --collector COLLECTOR                   Collector FQDN\n    -H HOSTNAME,    --hostname HOSTNAME                     Device hostname\n    -d DISPLAYNAME, --displayname DISPLAYNAME               Device display name\n    -P PROPERTIES,  --properties PROPERTIES                 A dictionary of properties to set for the device\n    -a ALERTENABLE, --alertenable ALERTENABLE               Turn alerting on or off\n    -g GROUPS [GROUPS ...], --groups GROUPS [GROUPS ...]    Groups the device should be a member of\n    --description DESCRIPTION                               Text description of the device\n```\n\n### device_sdt.py\nThis script places a host in scheduled down time (SDT) or maintenance mode.\nThis will suppress alerting for the duration of the SDT. This script is not\nidempotent and the same device can be put into SDT multiple times. For more\ninformation on managing devices\n[click here](http://help.logicmonitor.com/the-new-ui/devices/).\n\n\n```\n$\u003e python ./examples/device_sdt.py  -h\nusage: device_sdt.py [-h] -c COMPANY -u USER -p PASSWORD [-C COLLECTOR]\n                   [-H HOSTNAME] [-d DISPLAYNAME] [-D DURATION] [-s STARTTIME]\nrequired arguments:\n    -c COMPANY,   --company COMPANY               LogicMonitor account\n    -u USER,      --user USER                     LogicMonitor user name\n    -p PASSWORD,  --password PASSWORD             LogicMonitor password\noptional arguments:\n    -h,             --help                        Show this help message and exit\n    -C COLLECTOR,   --collector COLLECTOR         Collector FQDN\n    -H HOSTNAME,    --hostname HOSTNAME           Device hostname\n    -d DISPLAYNAME, --displayname DISPLAYNAME     Device display name\n    -D DURATION,    --duration DURATION           SDT duration\n    -s STARTTIME,   --starttime STARTTIME         SDT start time\n```\n\n### device_info.py\nThis script retrieves and displays information about a device already being\nmonitored by your LogicMonitor account. For more information on managing devices\n[click here](http://help.logicmonitor.com/the-new-ui/devices/).\n\n```\n$\u003e python ./examples/device_info.py -h\nusage: device_info.py [-h] -c COMPANY -u USER -p PASSWORD -C COLLECTOR\n                    [-H HOSTNAME] [-d DISPLAYNAME]\nrequired arguments:\n    -c COMPANY,     --company COMPANY           LogicMonitor account\n    -u USER,        --user USER                 LogicMonitor user name\n    -p PASSWORD,    --password PASSWORD         LogicMonitor password\noptional arguments:\n    -h, --help                                  Show this help message and exit\n    -C COLLECTOR,   --collector COLLECTOR       Collector FQDN\n    -H HOSTNAME,    --hostname HOSTNAME         Device hostname\n    -d DISPLAYNAME, --displayname DISPLAYNAME   Device display name\n```\n\n### datasource_sdt.py\nThis script places a datasource in scheduled down time (SDT) or maintenance mode.\nThis will suppress alerting for the duration of the SDT. This script is not\nidempotent and the same datasource can be put into SDT multiple times. For more\ninformation on managing datasources\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-datasources-instances/).\n\n\n```\n$\u003e python ./examples/datasource_sdt.py  -h\nusage: device_sdt.py [-h] -c COMPANY -u USER -p PASSWORD -i ID\n    required arguments:\n       -c COMPANY,     --company COMPANY           LogicMonitor account\n       -u USER,        --user USER                 LogicMonitor user name\n       -p PASSWORD,    --password PASSWORD         LogicMonitor password\n    optional arguments:\n       -h, --help                                  Show this help message and exit\n       -i ID,          --id ID                     Datasource ID\n```\n\n### list_devices.py\nThis script list all devices being monitored in your LogicMonitor account.\n\n```\n$\u003e python ./examples/list_devices.py -h\nusage: device_add.py [-h] -c COMPANY -u USER -p PASSWORD\n                   [-g GROUP]\nrequired arguments:\n    -c COMPANY,   --company COMPANY                     LogicMonitor account\n    -u USER,      --user USER                           LogicMonitor user name\n    -p PASSWORD,  --password PASSWORD                   LogicMonitor password\n\noptional arguments:\n  -h,             --help                                Show this help message and exit\n  -g GROUP,    --group GROUP                   Limit the results to hosts in the group path specified. Example: /Servers\n\n```\n\n### devicegroup_add.py\nThis idempotent script adds a new device group to your LogicMonitor account.\nThis addition includes setting device properties and group membership.\nIf the groups required for the addition of this device do not exist, they will\nbe created. For more information on managing device groups\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-groups/).\n\n```\n$\u003e python ./examples/devicegroup_add.py -h\nusage: devicegroup_add.py [-h] -c COMPANY -u USER -p PASSWORD -f FULLPATH\n                        [--description DESCRIPTION] [-P PROPERTIES]\n                        [-a ALERTENABLE]\nrequired arguments:\n    -c COMPANY,     --company COMPANY               LogicMonitor account\n    -u USER,        --user USER                     LogicMonitor user name\n    -p PASSWORD,    --password PASSWORD             LogicMonitor password\n    -f FULLPATH,    --fullpath FULLPATH             Full path of the device group\noptional arguments:\n    -h,             --help                          Show this help message and exit\n    -P PROPERTIES,  --properties PROPERTIES         A dictionary of properties to set for the device\n    -a ALERTENABLE, --alertenable ALERTENABLE       Turn alerting on or off\n    --description DESCRIPTION                       Text description of the device\n```\n\n### devicegroup_remove.py\nThis idempotent script removes a device group from your LogicMonitor account.\nFor more information on managing device groups\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-groups/).\n\n```\n$\u003e python ./examples/devicegroup_remove.py -h\nusage: devicegroup_remove.py [-h] -c COMPANY -u USER -p PASSWORD -f FULLPATH\nrequired arguments:\n    -c COMPANY,  --company COMPANY      LogicMonitor account\n    -u USER,     --user USER            LogicMonitor user name\n    -p PASSWORD, --password PASSWORD    LogicMonitor password\n    -f FULLPATH, --fullpath FULLPATH    Full path of the device group\noptional arguments:\n    -h,          --help                 Show this help message and exit\n```\n\n### devicegroup_update.py\nThis idempotent script updates a device group that in your LogicMonitor account. If the device group doesn't exist, it will create it. For most information about\nmanaging device groups\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-groups/).\n\n```\n$\u003e python ./examples/devicegroup_update.py -h\nusage: devicegroup_update.py [-h] -c COMPANY -u USER -p PASSWORD -f FULLPATH\n                           [--description DESCRIPTION] [-P PROPERTIES]\n                           [-a ALERTENABLE]\nrequired arguments:\n    -c COMPANY,     --company COMPANY           LogicMonitor account\n    -u USER,        --user USER                 LogicMonitor user name\n    -p PASSWORD,    --password PASSWORD         LogicMonitor password\n    -f FULLPATH,    --fullpath FULLPATH         Full path of the device group\noptional arguments:\n    -h,             --help                      Show this help message and exit\n    -P PROPERTIES,  --properties PROPERTIES     A dictionary of properties to set for the device\n    -a ALERTENABLE, --alertenable ALERTENABLE   Turn alerting on or off\n    --description DESCRIPTION                   Text description of the device\n```\n\n### devicegroup_sdt.py\nThis script places a device group in scheduled down time (SDT) or maintenance\nmode. This will suppress alerting for the duration of the SDT. This script is\nnot idempotent and the same device can be put into SDT multiple times.\nFor more information on managing device groups\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-groups/).\n\n```\n$\u003e python ./examples/devicegroup_sdt.py -h\nusage: devicegroup_sdt.py [-h] -c COMPANY -u USER -p PASSWORD -f FULLPATH\n                        [-D DURATION] [-s STARTTIME]\nrequired arguments:\n    -c COMPANY,   --company COMPANY       LogicMonitor account\n    -u USER,      --user USER             LogicMonitor user name\n    -p PASSWORD,  --password PASSWORD     LogicMonitor password\n    -f FULLPATH,  --fullpath FULLPATH     Full path of the device group\noptional arguments:\n    -h,           --help                  Show this help message and exit\n    -D DURATION,  --duration DURATION     SDT duration\n    -s STARTTIME, --starttime STARTTIME   SDT start time\n```\n\n### devicegroup_info.py\nThis script retrieves and displays information about a device group in your LogicMonitor account. For more information on managing device groups\n[click here](http://help.logicmonitor.com/the-new-ui/devices/device-groups/).\n\n```\n$\u003e python ./examples/devicegroup_info.py -h\nusage: devicegroup_info.py [-h] -c COMPANY -u USER -p PASSWORD -f FULLPATH\nrequired arguments:\n    -c COMPANY,  --company COMPANY        LogicMonitor account\n    -u USER,     --user USER              LogicMonitor user name\n    -p PASSWORD, --password PASSWORD      LogicMonitor password\n    -f FULLPATH, --fullpath FULLPATH      Full path of the device group\noptional arguments:\n    -h,          --help                   Show this help message and exit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicmonitor%2Flm_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm_python/lists"}