From d18276aee40ce8f5ee24756a853481f55ef08c10 Mon Sep 17 00:00:00 2001 From: Tanner van Teeffelen <37911073+TannerVT@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:31:53 -0400 Subject: [PATCH] Added the ability to set a nick name for the device to be monitored. --- .idea/.gitignore | 5 +++++ .idea/MerakiApiUtilities.iml | 10 ++++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ README.md | 4 ++++ deviceCheck.py | 5 +++-- 7 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/MerakiApiUtilities.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/MerakiApiUtilities.iml b/.idea/MerakiApiUtilities.iml new file mode 100644 index 0000000..74e763a --- /dev/null +++ b/.idea/MerakiApiUtilities.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3528daf --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 610850f..ef0bc38 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ The following environment variables must be defined in your `.env` file: The MAC address of the device you want to monitor. `Required by deviceCheck.py.` +- **DEVICE_NICK** + The nickname of the device you want to monitor. + `Required by deviceCheck.py.` + - **SMTP_SERVER** Your outgoing SMTP mail server address. `Required by deviceCheck.py.` diff --git a/deviceCheck.py b/deviceCheck.py index 6072120..5430e9d 100644 --- a/deviceCheck.py +++ b/deviceCheck.py @@ -4,12 +4,13 @@ from datetime import datetime, timezone from email.message import EmailMessage from dotenv import load_dotenv +#Load environment variables, and then assign them to internal variables. load_dotenv() -#Variable declaration. API_KEY = os.getenv("API_KEY") NETWORK_ID = os.getenv("NETWORK_ID") CLIENT_MAC = os.getenv("CLIENT_MAC") +CLIENT_NICK = os.getenv("CLIENT_NICK") #Passes the API key to the header. HEADERS = { @@ -71,7 +72,7 @@ while True: print("Sending email alert...") send_email( subject="Meraki Alert", - body="Client " + CLIENT_MAC + " is offline!", + body="Client " + CLIENT_NICK + "(" + CLIENT_MAC + ") is offline!", to_email=os.getenv("SMTP_RECEIVER") )