mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-21 06:58:20 +00:00
Compare commits
4 Commits
v1.3.5
...
renovate/e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0caef97edb | ||
|
|
c6a2163e79 | ||
|
|
b55ee6a6e0 | ||
|
|
189de7a593 |
@@ -197,6 +197,40 @@ while IFS= read -r line; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if agent is already installed and working BEFORE enrollment
|
||||||
|
info " Checking if agent is already configured..."
|
||||||
|
config_check=$(timeout 10 pct exec "$vmid" -- bash -c "
|
||||||
|
if [[ -f /etc/patchmon/config.yml ]] && [[ -f /etc/patchmon/credentials.yml ]]; then
|
||||||
|
if [[ -f /usr/local/bin/patchmon-agent ]]; then
|
||||||
|
# Try to ping using existing configuration
|
||||||
|
if /usr/local/bin/patchmon-agent ping >/dev/null 2>&1; then
|
||||||
|
echo 'ping_success'
|
||||||
|
else
|
||||||
|
echo 'ping_failed'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo 'binary_missing'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo 'not_configured'
|
||||||
|
fi
|
||||||
|
" 2>/dev/null </dev/null || echo "error")
|
||||||
|
|
||||||
|
if [[ "$config_check" == "ping_success" ]]; then
|
||||||
|
info " ✓ Host already enrolled and agent ping successful - skipping enrollment"
|
||||||
|
((skipped_count++)) || true
|
||||||
|
echo ""
|
||||||
|
continue
|
||||||
|
elif [[ "$config_check" == "ping_failed" ]]; then
|
||||||
|
warn " ⚠ Agent configuration exists but ping failed - will re-enroll and reinstall"
|
||||||
|
elif [[ "$config_check" == "binary_missing" ]]; then
|
||||||
|
warn " ⚠ Config exists but agent binary missing - will re-enroll and reinstall"
|
||||||
|
elif [[ "$config_check" == "not_configured" ]]; then
|
||||||
|
info " ℹ Agent not yet configured - proceeding with enrollment"
|
||||||
|
else
|
||||||
|
warn " ⚠ Could not check agent status - proceeding with enrollment"
|
||||||
|
fi
|
||||||
|
|
||||||
# Call PatchMon auto-enrollment API
|
# Call PatchMon auto-enrollment API
|
||||||
info " Enrolling $friendly_name in PatchMon..."
|
info " Enrolling $friendly_name in PatchMon..."
|
||||||
|
|
||||||
@@ -230,40 +264,6 @@ while IFS= read -r line; do
|
|||||||
|
|
||||||
info " ✓ Host enrolled successfully: $api_id"
|
info " ✓ Host enrolled successfully: $api_id"
|
||||||
|
|
||||||
# Check if agent is already installed and working
|
|
||||||
info " Checking if agent is already configured..."
|
|
||||||
config_check=$(timeout 10 pct exec "$vmid" -- bash -c "
|
|
||||||
if [[ -f /etc/patchmon/config.yml ]] && [[ -f /etc/patchmon/credentials.yml ]]; then
|
|
||||||
if [[ -f /usr/local/bin/patchmon-agent ]]; then
|
|
||||||
# Try to ping using existing configuration
|
|
||||||
if /usr/local/bin/patchmon-agent ping >/dev/null 2>&1; then
|
|
||||||
echo 'ping_success'
|
|
||||||
else
|
|
||||||
echo 'ping_failed'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo 'binary_missing'
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo 'not_configured'
|
|
||||||
fi
|
|
||||||
" 2>/dev/null </dev/null || echo "error")
|
|
||||||
|
|
||||||
if [[ "$config_check" == "ping_success" ]]; then
|
|
||||||
info " ✓ Host already enrolled and agent ping successful - skipping"
|
|
||||||
((skipped_count++)) || true
|
|
||||||
echo ""
|
|
||||||
continue
|
|
||||||
elif [[ "$config_check" == "ping_failed" ]]; then
|
|
||||||
warn " ⚠ Agent configuration exists but ping failed - will reinstall"
|
|
||||||
elif [[ "$config_check" == "binary_missing" ]]; then
|
|
||||||
warn " ⚠ Config exists but agent binary missing - will reinstall"
|
|
||||||
elif [[ "$config_check" == "not_configured" ]]; then
|
|
||||||
info " ℹ Agent not yet configured - proceeding with installation"
|
|
||||||
else
|
|
||||||
warn " ⚠ Could not check agent status - proceeding with installation"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure curl is installed in the container
|
# Ensure curl is installed in the container
|
||||||
info " Checking for curl in container..."
|
info " Checking for curl in container..."
|
||||||
curl_check=$(timeout 10 pct exec "$vmid" -- bash -c "command -v curl >/dev/null 2>&1 && echo 'installed' || echo 'missing'" 2>/dev/null </dev/null || echo "error")
|
curl_check=$(timeout 10 pct exec "$vmid" -- bash -c "command -v curl >/dev/null 2>&1 && echo 'installed' || echo 'missing'" 2>/dev/null </dev/null || echo "error")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"cookie-parser": "^1.4.7",
|
"cookie-parser": "^1.4.7",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"express": "^4.21.2",
|
"express": "^5.0.0",
|
||||||
"express-rate-limit": "^7.5.0",
|
"express-rate-limit": "^7.5.0",
|
||||||
"express-validator": "^7.2.0",
|
"express-validator": "^7.2.0",
|
||||||
"helmet": "^8.0.0",
|
"helmet": "^8.0.0",
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const {
|
|||||||
} = require("../middleware/permissions");
|
} = require("../middleware/permissions");
|
||||||
const { queueManager, QUEUE_NAMES } = require("../services/automation");
|
const { queueManager, QUEUE_NAMES } = require("../services/automation");
|
||||||
const { pushIntegrationToggle, isConnected } = require("../services/agentWs");
|
const { pushIntegrationToggle, isConnected } = require("../services/agentWs");
|
||||||
const agentVersionService = require("../services/agentVersionService");
|
|
||||||
const { compareVersions } = require("../services/automation/shared/utils");
|
const { compareVersions } = require("../services/automation/shared/utils");
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"express": "^4.21.2",
|
"express": "^5.0.0",
|
||||||
"http-proxy-middleware": "^3.0.3",
|
"http-proxy-middleware": "^3.0.3",
|
||||||
"lucide-react": "^0.468.0",
|
"lucide-react": "^0.468.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ const Hosts = () => {
|
|||||||
const showFiltersParam = searchParams.get("showFilters");
|
const showFiltersParam = searchParams.get("showFilters");
|
||||||
const osFilterParam = searchParams.get("osFilter");
|
const osFilterParam = searchParams.get("osFilter");
|
||||||
const groupParam = searchParams.get("group");
|
const groupParam = searchParams.get("group");
|
||||||
const rebootParam = searchParams.get("reboot");
|
|
||||||
|
|
||||||
if (filter === "needsUpdates") {
|
if (filter === "needsUpdates") {
|
||||||
setShowFilters(true);
|
setShowFilters(true);
|
||||||
@@ -1219,7 +1218,7 @@ const Hosts = () => {
|
|||||||
navigate("/hosts", { replace: true });
|
navigate("/hosts", { replace: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpToDateClick = () => {
|
const _handleUpToDateClick = () => {
|
||||||
// Filter to show only up-to-date hosts
|
// Filter to show only up-to-date hosts
|
||||||
setStatusFilter("active");
|
setStatusFilter("active");
|
||||||
setShowFilters(true);
|
setShowFilters(true);
|
||||||
|
|||||||
619
package-lock.json
generated
619
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user