Fortinet white logo
Fortinet white logo

User Guide

26.1.0

template.ps1 file

template.ps1 file

Copy
function Plugin-Configuration {
return @{
textKey = "systemp"
category = "Get System Temperature"
};
}

function Discover {
return @(
@{
resource_textkey = "temp_in_F"
label = "Temperature Fahrenheit"
unit = "degrees F"
options = @("fan", "intakeFan", "exitFan")
},
@{
resource_textkey = "temp_in_C"
label = "Temperature Celsius"
unit = "degrees C"
options = @("fan", "intakeFan", "exitFan")
}
)
}

function Collect-Metric($resource_textkey, $option) {
return Get-Temperature $resource_textkey;
}

function Get-Temperature($scale) {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"

$currentTempKelvin = $t.CurrentTemperature / 10;
$currentTempCelsius = $currentTempKelvin - 273.15;

if ($scale -eq "temp_in_F") {
return (9/5) * $currentTempCelsius + 32;
}

if ($scale -eq "temp_in_C") {
return $currentTempCelsius;
}

return $currentTempKel

template.ps1 file

template.ps1 file

Copy
function Plugin-Configuration {
return @{
textKey = "systemp"
category = "Get System Temperature"
};
}

function Discover {
return @(
@{
resource_textkey = "temp_in_F"
label = "Temperature Fahrenheit"
unit = "degrees F"
options = @("fan", "intakeFan", "exitFan")
},
@{
resource_textkey = "temp_in_C"
label = "Temperature Celsius"
unit = "degrees C"
options = @("fan", "intakeFan", "exitFan")
}
)
}

function Collect-Metric($resource_textkey, $option) {
return Get-Temperature $resource_textkey;
}

function Get-Temperature($scale) {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"

$currentTempKelvin = $t.CurrentTemperature / 10;
$currentTempCelsius = $currentTempKelvin - 273.15;

if ($scale -eq "temp_in_F") {
return (9/5) * $currentTempCelsius + 32;
}

if ($scale -eq "temp_in_C") {
return $currentTempCelsius;
}

return $currentTempKel