CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-web

Microsoft Azure Web Apps Management Client Library for Python

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

diagnostics-monitoring.mddocs/

Diagnostics and Monitoring

Diagnostic capabilities, recommendations, health monitoring, and troubleshooting tools for web applications and services.

Package Information

  • Package: azure-mgmt-web
  • Modules: DiagnosticsOperations, RecommendationsOperations, ResourceHealthMetadataOperations
  • Access: client.diagnostics, client.recommendations, client.resource_health_metadata

Core Imports

from azure.mgmt.web import WebSiteManagementClient
from azure.mgmt.web.models import (
    DetectorResponse, DiagnosticAnalysis, Recommendation,
    ResourceHealthMetadata, DiagnosticCategory
)
from azure.identity import DefaultAzureCredential

Basic Usage

from azure.mgmt.web import WebSiteManagementClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
client = WebSiteManagementClient(credential, subscription_id)

# Get recommendations for subscription
recommendations = client.recommendations.list()
for rec in recommendations:
    print(f"Recommendation: {rec.name}, Level: {rec.level}")

# Get diagnostics for a web app
diagnostics = client.diagnostics.list_site_detector_responses(
    resource_group_name="my-resource-group",
    site_name="my-web-app"
)

Diagnostic Operations

List Site Detectors

Get all available diagnostic detectors for a web app.

def list_site_detectors(
    self,
    resource_group_name: str,
    site_name: str,
    **kwargs
) -> List[DetectorDefinition]:
    """
    List site diagnostic detectors.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        
    Returns:
        List of DetectorDefinition objects
    """

Get Site Detector Response

Execute a specific diagnostic detector and get results.

def get_site_detector_response(
    self,
    resource_group_name: str,
    site_name: str,
    detector_name: str,
    **kwargs
) -> DetectorResponse:
    """
    Get site detector response.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        detector_name: Name of the detector
        
    Returns:
        DetectorResponse object
    """

List Site Detector Responses

Get responses from all diagnostic detectors for a web app.

def list_site_detector_responses(
    self,
    resource_group_name: str,
    site_name: str,
    **kwargs
) -> List[DetectorResponse]:
    """
    List all site detector responses.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        
    Returns:
        List of DetectorResponse objects
    """

Usage Example:

# List available detectors
detectors = client.diagnostics.list_site_detectors(
    resource_group_name="my-resource-group",
    site_name="my-web-app"
)

for detector in detectors:
    print(f"Detector: {detector.name}, Display Name: {detector.display_name}")

# Run a specific detector
response = client.diagnostics.get_site_detector_response(
    resource_group_name="my-resource-group",
    site_name="my-web-app",
    detector_name="availability"
)

print(f"Detector Status: {response.metadata.status}")
for insight in response.dataset:
    print(f"Insight: {insight.rendering_properties.title}")

Site Diagnostic Analysis

Get comprehensive diagnostic analysis for a web app.

def list_site_analyses(
    self,
    resource_group_name: str,
    site_name: str,
    **kwargs
) -> List[AnalysisDefinition]:
    """
    List site diagnostic analyses.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        
    Returns:
        List of AnalysisDefinition objects
    """
def get_site_analysis(
    self,
    resource_group_name: str,
    site_name: str,
    analysis_name: str,
    **kwargs
) -> DiagnosticAnalysis:
    """
    Get site diagnostic analysis.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        analysis_name:Name of the analysis
        
    Returns:
        DiagnosticAnalysis object
    """

Hosting Environment Diagnostics

Get diagnostics for App Service Environments.

def list_hosting_environment_detector_responses(
    self,
    resource_group_name: str,
    name: str,
    **kwargs
) -> List[DetectorResponse]:
    """
    List hosting environment detector responses.
    
    Args:
        resource_group_name: Name of the resource group
        name: Name of the hosting environment
        
    Returns:
        List of DetectorResponse objects
    """
def get_hosting_environment_detector_response(
    self,
    resource_group_name: str,
    name: str,
    detector_name: str,
    **kwargs
) -> DetectorResponse:
    """
    Get hosting environment detector response.
    
    Args:
        resource_group_name: Name of the resource group
        name: Name of the hosting environment
        detector_name: Name of the detector
        
    Returns:
        DetectorResponse object
    """

Recommendations

List Recommendations

Get performance and configuration recommendations.

def list(self, **kwargs) -> List[Recommendation]:
    """
    List recommendations for the subscription.
    
    Returns:
        List of Recommendation objects
    """
def list_recommended_rules_for_web_app(
    self,
    resource_group_name: str,
    site_name: str,
    **kwargs
) -> List[Recommendation]:
    """
    List recommendations for a specific web app.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        
    Returns:
        List of Recommendation objects
    """

Get Recommendation

Retrieve details for a specific recommendation.

def get_rule_details_by_web_app(
    self,
    resource_group_name: str,
    site_name: str,
    name: str,
    **kwargs
) -> Recommendation:
    """
    Get recommendation details for a web app.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        name: Recommendation name
        
    Returns:
        Recommendation object
    """

Disable Recommendation

Disable a specific recommendation rule.

def disable_recommendation_for_site(
    self,
    resource_group_name: str,
    site_name: str,
    name: str,
    **kwargs
) -> None:
    """
    Disable a recommendation for a site.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        name: Recommendation name
    """

Usage Example:

# Get recommendations for a web app
recommendations = client.recommendations.list_recommended_rules_for_web_app(
    resource_group_name="my-resource-group",
    site_name="my-web-app"
)

for recommendation in recommendations:
    print(f"Rule: {recommendation.name}")
    print(f"Level: {recommendation.level}")
    print(f"Message: {recommendation.message}")
    print(f"Category: {recommendation.category_tags}")
    
    # Get detailed recommendation
    details = client.recommendations.get_rule_details_by_web_app(
        resource_group_name="my-resource-group",
        site_name="my-web-app",
        name=recommendation.name
    )
    print(f"Action: {details.action_name}")
    
    # Disable non-critical recommendations
    if recommendation.level == "Information":
        client.recommendations.disable_recommendation_for_site(
            resource_group_name="my-resource-group",
            site_name="my-web-app",
            name=recommendation.name
        )

Resource Health Metadata

List Health Metadata

Get resource health information for services.

def list(self, **kwargs) -> List[ResourceHealthMetadata]:
    """
    List resource health metadata.
    
    Returns:
        List of ResourceHealthMetadata objects
    """
def list_by_resource_group(
    self,
    resource_group_name: str,
    **kwargs
) -> List[ResourceHealthMetadata]:
    """
    List resource health metadata by resource group.
    
    Args:
        resource_group_name: Name of the resource group
        
    Returns:
        List of ResourceHealthMetadata objects
    """
def list_by_site(
    self,
    resource_group_name: str,
    name: str,
    **kwargs
) -> List[ResourceHealthMetadata]:
    """
    List resource health metadata for a site.
    
    Args:
        resource_group_name: Name of the resource group
        name: Name of the site
        
    Returns:
        List of ResourceHealthMetadata objects
    """

Usage Example:

# Get health metadata for a site
health_metadata = client.resource_health_metadata.list_by_site(
    resource_group_name="my-resource-group",
    name="my-web-app"
)

for metadata in health_metadata:
    print(f"Category: {metadata.category}")
    print(f"Title: {metadata.title}")
    if metadata.signal_availability:
        print("Health signals are available")

Diagnostic Categories

List Diagnostic Categories

Get available diagnostic categories for analysis.

def list_site_diagnostic_categories(
    self,
    resource_group_name: str,
    site_name: str,
    **kwargs
) -> List[DiagnosticCategory]:
    """
    List diagnostic categories for a site.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        
    Returns:
        List of DiagnosticCategory objects
    """
def get_site_diagnostic_category(
    self,
    resource_group_name: str,
    site_name: str,
    diagnostic_category: str,
    **kwargs
) -> DiagnosticCategory:
    """
    Get specific diagnostic category for a site.
    
    Args:
        resource_group_name: Name of the resource group
        site_name: Name of the web app
        diagnostic_category: Category name
        
    Returns:
        DiagnosticCategory object
    """

Usage Example:

# List diagnostic categories
categories = client.diagnostics.list_site_diagnostic_categories(
    resource_group_name="my-resource-group",
    site_name="my-web-app"
)

for category in categories:
    print(f"Category: {category.name}, Description: {category.description}")

# Get specific category details
availability_category = client.diagnostics.get_site_diagnostic_category(
    resource_group_name="my-resource-group",
    site_name="my-web-app",
    diagnostic_category="availability"
)

Performance Monitoring

Get Performance Counters

Retrieve performance counter data for a web app.

def list_perfmon_counters(
    self,
    resource_group_name: str,
    name: str,
    **kwargs
) -> List[PerfMonCounterCollection]:
    """
    List performance monitor counters.
    
    Args:
        resource_group_name: Name of the resource group
        name: Name of the web app
        
    Returns:
        List of PerfMonCounterCollection objects
    """

Get Site Metrics

Retrieve metrics and telemetry data.

def list_site_processes(
    self,
    resource_group_name: str,
    name: str,
    **kwargs
) -> List[ProcessInfo]:
    """
    List site processes.
    
    Args:
        resource_group_name: Name of the resource group
        name: Name of the web app
        
    Returns:
        List of ProcessInfo objects
    """

Usage Example:

# Get performance counters
perf_counters = client.diagnostics.list_perfmon_counters(
    resource_group_name="my-resource-group",
    name="my-web-app"
)

for counter in perf_counters:
    print(f"Counter: {counter.name}, Value: {counter.value}")

# Get running processes
processes = client.diagnostics.list_site_processes(
    resource_group_name="my-resource-group",
    name="my-web-app"
)

for process in processes:
    print(f"Process: {process.name}, CPU: {process.cpu_percent}%")

Types

DetectorResponse

class DetectorResponse:
    """Response from a diagnostic detector."""
    id: Optional[str]
    name: Optional[str]
    type: Optional[str]
    metadata: Optional[DetectorInfo]
    dataset: Optional[List[DiagnosticData]]
    status: Optional[Status]
    data_providers_metadata: Optional[List[DataProviderMetadata]]
    suggested_utterances: Optional[SuggestedUtterances]

Recommendation

class Recommendation:
    """Performance or configuration recommendation."""
    id: Optional[str]
    name: Optional[str]
    type: Optional[str]
    creation_time: Optional[datetime]
    recommendation_id: Optional[str]
    resource_id: Optional[str]
    resource_scope: Optional[str]
    rule_name: Optional[str]
    display_name: Optional[str]
    message: Optional[str]
    level: Optional[str]  # Critical, Warning, Information, NonUrgentSuggestion
    channels: Optional[str]  # Notification, Api, Email, Webhook, All
    category_tags: Optional[List[str]]
    action_name: Optional[str]
    enabled: Optional[int]
    states: Optional[List[str]]
    start_time: Optional[datetime]
    end_time: Optional[datetime]
    next_notification_time: Optional[datetime]
    notification_expiration_time: Optional[datetime]
    notified_time: Optional[datetime]
    score: Optional[float]
    is_dynamic: Optional[bool]
    extension_name: Optional[str]
    blade_name: Optional[str]
    forward_link: Optional[str]

ResourceHealthMetadata

class ResourceHealthMetadata:
    """Resource health metadata information."""
    id: Optional[str]
    name: Optional[str]
    type: Optional[str]
    category: Optional[str]
    title: Optional[str]
    description: Optional[str]
    signal_availability: Optional[bool]

DiagnosticAnalysis

class DiagnosticAnalysis:
    """Diagnostic analysis result."""
    id: Optional[str]
    name: Optional[str]
    type: Optional[str]
    start_time: Optional[datetime]
    end_time: Optional[datetime]
    abnormal_time_periods: Optional[List[AbnormalTimePeriod]]
    payload: Optional[List[AnalysisData]]
    non_correlative_detectors: Optional[List[DetectorDefinition]]

DiagnosticCategory

class DiagnosticCategory:
    """Diagnostic category information."""
    id: Optional[str]
    name: Optional[str]
    type: Optional[str]
    description: Optional[str]

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-web

docs

app-service-environments.md

app-service-plans.md

application-configuration.md

certificates-domains.md

deployment-management.md

diagnostics-monitoring.md

index.md

kubernetes-environments.md

static-sites.md

web-applications.md

workflow-management.md

tile.json