Added the ability to set a nick name for the device to be monitored.

This commit is contained in:
Tanner van Teeffelen 2026-06-05 15:31:53 -04:00
parent 14dd927d95
commit d18276aee4
7 changed files with 42 additions and 2 deletions

5
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

10
.idea/MerakiApiUtilities.iml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.14 (MerakiApiUtilities)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

8
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MerakiApiUtilities.iml" filepath="$PROJECT_DIR$/.idea/MerakiApiUtilities.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -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.`

View file

@ -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")
)