Skip to main content

Overview

nmis-cli is the main command-line tool for performing NMIS system administration tasks including job scheduling, outage management, database operations, and system maintenance. Location: ~/bin/nmis-cli Version: 9.6.5

Command-Line Options

--debug
integer
default:"0"
Set debugging level (0-9). Higher values produce more verbose output.
--help
flag
Display detailed help information and exit.
--quiet
flag
Suppress non-essential output messages.
--usage
flag
Display brief usage information and exit.
--verbose
flag
Enable verbose output mode.
--version
flag
Display version information and exit.

Core Actions

System Maintenance

fixperms

Fix file permissions for NMIS directories and files.
nmis-cli act=fixperms
Requires root privileges. Sets ownership to configured nmis_user:nmis_group and applies appropriate permissions.

config-backup

Create a backup of the current NMIS configuration.
nmis-cli act=config-backup

gettmp (or gettemp)

Display the temporary directory path used by NMIS.
nmis-cli act=gettmp

Database Operations

ensure-indexes

Ensure all required database indexes exist. Optionally remove unwanted indexes.
nmis-cli act=ensure-indexes
drop_unwanted
boolean
default:"false"
Remove indexes that are not defined in the schema.

dbcleanup

Clean up old data from the database according to retention policies.
nmis-cli act=dbcleanup
simulate
boolean
default:"false"
Dry-run mode - show what would be deleted without actually deleting.
info
boolean
default:"false"
Display detailed information about cleanup operations.
use_performance_query
boolean
default:"false"
Use optimized performance queries for large datasets.

purge

Purge old files according to configured retention policies.
nmis-cli act=purge

Data Operations

noderefresh

Refresh all nodes in the database, updating metadata and running validation.
nmis-cli act=noderefresh

inventoryrefresh

Refresh inventory data for all nodes.
nmis-cli act=inventoryrefresh

remove-duplicate-events

Identify and archive duplicate events in the database.
nmis-cli act=remove-duplicate-events dryrun=t

System Status

daemon-status (or status)

Display the status of NMIS daemon processes.
nmis-cli act=daemon-status
Output Example:
PID             Daemon Role
12345           nmisd.scheduler
12346           nmisd.worker
12347           nmisd.fping

Job Scheduling

schedule

Schedule a job for execution by the NMIS daemon.
nmis-cli act=schedule job.type=collect job.uuid=abc-123-def at="now"
at
time
default:"now"
When to run the job. Uses at command time format (e.g., “now”, “now+1hour”, “16:00”, “tomorrow”).
job.type
string
required
Type of job to schedule. One of: collect, update, update_links, services, thresholds, escalations, metrics, configbackup, purge, dbcleanup, selftest, permission_test, plugins, delete, edit.
job.priority
number
default:"1"
Job priority between 0 (lowest) and 1 (highest). Manual jobs default to 1.
job.node
string
Node name (can be repeated for multiple nodes).
job.uuid
string
Node UUID (can be repeated for multiple nodes).
job.group
string
Node group name (can be repeated for multiple groups).
job.wantsnmp
boolean
default:"true"
For collect jobs: enable SNMP collection.
job.wantwmi
boolean
default:"true"
For collect jobs: enable WMI collection.
job.phase
string
For plugin jobs: update or collect.
job.force
boolean
default:"false"
Bypass scheduling policies and ignore cached data.
job.verbosity
string
Job-specific verbosity: 1-9, debug, info, warn, error, or fatal.
job.output
string
Save job output to separate file: /path/prefix or prefix. Path is relative to log directory.
job.tag
string
Tag for grouping related jobs (e.g., for post-operation plugins).

list-schedules

List pending and active scheduled jobs.
nmis-cli act=list-schedules
verbose
boolean
default:"false"
Display full job arguments.
only
string
Filter: active (in-progress only) or queued (pending only).
job.*
string
Filter by job properties (e.g., job.type=collect, job.priority=1).

delete-schedule

Remove scheduled job(s) from the queue.
nmis-cli act=delete-schedule id=507f1f77bcf86cd799439011
id
string
required
Schedule ID to delete, or ALL to delete multiple jobs (with filters).

abort

Abort an active job and terminate its worker process.
nmis-cli act=abort id=507f1f77bcf86cd799439011
This terminates the worker process immediately. Use with caution.

schedule-help

Display detailed help for job scheduling.
nmis-cli act=schedule-help

Outage Management

create-outage

Create a new outage schedule.
nmis-cli act=create-outage \
  outage.description="Nightly maintenance" \
  outage.frequency=daily \
  outage.start="02:00" \
  outage.end="04:00" \
  outage.selector.node.group.0="production"
outage.description
string
required
Free-form textual description of the outage.
outage.change_id
string
Change management ticket identifier for event tagging.
outage.frequency
string
required
Outage frequency: once, daily, weekly, or monthly.
outage.start
string
required
Outage start time. Format depends on frequency:
  • daily: “HH:MM” or “HH:MM:SS”
  • weekly: “MDAY HH:MM” (e.g., “Mon 08:00”)
  • monthly: “D HH:MM” (day 1-31, or -1 for last day)
  • once: ISO8601 datetime (e.g., “2024-12-15T22:00:00+0000”)
outage.end
string
required
Outage end time (same format as start). Note: “24:00” is allowed for daily outages.
outage.options
object
Key-value pairs to adjust NMIS behavior during outage.
outage.selector.*
string/array
Device selection criteria. Keys: node.X or config.Y. Values: string, /regex/, or array (use indexed entries). All selectors must match for a node to be affected.

update-outage

Update an existing outage schedule.
nmis-cli act=update-outage id=507f1f77bcf86cd799439011 \
  outage.description="Updated maintenance window"
id
string
required
Outage UUID to update.

show-outage

Display details for a specific outage.
nmis-cli act=show-outage id=507f1f77bcf86cd799439011
Output Example:
id=507f1f77bcf86cd799439011
description=Nightly maintenance
frequency=daily
start=02:00
end=04:00
selector.node.group.0=production

list-outages

List all or filtered outages.
nmis-cli act=list-outages
filter
string
Any outage property to filter on. Supports regex with /pattern/ or /pattern/i.

delete-outage

Delete an outage schedule.
nmis-cli act=delete-outage id=507f1f77bcf86cd799439011

check-outages

Check which outages apply to a node at a specific time.
nmis-cli act=check-outages node=router1
node
string
Node name to check outages for.
uuid
string
Node UUID to check outages for.
time
string
default:"now"
Time to check (Unix timestamp, or parseable datetime string).

outage-help

Display detailed help for outage management.
nmis-cli act=outage-help

Reports

run-reports

Generate reports for a specific time period.
nmis-cli act=run-reports period=day type=all
period
string
required
Report period: day, week, or month.
type
string
required
Report type: all, times, health, top10, outage, response, avail, or port.

Performance Data Collection

collect-performance-data

Collect system performance data from the NMIS server.
nmis-cli act=collect-performance-data
Reads configuration from conf/performance and stores output in <nmis_var>/system_performance.

collect-top-data

Collect system top/CPU/memory statistics.
nmis-cli act=collect-top-data

User Session Management

clean-sessions

Remove all active sessions for a user.
nmis-cli act=clean-sessions user=john.doe

get-sessions

Display active session counts for all users.
nmis-cli act=get-sessions
Output Example:
admin: 2
john.doe: 1
jane.smith: 0

set-last-login

Manually set the last login time for a user.
nmis-cli act=set-last-login user=john.doe last_login=1702857600
user
string
required
Username to update.
last_login
integer
required
Unix timestamp for last login time.

unlock-user

Unlock a locked user account.
nmis-cli act=unlock-user user=john.doe

Event Notifications

notify

Manually trigger an event notification.
nmis-cli act=notify node=router1 event="Node Down" level=Critical
node
string
Node name (use node or uuid).
uuid
string
Node UUID (use node or uuid).
event
string
required
Event name.
element
string
Affected element (e.g., interface name).
details
string
Additional event details.
level
string
default:"Normal"
Event severity: Normal, Warning, Minor, Major, Critical, or Fatal.
When level=Normal, the event is cleared. Other levels create/update an active event.

Exit Codes

  • 0: Success
  • 1: General error
  • 255: Invalid action or parameters

Environment Variables

None required. Configuration is loaded from NMIS config files.

Files

  • Log File: <nmis_logs>/cli.log
  • Config: <nmis_conf>/Config.nmis
  • Temp Dir: Retrieved via act=gettmp

Examples

Complete Maintenance Workflow

# Schedule maintenance window
nmis-cli act=create-outage \
  outage.description="Network upgrade" \
  outage.change_id="CHG0045678" \
  outage.frequency=once \
  outage.start="2024-12-20T02:00:00+0000" \
  outage.end="2024-12-20T06:00:00+0000" \
  outage.selector.node.group.0="core"

Database Maintenance

nmis-cli act=config-backup info=t

See Also

  • node-admin.pl - Node management operations
  • model_tool.pl - Model development and testing
  • NMIS Configuration Guide
  • Job Scheduling Documentation

Build docs developers (and LLMs) love