diff --git a/agents/patchmon-agent.sh b/agents/patchmon-agent.sh index 7749d85..364dda2 100755 --- a/agents/patchmon-agent.sh +++ b/agents/patchmon-agent.sh @@ -821,7 +821,7 @@ EOF success "Update sent successfully" echo "$response" | grep -o '"packagesProcessed":[0-9]*' | cut -d':' -f2 | xargs -I {} info "Processed {} packages" - # Check for auto-update instructions (look specifically in autoUpdate section) + # Check for PatchMon agent update instructions (this updates the agent script, not system packages) if echo "$response" | grep -q '"autoUpdate":{'; then local auto_update_section=$(echo "$response" | grep -o '"autoUpdate":{[^}]*}') local should_update=$(echo "$auto_update_section" | grep -o '"shouldUpdate":true' | cut -d':' -f2) @@ -830,15 +830,15 @@ EOF local current_version=$(echo "$auto_update_section" | grep -o '"currentVersion":"[^"]*' | cut -d'"' -f4) local update_message=$(echo "$auto_update_section" | grep -o '"message":"[^"]*' | cut -d'"' -f4) - info "Auto-update detected: $update_message" + info "PatchMon agent update detected: $update_message" info "Current version: $current_version, Latest version: $latest_version" - # Automatically run update-agent command - info "Automatically updating agent to latest version..." + # Automatically run update-agent command to update the PatchMon agent script + info "Automatically updating PatchMon agent to latest version..." if "$0" update-agent; then - success "Agent auto-update completed successfully" + success "PatchMon agent update completed successfully" else - warning "Agent auto-update failed, but data was sent successfully" + warning "PatchMon agent update failed, but data was sent successfully" fi fi fi diff --git a/agents/patchmon_install.sh b/agents/patchmon_install.sh index 7a5feac..7c30d6a 100644 --- a/agents/patchmon_install.sh +++ b/agents/patchmon_install.sh @@ -158,8 +158,8 @@ else warning "Initial package data failed, but agent is configured. You can run 'patchmon-agent.sh update' manually." fi -# Setup crontab for automatic updates -info "⏰ Setting up automatic updates every $UPDATE_INTERVAL minutes..." +# Setup crontab for automatic package status updates +info "⏰ Setting up automatic package status update every $UPDATE_INTERVAL minutes..." if [[ $UPDATE_INTERVAL -eq 60 ]]; then # Hourly updates echo "0 * * * * /usr/local/bin/patchmon-agent.sh update >/dev/null 2>&1" | crontab - @@ -179,7 +179,7 @@ if [[ "$EXPECTED_VERSION" != "Unknown" ]]; then fi echo " • Config directory: /etc/patchmon/" echo " • Credentials file: /etc/patchmon/credentials" -echo " • Automatic updates: Every $UPDATE_INTERVAL minutes via crontab" +echo " • Status updates: Every $UPDATE_INTERVAL minutes via crontab" echo " • View logs: tail -f /var/log/patchmon-agent.log" echo "" echo "🔧 Manual commands:" diff --git a/backend/src/routes/hostRoutes.js b/backend/src/routes/hostRoutes.js index 88f76d3..0317e88 100644 --- a/backend/src/routes/hostRoutes.js +++ b/backend/src/routes/hostRoutes.js @@ -527,11 +527,11 @@ router.post( }); }); - // Check if auto-update is enabled and if there's a newer agent version available + // Check if agent auto-update is enabled and if there's a newer version available let autoUpdateResponse = null; try { const settings = await prisma.settings.findFirst(); - // Check both global auto-update setting AND host-specific auto-update setting + // Check both global agent auto-update setting AND host-specific agent auto-update setting if (settings?.auto_update && host.auto_update) { // Get current agent version from the request const currentAgentVersion = req.body.agentVersion; @@ -560,8 +560,8 @@ router.post( } } } catch (error) { - console.error("Auto-update check error:", error); - // Don't fail the update if auto-update check fails + console.error("Agent auto-update check error:", error); + // Don't fail the update if agent auto-update check fails } const response = { @@ -571,7 +571,7 @@ router.post( securityUpdates: securityCount, }; - // Add auto-update response if available + // Add agent auto-update response if available if (autoUpdateResponse) { response.autoUpdate = autoUpdateResponse; } @@ -1060,7 +1060,7 @@ router.delete( }, ); -// Toggle host auto-update setting +// Toggle agent auto-update setting router.patch( "/:hostId/auto-update", authenticateToken, @@ -1068,7 +1068,7 @@ router.patch( [ body("auto_update") .isBoolean() - .withMessage("Auto-update must be a boolean"), + .withMessage("Agent auto-update setting must be a boolean"), ], async (req, res) => { try { @@ -1089,7 +1089,7 @@ router.patch( }); res.json({ - message: `Host auto-update ${auto_update ? "enabled" : "disabled"} successfully`, + message: `Agent auto-update ${auto_update ? "enabled" : "disabled"} successfully`, host: { id: host.id, friendlyName: host.friendly_name, @@ -1097,8 +1097,8 @@ router.patch( }, }); } catch (error) { - console.error("Host auto-update toggle error:", error); - res.status(500).json({ error: "Failed to toggle host auto-update" }); + console.error("Agent auto-update toggle error:", error); + res.status(500).json({ error: "Failed to toggle agent auto-update" }); } }, ); diff --git a/frontend/src/pages/HostDetail.jsx b/frontend/src/pages/HostDetail.jsx index 058385b..9deba67 100644 --- a/frontend/src/pages/HostDetail.jsx +++ b/frontend/src/pages/HostDetail.jsx @@ -84,7 +84,7 @@ const HostDetail = () => { }, }); - // Toggle auto-update mutation + // Toggle agent auto-update mutation (updates PatchMon agent script, not system packages) const toggleAutoUpdateMutation = useMutation({ mutationFn: (auto_update) => adminHostsAPI @@ -350,7 +350,7 @@ const HostDetail = () => {
-

+

Friendly Name

{ {host.hostname && (
-

+

System Hostname

@@ -384,7 +384,7 @@ const HostDetail = () => { )}

-

+

Host Group

{host.host_groups ? ( @@ -402,7 +402,7 @@ const HostDetail = () => {
-

+

Operating System

@@ -413,43 +413,38 @@ const HostDetail = () => {
- {host.agent_version && ( -
-
-

- Agent Version -

-

- {host.agent_version} -

-
-
- - Auto-update - - -
-
- )} +
+

+ Agent Version +

+

+ {host.agent_version || "Unknown"} +

+
+ +
+

+ Auto-update +

+ +
)} diff --git a/frontend/src/pages/Hosts.jsx b/frontend/src/pages/Hosts.jsx index 891961a..1d4ec9e 100644 --- a/frontend/src/pages/Hosts.jsx +++ b/frontend/src/pages/Hosts.jsx @@ -326,7 +326,12 @@ const Hosts = () => { { id: "os", label: "OS", visible: true, order: 4 }, { id: "os_version", label: "OS Version", visible: false, order: 5 }, { id: "agent_version", label: "Agent Version", visible: true, order: 6 }, - { id: "auto_update", label: "Auto-update", visible: true, order: 7 }, + { + id: "auto_update", + label: "Agent Auto-Update", + visible: true, + order: 7, + }, { id: "status", label: "Status", visible: true, order: 8 }, { id: "updates", label: "Updates", visible: true, order: 9 }, { id: "last_update", label: "Last Update", visible: true, order: 10 },