better widescreen support

This commit is contained in:
Jokob-sk
2023-03-15 18:13:21 +11:00
parent 63a9e55d4e
commit 642e8464cd
5 changed files with 19 additions and 31 deletions

View File

@@ -1,12 +1,11 @@
## Overview
A simple sample plugin allowing for monitoring web services or urls. The status code corresponds to the commonly used [HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).
A simple sample plugin allowing for detecting rogue DHCP servers on the network.
### Usage
- The user can specify which services (websites) to monitor via the `WEBMON_urls_to_check` setting.
- No specific configuration needed.
### Notes
- Setting `(WEBMON_)SQL_internet_ip` is not used and specified for demonstration purposes only.
- Parameters `macs` and `internet_ip` in the `config.json` file are not used and specified for demonstration purposes only.
- No specific configuration needed.

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env python
# Based on the work of https://github.com/leiweibau/Pi.Alert
# /home/pi/pialert/front/plugins/website_monitor/script.py urls=http://google.com,http://bing.com
from __future__ import unicode_literals
from time import sleep, time, strftime
import requests
@@ -9,14 +8,10 @@ import pathlib
import threading
import subprocess
import socket
import argparse
import io
#import smtplib
import sys
#from smtp_config import sender, password, receivers, host, port
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import pwd
import os
@@ -43,10 +38,6 @@ def main():
#dhcp_server_list_time = []
for _ in range(dhcp_probes):
output = subprocess.check_output (nmapArgs, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(timeoutSec ))
# stream = os.popen('sudo nmap --script broadcast-dhcp-discover 2>/dev/null')
# output = stream.read()
# last_run_logfile.write(output)
newLines = newLines + output.split("\n")
# parse output
@@ -60,14 +51,10 @@ def main():
else:
index = len(newEntries) - 1
if 'Response ' in line and ' of ' in line:
newEntries.append(plugin_object_class())
if 'Response ' in line and ' of ' in line:
newEntries.append(plugin_object_class())
elif 'Server Identifier' in line :
newEntries[index].primaryId = line.split(':')[1].strip()
elif 'Domain Name' in line :
newEntries[index].secondaryId = line.split(':')[1].strip()
elif 'Domain Name Server' in line :
@@ -80,12 +67,10 @@ def main():
newEntries[index].watched4 = line.split(':')[1].strip()
newEntries[index].foreignKey = line.split(':')[1].strip()
elif ('IP Address Lease Time' in line or 'Subnet Mask' in line or 'Broadcast Address' in line) :
newEntries[index].extra = newEntries[index].extra + ',' + line.split(':')[1].strip()
newEntries[index].extra = newEntries[index].extra + ',' + line.split(':')[1].strip()
for e in newEntries:
# Insert list into the log
# Insert list into the log
service_monitoring_log(e.primaryId, e.secondaryId, e.created, e.watched1, e.watched2, e.watched3, e.watched4, e.extra, e.foreignKey )
# -----------------------------------------------------------------------------