Added the ability to set a nick name for the device to be monitored.
This commit is contained in:
parent
14dd927d95
commit
d18276aee4
7 changed files with 42 additions and 2 deletions
5
.idea/.gitignore
generated
vendored
Normal file
5
.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
10
.idea/MerakiApiUtilities.iml
generated
Normal file
10
.idea/MerakiApiUtilities.iml
generated
Normal 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>
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal 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
8
.idea/modules.xml
generated
Normal 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
6
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -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.
|
The MAC address of the device you want to monitor.
|
||||||
`Required by deviceCheck.py.`
|
`Required by deviceCheck.py.`
|
||||||
|
|
||||||
|
- **DEVICE_NICK**
|
||||||
|
The nickname of the device you want to monitor.
|
||||||
|
`Required by deviceCheck.py.`
|
||||||
|
|
||||||
- **SMTP_SERVER**
|
- **SMTP_SERVER**
|
||||||
Your outgoing SMTP mail server address.
|
Your outgoing SMTP mail server address.
|
||||||
`Required by deviceCheck.py.`
|
`Required by deviceCheck.py.`
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,13 @@ from datetime import datetime, timezone
|
||||||
from email.message import EmailMessage
|
from email.message import EmailMessage
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
#Load environment variables, and then assign them to internal variables.
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
#Variable declaration.
|
|
||||||
API_KEY = os.getenv("API_KEY")
|
API_KEY = os.getenv("API_KEY")
|
||||||
NETWORK_ID = os.getenv("NETWORK_ID")
|
NETWORK_ID = os.getenv("NETWORK_ID")
|
||||||
CLIENT_MAC = os.getenv("CLIENT_MAC")
|
CLIENT_MAC = os.getenv("CLIENT_MAC")
|
||||||
|
CLIENT_NICK = os.getenv("CLIENT_NICK")
|
||||||
|
|
||||||
#Passes the API key to the header.
|
#Passes the API key to the header.
|
||||||
HEADERS = {
|
HEADERS = {
|
||||||
|
|
@ -71,7 +72,7 @@ while True:
|
||||||
print("Sending email alert...")
|
print("Sending email alert...")
|
||||||
send_email(
|
send_email(
|
||||||
subject="Meraki Alert",
|
subject="Meraki Alert",
|
||||||
body="Client " + CLIENT_MAC + " is offline!",
|
body="Client " + CLIENT_NICK + "(" + CLIENT_MAC + ") is offline!",
|
||||||
to_email=os.getenv("SMTP_RECEIVER")
|
to_email=os.getenv("SMTP_RECEIVER")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue