Backup and Recovery
Regular backups are essential for disaster recovery and before performing upgrades. This page covers backup strategies for NetXMS server, database backup, and recovery procedures.
For database migration between engines, see Database Migration. For moving to a new server, see Server Migration.
What to Back Up
A complete NetXMS backup includes:
-
Database — the most critical component, containing all configuration, collected data, events, and user accounts
-
Server configuration file —
netxmsd.conf(Linux:$NETXMS_HOME/etc/netxmsd.confifNETXMS_HOMEis set, otherwise the build-time sysconfdir or/etc/netxmsd.conf; theNETXMSD_CONFIGenvironment variable overrides the search. Windows:<installation directory>\etc\netxmsd.confas recorded in the registry, withC:\netxmsd.confas fallback) -
Server data directory — contains the server key file, uploaded files, agent installer packages, images and map backgrounds, certificate revocation lists, the compiled MIB file, and high availability identity files (see Server Data Directory Backup)
-
Agent configuration files —
nxagentd.confon each monitored node (if managed centrally, these are stored in the database as policies)
Database Backup
Using nxdbmgr
The nxdbmgr tool can export the entire NetXMS database to a portable file format:
nxdbmgr export /path/to/backup/netxms-backup.nxd
This creates a database-engine-independent backup that can be imported into any supported database. This method is recommended for migration between database engines.
nxdbmgr export is an offline operation — the server must be stopped first.
If the server is running and holds the database lock, the export fails.
There is no online export; for backups without downtime, use native database tools.
|
Useful options for export and import:
-
-s— skip collected data (configuration-only export) -
-S— skip collected data and do not clear or create data tables -
-e <table>— exclude a specific table (can be repeated) -
-Z <log>— exclude a specific log (can be repeated) -
-x— ignore errors in collected data during import
To restore from an nxdbmgr export:
nxdbmgr import /path/to/backup/netxms-backup.nxd
The target database must be initialized with nxdbmgr init.
Import validates the export file’s schema version against the nxdbmgr tool itself and fails on any mismatch in either direction — an export file cannot be upgraded, so run init and import with the same NetXMS version that produced the export.
After validation and a confirmation prompt, the existing configuration and collected data are cleared before loading the export.
|
Using Native Database Tools
For regular backups, native database tools offer better performance, incremental backup support, and can run while the server is online.
pg_dump -U netxms -Fc netxms_db > /backup/netxms-$(date +%Y%m%d).dump
To restore:
pg_restore -U netxms -d netxms_db /backup/netxms-20260301.dump
mysqldump -u netxms -p netxms_db > /backup/netxms-$(date +%Y%m%d).sql
To restore:
mysql -u netxms -p netxms_db < /backup/netxms-20260301.sql
BACKUP DATABASE netxms_db TO DISK = 'C:\Backup\netxms.bak' WITH COMPRESSION;
Backup Automation
Use native database tools for automated backups — they work while the server is running.
Reserve nxdbmgr export for offline snapshots taken before migrations or major upgrades, when the server is stopped anyway.
Create a scheduled task or cron job for regular automated backups:
0 1 * * * pg_dump -U netxms -Fc netxms_db > /backup/netxms-$(date +\%Y\%m\%d).dump && find /backup -name "netxms-*.dump" -mtime +30 -delete
This example creates a daily backup and removes backups older than 30 days.
Server Data Directory Backup
The server data directory contains files that exist only on the server file system:
-
Server key file (
.server_keyon UNIX-like systems,server_keyon Windows) — the server’s RSA key used for agent authentication. Losing this file breaks the trust relationship with agents that authenticate the server by this key. -
cert/— the auto-generated internal CA certificate and key used to issue agent tunnel certificates, plus the server certificate and key. Losing this directory invalidates every certificate the server has issued to agents, so all tunnels must be re-bound. -
Files uploaded to the server
-
packages/— agent installer packages -
images/andbackgrounds/— image library and network map backgrounds -
crl/— certificate revocation lists -
mibs/— user-supplied MIB source files -
netxms.cmib— compiled MIB file (rebuilt frommibs/) -
housekeeper/— custom housekeeper cleanup scripts -
High availability identity files
Back up the entire data directory:
tar czf /backup/netxms-data-$(date +%Y%m%d).tar.gz /var/lib/netxms/
Compress-Archive -Path C:\NetXMS\var -DestinationPath C:\Backup\netxms-data.zip
Recovery Procedures
Complete Server Recovery
To recover a NetXMS server from scratch:
-
Install NetXMS server of the same version the backup was taken from (see server installation for Linux or Windows)
-
Create an empty database (see Database Setup)
-
Restore the database backup:
-
If using
nxdbmgrformat: initialize the database withnxdbmgr init, then runnxdbmgr import backup.nxd(using the same NetXMS version that created the export) -
If using native format: use the appropriate database restore command
-
-
Restore the server configuration file (
netxmsd.conf) -
Restore the server data directory
-
Start the server
Verifying Backups
Periodically verify that backups can be restored successfully:
-
Provision a test environment
-
Restore the database from the latest backup
-
Start the NetXMS server with the restored database
-
Verify that configuration, nodes, and historical data are intact
If using nxdbmgr export, the resulting file is self-contained and database-engine-independent.
This makes it suitable for offsite backups and disaster recovery scenarios where the target environment may differ from production.
|
Pre-Upgrade Backup
Before any NetXMS upgrade:
-
Stop the server
-
Create a full database backup using native tools
-
Back up the configuration file and data directory
-
Proceed with the upgrade (see Upgrading)
| Always perform a full backup before upgrading. Database schema changes during upgrades are not reversible without a backup. |