Skip to content

Commit

Permalink
Update some logging verbosity, add some more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Troy Harshberger committed Feb 22, 2024
1 parent cf9beb0 commit 048d85d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Modules/CippExtensions/Autotask/New-AutotaskTicket.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function New-AutotaskTicket {
param($atCompany, $title, $description, $estHr = 0.1)

try{
Get-AutotaskToken -configuration $Configuration.Autotask
Get-AutotaskToken -configuration $Configuration.Autotask | Out-Null

$ticket = New-AutotaskBody -Resource Tickets -NoContent
$ticket.Id = "0" #Always 0 for a new ticket
Expand All @@ -25,7 +25,7 @@ function New-AutotaskTicket {
New-AutotaskAPIResource -Resource Tickets -Body $ticket
}
catch {
Write-LogMessage -API 'Autotask' -tenant 'none' -message "Error creating ticket. $($_.Exception.Message)" -Sev Info
Write-LogMessage -API 'Autotask' -tenant 'none' -message "Error creating ticket. $($_.Exception.Message)" -Sev Error
}
}

Expand Down
10 changes: 4 additions & 6 deletions Modules/CippExtensions/IronScales/Get-IronScalesIncidents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function New-IronScalestickets {
$managed_issues_body += Get-BodyForTicket $company
}
else {
Write-LogMessage -API 'IronScales' -tenant 'none' -message "Creating Autotask ticket for IronScales company $($company.customername)" -Sev Info
$ATCompany = Get-AutotaskAPIResource -resource Companies -SimpleSearch "companyname beginswith $($company.Customername.Substring(0,4))"
$tTitle = "[IronScales] New Incident(s) for $($company.CustomerName)"

Expand All @@ -61,6 +62,7 @@ function New-IronScalestickets {
}
}
if($managed_issues_body.Count -ne 0){
Write-LogMessage -API 'IronScales' -tenant 'none' -message "Creating Autotask ticket for managed companies" -Sev Info
$mTitle = "[IronScales-Managed] New Incident(s)"

if(Get-ExistingTicket $mTitle){ continue }
Expand Down Expand Up @@ -130,7 +132,7 @@ function Get-IronScalesIncidents {
$all_unclassified = @()
foreach($company in $SCRIPT:Companies){
try{
Write-LogMessage -API "IronScales" -tenant "none" -message "Getting unclassified incidents for $($company.name):$($company.Id)" -sev Info
Write-LogMessage -API "IronScales" -tenant "none" -message "Getting unclassified incidents for $($company.name):$($company.Id)" -sev Debug
$incidents = Get-Incidents $company.Id

if($incidents.Length -gt 0){
Expand All @@ -147,7 +149,7 @@ function Get-IronScalesIncidents {
}
}

Write-LogMessage -API "IronScales" -tenant "none" -message "Got $($all_unclassified.Length) companies with unclassified incidents." -sev Info
Write-LogMessage -API "IronScales" -tenant "none" -message "Got $($all_unclassified.Length) companies with unclassified incidents." -sev Debug


New-IronScalestickets $all_unclassified
Expand All @@ -159,9 +161,6 @@ function Get-Companies {
return
}

#Write-Host "Getting Companies"
#Write-Host $SCRIPT:JWT

$reqargs = @{
Uri = "$($SCRIPT:apiHost+$is_endpoint.Companies+"list/")"
Headers = @{
Expand All @@ -170,7 +169,6 @@ function Get-Companies {
}

$resp = Invoke-RestMethod @reqargs
#Write-Host $resp
$SCRIPT:Companies = $resp.companies
}

Expand Down

0 comments on commit 048d85d

Please sign in to comment.