'Measure time of execution of an Elrond's transacion
I'm sending transactions using Python 3 and erdpy. When the transaction ends with status "success", I have in the transaction's data a timestamp that I think it is the time the transactions entered the blockchain. But, is there a way to know another timestamp with the time that the transaction was resolved?
I want to know how much time took to process a single transaction.
Solution 1:[1]
I have something the same, but for azure workbook, it could help you - it will take all public IPs from your subscription and will do a telnet to 3389 and 1433 ports, and, if opened - send an email.
workflow PortChecker
{
#RunAs account name
$connectionName = "AzureRunAsConnection"
#connect to azure subscription
$servicePrincipalConnection = Get-AutomationConnection -Name $connectionName
$connectionResult = Connect-AzAccount -Tenant $servicePrincipalConnection.TenantID -ApplicationId $servicePrincipalConnection.ApplicationID -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint -ServicePrincipal
$exclude = "Not Assigned"
$publicIps = Get-AzPublicIpAddress | where -Property IpAddress -CNotMatch $exclude | Select -ExpandProperty IpAddress
function Test-Port
{
param
(
[Parameter(Position=0, Mandatory = $True, HelpMessage="Provide destination source", ValueFromPipeline = $true)]
$Address,
[Parameter(Position=1, Mandatory = $False, HelpMessage="Provide port numbers", ValueFromPipeline = $true)]
$Port
)
$ErrorActionPreference = "SilentlyContinue"
$Results = @()
ForEach ($A in $Address) {
$Object = New-Object PSCustomObject
$Object | Add-Member -MemberType NoteProperty -Name "Destination" -Value $A
ForEach ($P in $Port) {
try
{
$tcpClient = new-object Net.Sockets.TcpClient
$tcpClient.Connect("$A", $P)
$Object = "For IP: $Address Port $P is open"
}
catch
{
$Object = "For IP: $Address Port $P is closed"
}
finally
{
$tcpClient.Dispose()
}
$Results += $Object
}
If($Results){
$Results
}}}
$allinfo = foreach -parallel ($publicIps in $publicIps) {Test-Port $publicIps -Port 1433, 3389}
$username = "---"
$password = '---' | ConvertTo-SecureString -asPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($username,$password)
#write-output $allinfo
$alertIP = $allinfo | where-object {$_ -like '*open*'}
#write-output $alertIP
if ($allinfo -like '*open*') { Send-MailMessage -SmtpServer %email-server% -useSsl -Port 587 -Credential $cred -From %From% -To %to% -Subject "New open port detected" -Body "New open port detected $alertIP, please check the Azure Portal" }
else {}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | nobodyfromhell |
