Skip to main content
The Wazuh Check Updates plugin provides update notification services and version checking functionality for the Wazuh Dashboard.

Plugin Class

WazuhCheckUpdatesPlugin

Location: plugins/wazuh-check-updates/public/plugin.ts:12
export class WazuhCheckUpdatesPlugin
  implements Plugin<WazuhCheckUpdatesPluginSetup, WazuhCheckUpdatesPluginStart>

Lifecycle Methods

setup()

Initializes the plugin (no setup tasks required). Signature:
public setup(core: CoreSetup): WazuhCheckUpdatesPluginSetup
core
CoreSetup
required
OpenSearch Dashboards core setup contract
Returns: WazuhCheckUpdatesPluginSetup - Empty object

start()

Activates update checking services. Signature:
public start(
  core: CoreStart,
  plugins: AppPluginStartDependencies
): WazuhCheckUpdatesPluginStart
core
CoreStart
required
OpenSearch Dashboards core start contract
plugins
AppPluginStartDependencies
required
Plugin dependencies
Returns: WazuhCheckUpdatesPluginStart
UpdatesNotification
React.ComponentType
React component for displaying update notifications
DismissNotificationCheck
React.ComponentType
React component for dismissing update notifications
getAvailableUpdates
Function
Function to retrieve available updates

Public API

getAvailableUpdates()

Retrieves information about available Wazuh updates. Signature:
getAvailableUpdates(
  checkOnly?: boolean,
  forceQuery?: boolean
): Promise<AvailableUpdates>
checkOnly
boolean
default:false
Only check if updates exist without fetching details
forceQuery
boolean
default:false
Force a fresh query, bypassing cache
Returns: Promise<AvailableUpdates>
api_id
string
API host identifier
current_version
string
Currently installed Wazuh version
last_available_major
object
Latest available major version
last_available_minor
object
Latest available minor version
last_available_patch
object
Latest available patch version
Example:
import { getWazuhCheckUpdatesPlugin } from './plugin-services';

const checkUpdates = async () => {
  const updates = await getWazuhCheckUpdatesPlugin().getAvailableUpdates();
  
  if (updates.last_available_patch) {
    console.log(`Patch update available: ${updates.last_available_patch.version}`);
  }
  
  if (updates.last_available_minor) {
    console.log(`Minor update available: ${updates.last_available_minor.version}`);
  }
  
  if (updates.last_available_major) {
    console.log(`Major update available: ${updates.last_available_major.version}`);
  }
};

Components

UpdatesNotification

Displays update notifications in the UI. Usage:
import React from 'react';
import { getWazuhCheckUpdatesPlugin } from './plugin-services';

function App() {
  const { UpdatesNotification } = getWazuhCheckUpdatesPlugin();
  
  return (
    <div>
      <UpdatesNotification />
      {/* Other app content */}
    </div>
  );
}
Features:
  • Automatically checks for updates on mount
  • Displays notifications for major, minor, and patch updates
  • Provides links to release notes
  • Respects user dismissal preferences

DismissNotificationCheck

Allows users to dismiss update notifications. Usage:
import React from 'react';
import { getWazuhCheckUpdatesPlugin } from './plugin-services';

function UpdateSettings() {
  const { DismissNotificationCheck } = getWazuhCheckUpdatesPlugin();
  
  return (
    <div>
      <h2>Update Notifications</h2>
      <DismissNotificationCheck />
    </div>
  );
}
Props: No props required - the component manages its own state.

Server Plugin

The server-side plugin manages update data and user preferences.

WazuhCheckUpdatesPlugin (Server)

Location: plugins/wazuh-check-updates/server/plugin.ts:37
export class WazuhCheckUpdatesPlugin
  implements Plugin<WazuhCheckUpdatesPluginSetup, WazuhCheckUpdatesPluginStart>

setup() (Server)

Signature:
public async setup(
  core: CoreSetup,
  plugins: PluginSetup
): Promise<WazuhCheckUpdatesPluginSetup>
Server setup tasks:
  1. Registers saved object types - For storing update data and user preferences
  2. Creates router - Sets up HTTP endpoints
  3. Registers route handler context - Adds wazuh_check_updates context
Saved Object Types:
// Available updates data
core.savedObjects.registerType({
  name: 'wazuh-check-updates-available-updates',
  hidden: false,
  namespaceType: 'agnostic',
  mappings: {
    properties: {
      api_id: { type: 'keyword' },
      current_version: { type: 'keyword' },
      last_available_major: { type: 'object' },
      last_available_minor: { type: 'object' },
      last_available_patch: { type: 'object' },
      last_check_date: { type: 'date' },
    },
  },
});

// User preferences
core.savedObjects.registerType({
  name: 'wazuh-check-updates-user-preferences',
  hidden: false,
  namespaceType: 'single',
  mappings: {
    properties: {
      dismissed_updates: { type: 'object' },
      last_dismissed_date: { type: 'date' },
    },
  },
});

start() (Server)

Signature:
public start(
  core: CoreStart,
  plugins: AppPluginStartDependencies
): WazuhCheckUpdatesPluginStart
Server start tasks:
  1. Creates internal saved objects client - For background operations
  2. Initializes services - Sets up update checking logic
Returns: Empty object

Server Routes

The plugin exposes REST endpoints for update management.

GET /api/v1/wazuh-check-updates/updates

Retrieve available updates. Query Parameters:
api_id
string
API host ID to check updates for
force
boolean
default:false
Force fresh update check
Response:
{
  data: {
    api_id: "default",
    current_version: "4.7.0",
    last_available_major: null,
    last_available_minor: {
      version: "4.8.0",
      published_date: "2026-02-15",
      tag: "v4.8.0",
      description: "New features and improvements",
      release_url: "https://github.com/wazuh/wazuh/releases/tag/v4.8.0"
    },
    last_available_patch: {
      version: "4.7.1",
      published_date: "2026-03-01",
      tag: "v4.7.1",
      description: "Bug fixes and stability improvements",
      release_url: "https://github.com/wazuh/wazuh/releases/tag/v4.7.1"
    },
    last_check_date: "2026-03-04T10:30:00Z"
  }
}

POST /api/v1/wazuh-check-updates/dismiss

Dismiss update notifications. Request Body:
version
string
required
Version to dismiss notifications for
update_type
string
required
Type of update: “major”, “minor”, or “patch”
Example:
const response = await fetch('/api/v1/wazuh-check-updates/dismiss', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    version: '4.8.0',
    update_type: 'minor'
  })
});
Response:
{
  success: true,
  message: "Update notification dismissed"
}

GET /api/v1/wazuh-check-updates/preferences

Retrieve user notification preferences. Response:
{
  data: {
    dismissed_updates: {
      "4.8.0": {
        update_type: "minor",
        dismissed_date: "2026-03-04T10:30:00Z"
      }
    },
    last_dismissed_date: "2026-03-04T10:30:00Z"
  }
}

PUT /api/v1/wazuh-check-updates/preferences

Update user notification preferences. Request Body:
dismissed_updates
object
required
Map of dismissed update versions

Request Handler Context

The plugin extends the request handler context. Type Definition:
declare module 'opensearch_dashboards/server' {
  interface RequestHandlerContext {
    wazuh_check_updates: {
      logger: Logger;
      security: ISecurityFactory;
    };
  }
}
Usage:
router.get(
  { path: '/my-endpoint', validate: false },
  async (context, request, response) => {
    // Access logger
    context.wazuh_check_updates.logger.info('Checking updates');
    
    // Access security
    const user = await context.wazuh_check_updates.security.getCurrentUser(request);
    
    return response.ok();
  }
);

Integration Example

Complete example of integrating update checks:
import React, { useEffect, useState } from 'react';
import { EuiCallOut, EuiButton, EuiSpacer } from '@elastic/eui';
import { getWazuhCheckUpdatesPlugin } from './plugin-services';

function UpdateChecker() {
  const [updates, setUpdates] = useState(null);
  const [loading, setLoading] = useState(true);
  const { getAvailableUpdates, DismissNotificationCheck } = getWazuhCheckUpdatesPlugin();
  
  useEffect(() => {
    const checkUpdates = async () => {
      try {
        const availableUpdates = await getAvailableUpdates();
        setUpdates(availableUpdates);
      } catch (error) {
        console.error('Failed to check updates:', error);
      } finally {
        setLoading(false);
      }
    };
    
    checkUpdates();
  }, []);
  
  if (loading) {
    return <div>Checking for updates...</div>;
  }
  
  const hasUpdates = updates?.last_available_patch || 
                     updates?.last_available_minor || 
                     updates?.last_available_major;
  
  if (!hasUpdates) {
    return (
      <EuiCallOut
        title="You're up to date!"
        color="success"
        iconType="check"
      >
        <p>Wazuh {updates?.current_version} is the latest version.</p>
      </EuiCallOut>
    );
  }
  
  return (
    <div>
      {updates.last_available_patch && (
        <EuiCallOut
          title="Patch update available"
          color="primary"
          iconType="iInCircle"
        >
          <p>
            Version {updates.last_available_patch.version} is available.
            This update includes bug fixes and stability improvements.
          </p>
          <EuiButton
            href={updates.last_available_patch.release_url}
            target="_blank"
          >
            View release notes
          </EuiButton>
        </EuiCallOut>
      )}
      
      <EuiSpacer />
      
      {updates.last_available_minor && (
        <EuiCallOut
          title="Minor update available"
          color="warning"
          iconType="alert"
        >
          <p>
            Version {updates.last_available_minor.version} is available.
            This update includes new features and improvements.
          </p>
          <EuiButton
            href={updates.last_available_minor.release_url}
            target="_blank"
          >
            View release notes
          </EuiButton>
        </EuiCallOut>
      )}
      
      <EuiSpacer />
      
      <DismissNotificationCheck />
    </div>
  );
}

export default UpdateChecker;

Best Practices

Check for updates when the application starts, but don’t block the UI:
useEffect(() => {
  // Non-blocking update check
  getAvailableUpdates(true).catch(console.error);
}, []);
Always check if the user has dismissed a notification before showing it:
const preferences = await fetch('/api/v1/wazuh-check-updates/preferences')
  .then(r => r.json());

const isDismissed = preferences.data.dismissed_updates[version];
Avoid checking for updates too frequently. Use the cached data:
// Use cached data (default)
const updates = await getAvailableUpdates();

// Force refresh only when necessary
const freshUpdates = await getAvailableUpdates(false, true);
Update checks may fail due to network issues. Handle errors without breaking the UI:
try {
  const updates = await getAvailableUpdates();
} catch (error) {
  // Log but don't show error to user
  console.error('Update check failed:', error);
  // Continue with application functionality
}

Main Plugin

Main dashboard plugin API

Wazuh Core

Core services and configuration

Update Guide

How to upgrade Wazuh

Release Notes

Wazuh release notes

Build docs developers (and LLMs) love