Skip to content
Permalink
Browse files
Added support for Azure Virtual Machines. Fixed script for manual runs.
  • Loading branch information
Uladzislau Dadzimau committed Jun 26, 2020
1 parent c906193 commit 675422002a06cf0b7a35ffa880f1622c6f5054c7
Showing 5 changed files with 14 additions and 17 deletions.
@@ -3,4 +3,5 @@
*.tar.gz.filepart
*/imports/
*/logs/
/development/azure.json
/development/azure.json
/development/zabbix-azure-010.zip
@@ -1,12 +1,3 @@
# param (
# [Parameter(Mandatory = $true)][string]$resourceGroup,
# [Parameter(Mandatory = $true)][string]$subscriptionId,
# [Parameter(Mandatory = $true)][ValidateSet("appServicePlan","webApp","functionApp","storageAccount","serviceBus")][string]$resourceType,
# [Parameter(Mandatory = $false)][string]$workingDir = "."
# );

# Set-Location $workingDir;


foreach ($file in get-childitem .\development\helpers -Filter *.ps1)
{
@@ -16,10 +7,10 @@ foreach ($file in get-childitem .\development\helpers -Filter *.ps1)

$params = @{
workingDir = "$($pwd.path)\development";
$zabbixHostName = "<host-name>"; # Zabbix host name - represents your Azure Resource Group
zabbixHostName = "<host-name>"; # Zabbix host name - represents your Azure Resource Group
subscriptionId = "<subscription-id>";
resourceType = "analysisServices";
metricName = "null";
resourceType = "vm";
#metricName = "null";
};

# $params = @{
@@ -4,7 +4,7 @@ function Get-ZaAzureMonitorMetrics {
[Parameter(Mandatory = $true)][string]$workingDir,
[Parameter(Mandatory = $true)][string]$resourceGroup,
[Parameter(Mandatory = $true)][string]$subscriptionId,
[Parameter(Mandatory = $true)][ValidateSet("appServicePlan","webApp","functionApp","storageAccount","serviceBus","analysisServices","appInsights","sqlDatabase")][string]$resourceType,
[Parameter(Mandatory = $true)][ValidateSet("appServicePlan","webApp","functionApp","storageAccount","serviceBus","analysisServices","appInsights","sqlDatabase","vm")][string]$resourceType,
[Parameter(Mandatory = $false)][string]$metricName
);

@@ -2,7 +2,7 @@ function Get-ZaAzureResourceApiParameters {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidateSet("appServicePlan","webApp","functionApp","storageAccount","serviceBus","analysisServices","appInsights","sqlDatabase")]
[ValidateSet("appServicePlan","webApp","functionApp","storageAccount","serviceBus","analysisServices","appInsights","sqlDatabase","vm")]
[string]$resourceType
);

@@ -52,6 +52,11 @@ function Get-ZaAzureResourceApiParameters {
$ResourceProviderExtension = "namespaces";
$ResourceProviderApiVersion = "2017-04-01"
}
"vm" {
$ResourceProvider = "Microsoft.Compute";
$ResourceProviderExtension = "virtualMachines";
$ResourceProviderApiVersion = "2020-06-01"
}
# "^CosmosDBAccount$" {
# $ResourceProvider = "Microsoft.DocumentDB";
# $ResourceProviderExtension = "databaseAccounts";
@@ -121,11 +121,11 @@ function Set-ZaAzureMonitorZabbixHostItemValue {
{
if ($isFirstline)
{
$line = '"{0}" {1} "{2}" "{3}"' -f $item.host, $item.key, $item.timestamp, $item.value;
$line = '"{0}" "{1}" "{2}" "{3}"' -f $item.host, $item.key, $item.timestamp, $item.value;
$stream.WriteLine($line);
$isFirstline = $false;
}
$line = '"{0}" {1} "{2}" "{3}"' -f $item.host, $item.key, $item.timestamp, $item.value;
$line = '"{0}" "{1}" "{2}" "{3}"' -f $item.host, $item.key, $item.timestamp, $item.value;
$stream.WriteLine($line);
}
Write-Verbose "Finished write to file.";

0 comments on commit 6754220

Please sign in to comment.