Code Monkey home page Code Monkey logo

zabbix_template_rdp_monitoring's Introduction

RDP ServerMonitoring

Improved by Ilias Aidar 24/09/2019

Originally created by Diego Cavalcante - 10/02/2017

If you have a Windows RDP “Terminal Server” server, monitoring consists of collecting connection statistics from users.

ITEMS

  • Total Active Users
  • Total inactive users
  • Name of active users
  • Name of inactive users
  • Remote IP Address of Active Users
  • Remote device hostname of active users
  • Terminal Service
  • Terminal Service License
  • RDP port status

TRIGGERS

  • Number of Connected Users
  • Number of Logged Out Users
  • RDP Port Status
  • Remote Desktop Licensing Service Status
  • Remote Desktop Services Service Status

1. HOST PREPARATION

Monitoring itself requires some adjustments to be made to the host prior to data collection. As an example in my environment there are some default directories that I use for Scripts and UserParameters.

Scripts: C:\app\zabbix\scripts
UserParameters: C:\app\zabbix\conf\rdp

NOTE: Adjust according to your environment, within Host zabbix_agentd.conf, adjust the parameter: Include = and point to directory where it will contain your .conf files with the UserParameters.

2. INITIAL REQUIREMENTS

  • Open Powershell as Administrator and run the command and confirm:
Set-ExecutionPolicy Unrestricted
  • If you have already done the above procedure on the Host, disregard and skip to the next request.
  • Put rdp.terminal.server.ps1 in the directory of your choice.
  • Put rdp.terminal.server.conf in the directory of your choice.
  • Install the rdp.terminal.server.msi Module
  • After installation, copy the folder C:\Users\YourUser\Documents\WindowsPowerShell\modules\PSTerminalServices\
  • Paste the PSTerminalServices folder into C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
  • Restart Zabbix Agent on the Host.

3. TESTS

Open powershell and navigate to the script folder and test with the commands available below:

  • .\rdp.terminal.server.ps1 AСTIVE
  • .\rdp.terminal.server.ps1 ACTIVENUM
  • .\rdp.terminal.server.ps1 IP
  • .\rdp.terminal.server.ps1 DEVICE
  • .\rdp.terminal.server.ps1 INACTIVE
  • .\rdp.terminal.server.ps1 INACTIVENUM

NOTE: If any errors appear while executing the commands, review all previous steps.

4. HOST MACROS

The template uses separate macros, and must be registered in the monitored Host. {$RDPPORT} = Port that the RDP server is listening on, default 3389. {$RDPA} = Used for triggering, eg 5 if you want an alarm if there are more than 5 active users connected. {$RDPI} = Used for triggering, eg 5 if you want an alarm if there are more than 5 idle users connected.

5. TEMPLATE

Import the Template - Template__Windows_RDP_Terminal_Server.xml into your Zabbix Frontend.

  • Register the above Macros on the Host.
  • Associate the Template with the monitored Host and wait for the collection.
  • Adjust the collection intervals, History retention period and Trend of items according to your environment.

NOTE: If data is not collected, use and abuse zabbix_get to validate data collection.

zabbix_template_rdp_monitoring's People

Contributors

ismartypro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zabbix_template_rdp_monitoring's Issues

ZABBIX_6 no does not provide answers

greetings, about the template for zabbix 6 a lot has changed, this procedure still works, I tested it in this version without success, in Windows everything installed correctly, but in zabbix without any success.

Problemas com o zabbix 6

Good afternoon

I tried to use your template in zabbix 6.0.7, but I can't see any data, can you help me with this, do you plan to release it for zabbix 6?

Yours sincerely.
2022-09-12_132352

rdp.terminal.server.msi wants to install to an invalid pathname

When attempting to install rdp.terminal.server.msi, it aborts and complains of a pathname of \\<server>\home\<admin name>\\WindowsPowerShell\modules\PSTerminalServices

Please note the double backslashes prior to the WindowsPowerShell subfolder.

How can I work around this one?

adicionar a quantidade de processos por cada usuários

adicionei esse script ao seu script para trazer quantos processos cada usuário possui no server:
Add ths script inside your script for get how many process

param(
[string]$NomeUsuario
)

if (-not $NomeUsuario) {
Write-Host "Por favor, forneça o nome do usuário como argumento ao executar o script."
exit
}

$sessoes = Get-TSSession -State Active -ComputerName localhost
$processos = Get-Process
$processosPorUsuario = @{}

foreach ($sessao in $sessoes) {
$processosDaSessao = $processos | Where-Object { $_.SessionId -eq $sessao.SessionId }

$usuario = "$($sessao.DomainName)\$($sessao.UserName)"

if ($usuario -eq $NomeUsuario) {
    if ($processosDaSessao) {
        if (-not $processosPorUsuario.ContainsKey($usuario)) {
            $processosPorUsuario[$usuario] = 0
        }
        $processosPorUsuario[$usuario] += $processosDaSessao.Count
    }
}

}

if ($processosPorUsuario.Count -gt 0) {
foreach ($usuario in $processosPorUsuario.Keys) {
$numProcessos = $processosPorUsuario[$usuario]
Write-Host $numProcessos
}
} else {
Write-Host 0
}

acho que seria uma boa adição ao seu projeto

Template not importing into zabbix 4.4

Changed XML Server version to 4.4 and now I get a different error:
Invalid tag "/zabbix_export/templates/template(1)/items/item(1)/type": unexpected constant "Zabbix agent".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.