#checkmk plugin - to read other checkmk agent using powershell
#place this .ps (powershell) script to a file stored in directory: C:\ProgramData\checkmk\agent\plugins

$Server = "172.23.225.161"
$Port = "6556"
$hostname = "my-host-name"

Write-Output "<<<<$hostname>>>>"

[System.Net.Sockets.TcpClient] $tcpClient = [System.Net.Sockets.TcpClient]::new($Server, $Port)

$tcpStream = $tcpClient.GetStream()
$reader = [System.IO.StreamReader]::new($tcpStream)


while (($Line = $reader.ReadLine()) -ne $null) {
$Line
}
$reader.close();
$tcpClient.close();

computer2know :: thank you for your visit :: have a nice day :: © 2024