Instantly turn Splunk alerts into SMS notifications using a Huawei B315 LTE modem with a SIM card! This Python package is tailored for air-gapped environments, offering offline installation with pre-bundled
huawei-lte-apiwheels. Perfect for critical monitoring in remote or secure setups.
- Splunk Integration: Triggers SMS via Splunk's "Run a Script" action using
SendSMS.py. - Huawei B315 Support: Seamlessly connects to the modem’s HTTP API (default: 192.168.8.1).
- Offline Installation: Uses
Toch_TO_INSTALL.pyto install dependencies frompython-packages/. - Robust & Lightweight: Error-handled script for reliable alerting, tested on Python 3.8+.
| File/Folder | Description |
|---|---|
python-packages/ |
Offline .whl files (huawei-lte-api, etc.) |
SendSMS.py |
Main script for sending SMS |
Toch_TO_INSTALL.py |
Script for offline dependency installation |
ReDMe |
Basic setup instructions |
requirements.txt |
Dependencies for online install (optional) |
LICENSE |
MIT License |
- Python: Version 3.8 or higher (check:
python3 --version). - Huawei B315 Modem: Configured with an active SIM card and accessible via IP (default:
192.168.8.1,admin/admin). - Splunk Server: Set up with alerts/reports and "Run a Script" action enabled.
For air-gapped systems:
- Clone or download the repository:
git clone https://github.com/Ali-MJI/Huawei-SMS-Splunk-B315.git cd SMS-Packages-B315 - Move the
python-packagesfolder to/opt:mv python-packages /opt
- Run the offline installer:
chmod +x Toch_TO_INSTALL.py ./Toch_TO_INSTALL.py
This installs
huawei-lte-apifrom/opt/python-packages/*.whl. - Verify Python version:
python3 --version
Install dependencies via pip:
pip3 install -r requirements.txtNote: Python 3.8+ includes
dataclassesby default. For Python < 3.7, add thedataclasseswheel topython-packages/.
-
Configure Splunk:
- Create/edit an alert in Splunk.
- Add a "Run a Script" action, pointing to
SendSMS.py. - Pass alert data (e.g.,
$result.field$) as the message.
-
Edit
SendSMS.py:- Update the phone number, message, and modem credentials.
- Example (from
SendSMS.py):from huawei_lte_api.Connection import Connection from huawei_lte_api.Client import Client phone = "+1234567890" # Your phone number message = "Test alert from Splunk" # Or Splunk alert data url = 'http://admin:[email protected]/' try: with Connection(url) as connection: client = Client(connection) client.sms.send_sms([phone], message) print(f"SMS sent successfully to {phone}: {message}") except Exception as e: print(f"Error sending SMS: {e}") exit(1)
-
Test the Script:
python3 SendSMS.py
-
Deploy in Splunk: The script runs automatically when triggered by Splunk alerts.
In a remote data center with no internet, a Splunk alert detects a server outage.
SendSMS.pysends an SMS via the Huawei B315 modem to the on-call engineer, ensuring rapid response without network dependency.
- Modem Connection: Verify IP (
192.168.8.1) and credentials. Test API in a browser:http://192.168.8.1/api/device/information. - Splunk Script: Ensure
SendSMS.pyis executable (chmod +x SendSMS.py) and in Splunk’s script path (e.g.,$SPLUNK_HOME/bin/scripts). - Dependencies: Check
.whlfiles in/opt/python-packages/. For Python < 3.7, adddataclasseswheel. - Logs: Review modem or Splunk execution logs for errors.
We love contributions! Here’s how to get involved:
- 🐛 Report bugs: Open an Issue.
- 💡 Suggest features/fixes: Submit a Pull Request.
- 🌟 Star the repo if it saves your on-call shifts!
Get the full package from Releases (includes SMS-Packages-B315.zip for offline use).
MIT License – Free to use, modify, and share.
- Thanks to the
huawei-lte-apiproject for robust modem integration.
🌟 Star this repo to support offline Splunk alerting! Got questions? Drop a comment or open an issue. 🚀