forked from meraki/automation-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreboot.py
More file actions
executable file
·46 lines (34 loc) · 918 Bytes
/
reboot.py
File metadata and controls
executable file
·46 lines (34 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
import meraki
import sys
dashboard = meraki.DashboardAPI(suppress_logging=True)
def reboot(file):
with open(file, 'r') as device:
for i in device:
serial = i.strip()
response = dashboard.devices.rebootDevice(serial)
print(f'Device {serial} was rebooted {response}')
sys.exit()
if __name__ == '__main__':
try:
sys.argv[1]
except IndexError:
print("Please provide a file with serial numbers")
sys.exit()
else:
file = ' '.join(sys.argv[1:])
reboot(file)
read_me = '''
A Python 3 script to reboot Meraki Devices.
Required Python modules:
meraki
Usage:
bssid.py file.txt
"file" should be a txt with the list of serail numbers that need to be rebooted
one on each line
serial1
serial2
serial3
API Key
requires you to have your API key in env vars as 'MERAKI_DASHBOARD_API_KEY'
'''