mirror of
https://github.com/myronblair/jarvis
synced 2026-07-28 08:43:00 -05:00
Compare commits
6 Commits
8399048252
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ee0e116963 | |||
| adbd1a7a24 | |||
| 73aac8ab01 | |||
| 646da21b86 | |||
| d97a345672 | |||
| 141191bcdd |
@@ -12,7 +12,7 @@ fi
|
|||||||
SUBNET="10.48.200.0/24"
|
SUBNET="10.48.200.0/24"
|
||||||
|
|
||||||
TMPFILE=$(mktemp)
|
TMPFILE=$(mktemp)
|
||||||
nmap -sn --send-ip "$SUBNET" 2>/dev/null > "$TMPFILE"
|
nmap -sn "$SUBNET" 2>/dev/null > "$TMPFILE"
|
||||||
|
|
||||||
if [ ! -s "$TMPFILE" ]; then
|
if [ ! -s "$TMPFILE" ]; then
|
||||||
echo "$(date): nmap produced no output" >&2
|
echo "$(date): nmap produced no output" >&2
|
||||||
|
|||||||
@@ -197,6 +197,11 @@ function collect_all(): array {
|
|||||||
'orbisportal' => 'https://orbis.orbishosting.com',
|
'orbisportal' => 'https://orbis.orbishosting.com',
|
||||||
'tomtomgames' => 'https://tomtomgames.com',
|
'tomtomgames' => 'https://tomtomgames.com',
|
||||||
];
|
];
|
||||||
|
// Sites intentionally gated behind HTTP Basic Auth (e.g. a password-protected
|
||||||
|
// "Coming Soon" page during a rebuild) — treat these status codes as up, not down.
|
||||||
|
$expectedCodes = [
|
||||||
|
'parkerslingshotrentals' => [401],
|
||||||
|
];
|
||||||
$down = [];
|
$down = [];
|
||||||
foreach ($sites as $key => $url) {
|
foreach ($sites as $key => $url) {
|
||||||
$parsed = parse_url($url);
|
$parsed = parse_url($url);
|
||||||
@@ -216,7 +221,8 @@ function collect_all(): array {
|
|||||||
curl_exec($ch);
|
curl_exec($ch);
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
$status = ($code >= 200 && $code < 400) ? 'up' : "down-$code";
|
$ok = ($code >= 200 && $code < 400) || in_array($code, $expectedCodes[$key] ?? [], true);
|
||||||
|
$status = $ok ? 'up' : "down-$code";
|
||||||
KBEngine::storeFact('sites', $key, $status, $url, 180);
|
KBEngine::storeFact('sites', $key, $status, $url, 180);
|
||||||
if ($status !== 'up') $down[] = "$key($code)";
|
if ($status !== 'up') $down[] = "$key($code)";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ foreach ($devices as $d) {
|
|||||||
if (!$ip) continue;
|
if (!$ip) continue;
|
||||||
|
|
||||||
$discoveredIPs[] = $ip;
|
$discoveredIPs[] = $ip;
|
||||||
|
if ($mac) {
|
||||||
|
// Device likely moved to a new IP (DHCP) — drop the stale row so it
|
||||||
|
// doesn't linger as an orphaned duplicate under the old address.
|
||||||
|
JarvisDB::execute('DELETE FROM network_devices WHERE mac=? AND ip<>?', [$mac, $ip]);
|
||||||
|
}
|
||||||
JarvisDB::execute(
|
JarvisDB::execute(
|
||||||
'INSERT INTO network_devices (ip, mac, hostname, status, last_seen)
|
'INSERT INTO network_devices (ip, mac, hostname, status, last_seen)
|
||||||
VALUES (?,?,?,?,NOW())
|
VALUES (?,?,?,?,NOW())
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ if ($weatherAge > 1800) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$weatherRaw = curlGet(
|
$weatherRaw = curlGet(
|
||||||
'https://wttr.in/FortWorth,TX?format=j1',
|
'https://wttr.in/76088?format=j1',
|
||||||
['User-Agent: curl/7.88 Jarvis/1.0'],
|
['User-Agent: curl/7.88 Jarvis/1.0'],
|
||||||
15
|
15
|
||||||
);
|
);
|
||||||
@@ -245,7 +245,7 @@ if ($weatherAge > 1800) {
|
|||||||
|
|
||||||
cacheStore('weather', [
|
cacheStore('weather', [
|
||||||
'source' => 'wttr.in',
|
'source' => 'wttr.in',
|
||||||
'location' => 'Fort Worth, TX',
|
'location' => 'Weatherford, TX',
|
||||||
'current' => [
|
'current' => [
|
||||||
'temp' => (int)($cu['temp_F'] ?? 0),
|
'temp' => (int)($cu['temp_F'] ?? 0),
|
||||||
'feels' => (int)($cu['FeelsLikeF'] ?? 0),
|
'feels' => (int)($cu['FeelsLikeF'] ?? 0),
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ if [ -f "$WDLOG" ]; then
|
|||||||
'match($0,/^\[([0-9-]+ [0-9:]+)\]/,m){ if(m[1]>=cutoff && /restarted successfully/) print }' "$WDLOG")
|
'match($0,/^\[([0-9-]+ [0-9:]+)\]/,m){ if(m[1]>=cutoff && /restarted successfully/) print }' "$WDLOG")
|
||||||
if [ -n "$RECENT" ]; then
|
if [ -n "$RECENT" ]; then
|
||||||
SVC=$(printf '%s' "$RECENT" | grep -oE '(nginx|php8.3-fpm|mariadb|redis-server)' | sort -u | tr '\n' ' ')
|
SVC=$(printf '%s' "$RECENT" | grep -oE '(nginx|php8.3-fpm|mariadb|redis-server)' | sort -u | tr '\n' ' ')
|
||||||
raise "health:wd_restart:$(date +%Y%m%d%H%M)" "warning" "Service auto-restarted" "Watchdog restarted: ${SVC:-a service}. Investigate why it died."
|
raise "health:wd_restart" "warning" "Service auto-restarted" "Watchdog restarted: ${SVC:-a service}. Investigate why it died."
|
||||||
|
else
|
||||||
|
clear_cond "health:wd_restart"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -982,6 +982,7 @@ async function loadWeather() {
|
|||||||
const d = await api('weather');
|
const d = await api('weather');
|
||||||
if (!d || !d.current) return;
|
if (!d || !d.current) return;
|
||||||
const c = d.current;
|
const c = d.current;
|
||||||
|
if (d.location) document.getElementById('weather-loc').textContent = d.location.toUpperCase();
|
||||||
document.getElementById('weather-temp').textContent = c.temp;
|
document.getElementById('weather-temp').textContent = c.temp;
|
||||||
document.getElementById('weather-desc').textContent = (c.desc || '').toUpperCase();
|
document.getElementById('weather-desc').textContent = (c.desc || '').toUpperCase();
|
||||||
document.getElementById('weather-feels').textContent = c.feels + '°F';
|
document.getElementById('weather-feels').textContent = c.feels + '°F';
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
<div id="leftPanel">
|
<div id="leftPanel">
|
||||||
<!-- Weather Widget -->
|
<!-- Weather Widget -->
|
||||||
<div class="panel" style="flex:0 0 auto">
|
<div class="panel" style="flex:0 0 auto">
|
||||||
<div class="panel-title">WEATHER <span id="weather-loc" style="font-size:0.55rem;color:var(--text-dim)">FORT WORTH, TX</span></div>
|
<div class="panel-title">WEATHER <span id="weather-loc" style="font-size:0.55rem;color:var(--text-dim)">WEATHERFORD, TX</span></div>
|
||||||
<div style="display:flex;align-items:flex-start;gap:12px;margin-bottom:8px">
|
<div style="display:flex;align-items:flex-start;gap:12px;margin-bottom:8px">
|
||||||
<div style="flex:1">
|
<div style="flex:1">
|
||||||
<div style="display:flex;align-items:baseline;gap:8px">
|
<div style="display:flex;align-items:baseline;gap:8px">
|
||||||
|
|||||||
Reference in New Issue
Block a user