Category filter

Automated Linux System Information Gathering via Custom Scripts

In a distributed enterprise environment, manual hardware audits are impractical and time-consuming. This technical guide outlines how to leverage the Execute Custom Script capability in Hexnode UEM to pull high-fidelity system information and runtime command output from Linux endpoints using a Bash-based diagnostic tool.

By deploying this script, IT administrators move from reactive troubleshooting to data-driven infrastructure management, allowing them to validate whether Ubuntu, Fedora, or Debian workstations adhere to organizational performance and security requirements.

Core Technical Capabilities

The diagnostic script targets specific Linux sub-systems to extract actionable telemetry:

  • Kernel & Distro Mapping: Uses uname and /etc/*release parsing to identify the exact Linux environment. This is critical for ensuring security patches and kernel updates are correctly targeted.
  • Resource Profiling: Utilizes lscpu and free -h to map static physical hardware architecture against real-time resource utilization.
  • Process Forensics: Employs ps with memory sorting to identify high-consumption processes that may require administrative review.
  • Network Topology: Uses ip -brief to provide a snapshot of connectivity and IP assignments without the clutter of verbose command outputs.

Enterprise Use Cases & Hexnode Integration

Integrating this script into your Hexnode UEM workflow transforms raw data into actionable intelligence across four key scenarios:

1. Pre-Deployment Hardware Audits

Before rolling out resource-intensive software (such as CAD tools or Docker environments), admins can deploy this script via Hexnode to a “Pilot Group.”

Hexnode Advantage: Instead of logging into each machine, the Action History tab captures the output of hardware commands. Admins can verify if devices meet minimum requirements (e.g., 2 CPU cores, 4GB RAM, 20GB disk space, and 64-bit architecture).

2. Incident Response & Performance Debugging

When an employee reports a “slow” machine, the first step is identifying the bottleneck.

Scenario: An admin executes the script on a specific device via the Hexnode dashboard.

Hexnode Advantage: The Top 5 Processes by Memory Usage section immediately reveals if an enterprise app is leaking memory, allowing for targeted corrective actions.

3. Fleet-Wide Compliance & Lifecycle Management

Identify kernel versions that require updates based on internal security policies.

Scenario: Run the script across the entire Linux fleet to gather uname -r data.

Hexnode Advantage: By reviewing the logs in Action History, admins can identify outdated kernels and schedule mandatory OS updates via Hexnode’s policy engine.

4. Post-Onboarding Verification

Ensure new workstations are provisioned with the correct hostname and network configurations.

Hexnode Advantage: Use the script as a “Final Check” in the onboarding sequence. The ip -brief addr output confirms the device is correctly positioned within the corporate VLAN.

Technical Implementation: The Diagnostic Script

Copy the Bash code below and save it as a .sh file (e.g., sys_audit.sh).

Deployment Steps

Step 1: Validation

Test the script locally on a single test machine before mass deployment:

chmod +x sys_audit.sh && ./sys_audit.sh

Step 2: Hexnode Deployment

The script can be deployed in two ways:

A. Direct Actions (One-time)

  1. Navigate to Manage > Devices.
  2. Select the target Linux device(s).
  3. Click Actions > Execute Custom Script.
  4. Upload the .sh file and execute.

B. Automation (Scheduled)

  1. Navigate to Automate > Linux.
  2. Upload the .sh file and define the schedule (interval).
  3. Add target Linux devices or groups and Save.

Step 3: Verifying Results

Once the script is deployed, IT admins must verify the output in the portal:

  1. Navigate to Manage > Devices.
  2. Select the specific Linux device.
  3. Select Action History and click Show Output.

Hexnode UEM displays the generated output, showing details like hostname, OS version, Kernel version, architecture, and current CPU/RAM utilization.

Script for Linux system information gathering

Summary Table for Administrators

Information Category Command Used Enterprise Value
Identity uname, /etc/*release Compliance and Patch Management
CPU/RAM lscpu, free -h Capacity Planning and Upgrades
Storage df -h Proactive Maintenance (Disk space alerts)
Processes ps -eo … Security Visibility and Performance Debugging
Networking ip -brief Connectivity Troubleshooting
Note:


It is highly recommended to manually validate script execution on a test system before bulk deployment. Hexnode is not responsible for any damage or loss resulting from the behavior of custom scripts.

Sample Script Repository