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"
|
||||
|
||||
TMPFILE=$(mktemp)
|
||||
nmap -sn --send-ip "$SUBNET" 2>/dev/null > "$TMPFILE"
|
||||
nmap -sn "$SUBNET" 2>/dev/null > "$TMPFILE"
|
||||
|
||||
if [ ! -s "$TMPFILE" ]; then
|
||||
echo "$(date): nmap produced no output" >&2
|
||||
|
||||
@@ -197,6 +197,11 @@ function collect_all(): array {
|
||||
'orbisportal' => 'https://orbis.orbishosting.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 = [];
|
||||
foreach ($sites as $key => $url) {
|
||||
$parsed = parse_url($url);
|
||||
@@ -216,7 +221,8 @@ function collect_all(): array {
|
||||
curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
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);
|
||||
if ($status !== 'up') $down[] = "$key($code)";
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ foreach ($devices as $d) {
|
||||
if (!$ip) continue;
|
||||
|
||||
$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(
|
||||
'INSERT INTO network_devices (ip, mac, hostname, status, last_seen)
|
||||
VALUES (?,?,?,?,NOW())
|
||||
|
||||
@@ -213,7 +213,7 @@ if ($weatherAge > 1800) {
|
||||
};
|
||||
|
||||
$weatherRaw = curlGet(
|
||||
'https://wttr.in/FortWorth,TX?format=j1',
|
||||
'https://wttr.in/76088?format=j1',
|
||||
['User-Agent: curl/7.88 Jarvis/1.0'],
|
||||
15
|
||||
);
|
||||
@@ -245,7 +245,7 @@ if ($weatherAge > 1800) {
|
||||
|
||||
cacheStore('weather', [
|
||||
'source' => 'wttr.in',
|
||||
'location' => 'Fort Worth, TX',
|
||||
'location' => 'Weatherford, TX',
|
||||
'current' => [
|
||||
'temp' => (int)($cu['temp_F'] ?? 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")
|
||||
if [ -n "$RECENT" ]; then
|
||||
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
|
||||
|
||||
|
||||
@@ -982,6 +982,7 @@ async function loadWeather() {
|
||||
const d = await api('weather');
|
||||
if (!d || !d.current) return;
|
||||
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-desc').textContent = (c.desc || '').toUpperCase();
|
||||
document.getElementById('weather-feels').textContent = c.feels + '°F';
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<div id="leftPanel">
|
||||
<!-- Weather Widget -->
|
||||
<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="flex:1">
|
||||
<div style="display:flex;align-items:baseline;gap:8px">
|
||||
|
||||
Reference in New Issue
Block a user