amt-manager-test
v0.0.2
Published
Intel AMT Management Tool - Control power states of AMT-enabled devices
Maintainers
Readme
AMT Manager
A Node.js tool for managing Intel AMT (Active Management Technology) devices. This tool provides both a command-line interface and a programmatic API to control power states of AMT-enabled devices.
Features
- Power on/off AMT devices
- Reset AMT devices
- Check power state
- Secure authentication using Digest Authentication
- Support for both HTTP and HTTPS protocols
- IPv4 and IPv6 support
- Automatic retry with exponential backoff
- SSL verification options
Prerequisites
- Node.js 14 or higher
- npm 6 or higher
- Intel AMT-enabled device
- Network access to the AMT device
Installation
As a Command Line Tool
- Install globally:
npm install -g amt-manager- Create a
.envfile for optional settings:
cp .env.example .env- Edit the
.envfile with optional AMT device configuration:
AMT_PORT=16992
AMT_PROTOCOL=http
AMT_VERIFY_SSL=false
AMT_FORCE_IPV4=true- Use the CLI commands:
# Basic usage
amt-manager power-on 192.168.1.100 admin password
amt-manager power-off 192.168.1.100 admin password
amt-manager reset 192.168.1.100 admin password
amt-manager status 192.168.1.100 admin password
# With optional settings from .env file
amt-manager power-on 192.168.1.100 admin password --port 16992 --protocol httpsAs a Package in Your Project
- Install the package:
npm install amt-manager- Import and use in your code:
import { AMTManager, PowerState } from 'amt-manager';
// Create AMT manager instance
const amtManager = new AMTManager({
host: '192.168.1.100',
username: 'admin',
password: 'your_password',
port: 16992,
protocol: 'http',
verifySSL: false,
forceIPv4: true
});
// Use the manager
async function manageDevice() {
try {
// Power on the device
const powerOnResult = await amtManager.powerOn();
console.log('Power on result:', powerOnResult);
// Check power state
const powerState = await amtManager.getPowerState();
console.log('Current power state:', powerState);
// Power off the device
const powerOffResult = await amtManager.powerOff();
console.log('Power off result:', powerOffResult);
// Reset the device
const resetResult = await amtManager.reset();
console.log('Reset result:', resetResult);
} catch (error) {
console.error('Error managing device:', error);
}
}Command Line Usage
The tool accepts the following command line arguments:
amt-manager <command> <host> <username> <password>Required Arguments
command: The action to perform (power-on, power-off, reset, status)host: IP address or hostname of the AMT deviceusername: AMT device usernamepassword: AMT device password
Optional Environment Variables
| Variable | Description | Default | Required | |----------|-------------|---------|----------| | AMT_PORT | AMT device port | 16992 | No | | AMT_PROTOCOL | Protocol to use (http/https) | http | No | | AMT_VERIFY_SSL | Whether to verify SSL certificates | false | No | | AMT_FORCE_IPV4 | Whether to force IPv4 connections | true | No |
API Reference
AMTManager Class
The main class for interacting with AMT devices.
Constructor
constructor(config: AMTConfig)Methods
powerOn(): Promise<boolean>- Turn on the devicepowerOff(): Promise<boolean>- Turn off the devicereset(): Promise<boolean>- Reset the devicegetPowerState(): Promise<number>- Get current power statetestConnection(): Promise<boolean>- Test connection to the device
Types
interface AMTConfig {
host: string;
port?: number;
username: string;
password: string;
protocol?: 'http' | 'https';
timeout?: number;
retries?: number;
verifySSL?: boolean;
forceIPv4?: boolean;
}
enum PowerState {
PowerOn = 2,
PowerOff = 8,
Reset = 10
}Error Handling
The tool includes robust error handling:
- Automatic retry with exponential backoff for connection issues
- Detailed error messages for authentication failures
- Validation of required configuration
- Proper handling of SSL/TLS errors
Security Notes
- Never commit your
.envfile containing credentials - Use HTTPS when possible for secure communication
- Consider using environment variables in production environments
- Keep your AMT credentials secure and rotate them regularly
License
MIT
