Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion 10 eem_configdiff_to_spark/sl_config_diff_to_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
#
# spark_token : Bearer token for your Spark user/bot
# spark_room : Spark room name to which messages will be sent
# device_name : Device name from which the messages will be sent
#
# E.g.:
#
# event manager environment spark_token Bearer 1234abd...
# event manager environment spark_room Network Operators
# event manager environment device_name C3850
#

import eem
Expand All @@ -58,6 +60,10 @@
eem.action_syslog(
'Environment variable "spark_room" must be set', priority='3')
sys.exit(1)
if 'device_name' not in arr_envinfo:
eem.action_syslog(
'Environment variable "device_name" must be set', priority='3')
sys.exit(1)

# Get a CLI handle
cli = eem.cli_open()
Expand Down Expand Up @@ -98,7 +104,9 @@
# No differences found
sys.exit(0)

msg = 'Configuration differences between the running config and last backup:\n'
device_name = arr_envinfo['device_name']
msg = '### Alert: Config changed on ' + device_name + '\n'
msg += 'Configuration differences between the running config and last backup:\n'
msg += '```{}```'.format('\n'.join(diff_lines[:-1]))

headers = {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.