This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
def netpromoterscore(scores): | |
""" | |
Calculates the netpromoter score of a list | |
The Net Promoter Score is obtained by asking customers a single question on a 0 to 10 rating scale: | |
'How likely is it that you would recommend our company to a friend or colleague?' | |
Based on their responses, customers are categorized into one of three groups: | |
Promoters (9-10 rating), Passives (7-8 rating), and Detractors (0-6 rating). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the needed credential and management objects from the libraries. | |
from azure.identity import AzureCliCredential | |
from azure.mgmt.resource import ResourceManagementClient | |
from azure.mgmt.network import NetworkManagementClient | |
from azure.mgmt.compute import ComputeManagementClient | |
from azure.mgmt.compute.models import OrchestrationMode | |
import os | |
print(f"Provisioning a virtual machine scale set...some operations might take a minute or two.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
write_files: | |
- path: /var/www/html/index.html | |
content: | | |
<!DOCTYPE html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
yarpreverseproxy: | |
image: vmssapplicationhealth.azurecr.io/yarpreverseproxy:ds1 | |
container_name: yarpreverseproxy | |
ports: | |
- 80:7176 | |
links: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
- nodejs | |
- npm | |
write_files: | |
- owner: www-data:www-data | |
path: /etc/nginx/sites-available/default | |
content: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
- nodejs | |
- npm | |
write_files: | |
- owner: www-data:www-data | |
path: /etc/nginx/sites-available/default | |
content: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$allInstances = Get-AzVmssVM -InstanceView -ResourceGroupName $rg -VMScaleSetName $vmssName | |
$unhealthyInstances = $allInstances | where {$_.InstanceView.VmHealth.Status.Code -eq "HealthState/unhealthy"} | |
Write-Output "Total instances: $($allInstances.Count)" | |
Write-Output "Unhealthy instances: $($unhealthyInstances.Count)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-AzAccount | |
$mysub = "my-subscription-name" | |
$rg = "my-resourcegroup-name" | |
$vmssname = "my-vmss-name" | |
Set-AzContext -Subscription $mysub | |
$vmssmodel = Get-AzVmss -ResourceGroupName $rg -VMScaleSetName $vmssname | |
Write-Output($vmssmodel.Id) | |
Write-Output("FD Count: " + $vmssmodel.PlatformFaultDomainCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express() | |
var os = require('os'); | |
app.get('/', function (req, res) { | |
const request = require('request'); | |
const options = { | |
url: 'http://169.254.169.254/metadata/instance?api-version=2019-03-11', | |
headers: { | |
'Metadata': 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Azure Metadata app | |
[Service] | |
ExecStart=/usr/bin/node /var/www/azuremetadata/app.js | |
#Restart=always | |
StandardOut=syslog | |
StandardError=Syslog | |
User=nobody | |
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody' |
NewerOlder