I have this Python script:
"""
Get a monitor's details returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.monitors_api import MonitorsApi
id = int(input("Write the monitor ID: "))
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = MonitorsApi(api_client)
response = api_instance.get_monitor(
monitor_id=id,
)
print("Type:",response["type"])
print("Name:",response["name"])
print("State:",response["overall_state"])
How do I add a .sh script on linux that passes the monitor_id
?
CodePudding user response:
.sh file
python3 test.py arg1 arg2 arg3
.py file
import sys
arguments = sys.argv[1:]
print(arguments)
# ['arg1', 'arg2', 'arg3']