def main(): csv_path = "data/example_nodes.csv" tool_bag = Tools() # Set keys = None if you're not using IN in your query # Otherwise, provide csv file with node names at given index keys = tool_bag.csv_pull_key(csv_path, 0) # Put your query here query_str = """SELECT TOP 10 NodeName, NodeID, Uri FROM Orion.Nodes WHERE NodeName IN %s""" # Put your suppression dates here suppress_start = '04/28/2019 08:00 AM' suppress_end = '04/28/2019 08:01 AM' #updated_props = {'City': None} # Authentication username = input("Username: "******"Password: "******"solarwinds.server" sw = SolarWindsInterface(username, password, server) # Send your query. sw.query(query_str, nodes=keys) # Suppress alerts sw.suppress_alerts(suppress_start, suppress_end) print("Exit status complete")
def main(): """Demonstrates different methods available within the Chef Interface""" chef = ChefAPI() chef.auth() tool_bag = Tools() index = 'node' query = 'name:node' header = {} nodes = tool_bag.csv_pull_key('data/example_nodes.csv', 0) response = json.loads(chef.chef_search()) response = json.loads(chef.chef_search(index=index)) response = json.loads(chef.chef_search(index=index, query=query)) response = json.loads( chef.chef_search(index=index, query=query, header=header)) response = chef.chef_get('/nodes/tst2asvcnow') response = json.loads(chef.chef_get('/nodes/', 'tst2asvcnow')) print(response['chef_environment']) with open('chef_search.json', 'w') as file: json.dump(response, file, indent=4)