Linux based devices contain multiple attributes such as hardware, certificates, patches, apps, and more. With Sensors, you can collect data for these attributes using the Workspace ONE UEM console and display the data returned by Sensors in Workspace ONE.
Linux devices have a huge number of attributes associated with them. This number increases when you track the different apps, distro versions, patches, and other continually changing variables. It can be difficult to track all of these attributes.
Workspace ONE UEM tracks a limited number of device attributes by default. However, sensors enable you to track specific device attributes. For example, you can create a sensor that tracks the number of battery charge cycles, last updated date of a virus definition file, or the build version of a specific security agent. Sensors allow you to track various attributes across your devices using Bash. For your Linux devices, sensor scripts can be configured to run periodically.
Find sensors in the main Workspace ONE UEM console navigation under Resources.
Workspace ONE UEM Options
- Bash Scripts - The Bash script determines the value of each sensor. For examples of what scripts you can create, see Bash Examples.
- Support for Variables - If your sensor script requires that dynamic or sensitive information be defined outside of the script, then use variables to securely store this information. Variable data is encrypted at-rest and in-transit. The variables can be referenced in the code directly by name $myvariable.
- Sensors Triggers - When configuring Sensors, control when the device reports the sensor data back to the Workspace ONE UEM console with triggers. Trigger choices for Linux devices include:
- Periodically (based on a sample schedule)
- When a user logs in or out
- When a device starts up
- When the device's network changes
- Sensors - See data for single devices on the Sensors tab in a device's Device Details page.
Workspace ONE Intelligence Options
To view and interact with data from your sensors when you use the Workspace ONE Intelligence service, run a report or create a dashboard. When you run reports, use the Workspace ONE UEM category, Device Sensors. Find your sensors and select them for queries in reports and dashboards.
For details on how to work in Workspace ONE Intelligence, see Workspace ONE Intelligence Products.
Creating Sensors for Linux Devices
To track specific device attributes such as remaining battery, specific version, build information, or average CPU usage, create sensors in the Workspace ONE console. Each sensor includes a script of code to collect the desired data. You can upload these scripts or enter them directly into the console.
To gather attribute values, sensors use Bash scripts. You must create these scripts before creating a sensor or during configuration in the scripting window.
Note: To view the sensors for multiple devices and interact with the data in reports and dashboards, you must opt into Workspace ONE Intelligence. If you want to view sensor data for a single device, you do not need Workspace ONE Intelligence. To view the data, go to the Device Details page for the device and select the Sensors tab.
-
In the Workspace ONE console, navigate to Resources > Sensors.
-
On the Sensors page, click Add and select Linux.
-
On the New Sensor page, navigate to General > Name and enter the following:
Setting Description Name Enter the name of the sensor. The name must start with a lowercase letter followed by alpha-numeric characters and underscores. The name must be from 2 through 64 characters. Description Enter the description of the sensor. -
Click Next.
-
Configure the sensor settings in the Details tab.
Setting Description Language Select the language. Currently, only Bash is supported for Linux devices. Execution Context This setting controls the context with which the script runs. Currently, only System is support for Linux devices. Response Data Type Select the type of response the script will return. You can choose between: - String
- Integer
- Boolean
- Date Time
Code Upload a script for the sensor or write your own in the text box provided. -
Click Next.
-
Optional: On the Variables tab, define variable names and values to use in your sensor script. These variables are securely stored, encrypted at-rest, and only used temporarily during script execution in the scripting environment.
Variables support static text or the Workspace ONE UEM lookup values. The lookup values are resolved before being delivered to the device for execution.
Bash scripts can reference the variables directly by name from the environment like $myvariable.
-
Click Save or Save and Assign.
To add sensors to a smart group, save the sensors information and go back to menu or move to the Assignment page.
What to do next
To add a sensor to a smart group, perform the following steps:
- On the New Assignment page, enter the Assignment Name and Select Smart Group.
- Click Next.
- On the Deployment page, select when you want to trigger the sensor to be captured on the devices. For the periodically trigger, the script runs periodically based on the Intelligent Hub Data Transmit Interval configured in All Settings > Device & Users > Linux > Intelligent Hub Settings.
- Click Save.
After the assignment group is saved, prioritize the assignments if multiple smart groups are configured with potentially overlapping sets of devices. Once this step is done, devices with Workspace ONE Intelligent Hub installed receive the Sensor configurations on the next check-in. Workspace ONE Intelligent Hub then runs the sensors and reports the data back to Workspace ONE.
View Sensors in Linux Device Details
View sensor data in the Workspace ONE UEM console on the Sensors tab in Device Details.
-
In the Workspace ONE UEM console, navigate to Device > Details View and select the Sensors tab. The following details are displayed in the Sensors tab:
- Name - Name of the sensor.
- Value - Value reported by the device.
- Last executed date - The timestamp for the collection of the sensor value.
-
To request the device to on-demand, run the Sensor. Report the value. Select a Sensor name and click Run.
Note: The Run button displays in Device Details only for supported Hub versions. The minimum supported Linux Hub version is 21.05.
-
To view information about Sensors execution, navigate to Details View > Troubleshooting. In the event log filters, select Sensors.
Note: This is seen only if the event log level is set to capture information or debug messages.
Linux Sensor Examples
When you create sensors for Linux devices, you must upload a bash script or enter the bash script in the text box provided during the configuration in the Workspace ONE UEM console. These commands return the values for the sensor attributes.
Bash Examples: The following examples contain the settings and the code needed for standard Ubuntu and may not work on other Linux distributions.
Get the current Host Name:
Language: Bash
Execution Context: System
Response Data Type: String
cat /proc/sys/kernel/hostname |
Get a list of all users currently logged in:
Language: Bash
Execution Context: System
Response Data Type: String
who | cut -d' ' -f1 | sort | uniq
Get current distribution version:
Language: Bash
Execution Context: System
Response Data Type: String
( lsb_release -ds || cat /etc/*release || uname -om ) 2>/dev/null | head -n1 |
Determine if an SSH Server is running:
Language: Bash
Execution Context: System
Response Data Type: Integer
ps -ef | grep sshd | grep -v "grep" | wc -l
Note: The returned value equates to the number of SSH daemons running on the endpoint.
Was this page helpful?