What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Feature Request - Teamviewer Sensor

Votes:

1

Hello,

for Clients that we only reach by Teamviewer it would be great to have a sensor which checks the availability (online, offline, etc.) of the corresponding ID.

I don't know if thats technically even possible but I think it would be a great addition to make sure all systems are online. Or is there already a way to do it?

Thank you very much and best regards, Sommer.

feature-request request teamviewer

Created on Oct 23, 2017 8:11:18 AM



16 Replies

Accepted Answer

Votes:

0

Hello,
we appreciate your contact and feedback.

There are currently no plans for a team-viewer specific sensor at the present time, but by checking their documentation this should be possible. Please have a look at:

Specifically, in the TeamViewer_API_Documentation.pdf available in the second link documents the following function:

GET /api/v1/sessions (list session codes)

That returns a list of sessions, which reports among other things:

  • sessions – List of session codes.
    • code – Session code.
    • state – State of the session. Can be "open" or "closed".
    • online – Online state of the session. Can be true or false
    • end_customer – End Customer info
      • name – Name of the end customer.
      • email – Email of the end customer.

I believe that this is the information you're after. You'll need to sort the authentication which involves oAuth, but based on this API documentation, it should be possible using PRTG's support for custom sensors:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 23, 2017 10:50:59 AM by  Luciano Lingnau [Paessler]



Votes:

0

Did someone do that?

Created on Mar 8, 2019 11:27:24 AM



Votes:

0

Same feature request here :)

Created on Apr 23, 2019 2:04:29 PM



Votes:

0

Hi there,

This is not an official feature request, just a guidance by Luciano to come up with a solution. Until now we don't have a working sensor or script to achieve that though.

Best regards.

Created on Apr 23, 2019 6:13:24 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Explain on fingers how to implement it. Does not work

Created on May 29, 2019 11:01:42 AM



Votes:

0

Hi there,

I am really not sure what you mean by "Explain on fingers how to implement it.". Could you further elaborate?

Best regards.

Created on May 29, 2019 12:06:20 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

I have Teamviewer API Token. I can make a device request using the PowerShell Studio Module, but I need to do this GET request from PRTG. I can not understand how to do this, because the Teamviewer API differs from the standard and the Token is not used in the request link.

Created on May 30, 2019 6:06:02 AM



Votes:

0

I need to know only the device Online or OfflineOnline или Offline

Created on May 30, 2019 6:12:22 AM



Votes:

0

Hi there,

To do this you will need to write a PowerShell Script (Invoke-WebRequest):
https://kb.paessler.com/en/topic/71356-guide-for-powershell-based-custom-sensors

Best regards.

Created on May 30, 2019 7:05:59 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

PowerShell Script request:

	<#
		.SYNOPSIS
			Set Teamviewer Token for All Other Functions, Also Test the connection to Teamviewer API
		
		.DESCRIPTION
			Use to Set Teamviewer Token For All Other Functions.
			Will Also use the GET /api/v1/ping API Function
		
		.PARAMETER UserToken
			Is the User Level Token that you can create from the Teamviewer Management Console
			Use Script and Not App Token and User not Company Token.
		
		.EXAMPLE
			PS C:\> Set-TVToken -UserToken $value1
		
		.NOTES
			For more Details see Teamviewer API token Documentation
			https://www.teamviewer.com/en/for-developers/teamviewer-api/
			https://dl.tvcdn.de/integrate/TeamViewer_API_Documentation.pdf
	#>
	function Set-TVToken
	{
		[CmdletBinding(ConfirmImpact = 'Medium',
					   PositionalBinding = $false,
					   SupportsPaging = $true,
					   SupportsShouldProcess = $true)]
		param
		(
			[Parameter(Mandatory = $true)]
			[Alias('Token')]
			[string]$UserToken
		)
		
		$header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
		$header.Add("authorization", "Bearer  $UserToken")
		$TokenTest = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/ping" -Method GET -Headers $header -ContentType application/json
		if ($TokenTest.token_valid -eq $true)
		{
			Write-Output "Teamviewer Token Is Working and Set"
			$global:TVToken = $UserToken
		}
		else
		{
			Write-Output "Teamviewer Token not working"
		}
	}
		.SYNOPSIS
			Gets All Teamviewer Device Info from Alias Can be Portion of the alias
		
		.DESCRIPTION
			Get all possible information of a Device from it's alias
		
		.PARAMETER alias
			Is the Name of the Device seen in all console
		
		.PARAMETER token
			Is the User Level Token that you can create from the Teamviewer Management Console
			Can use Set-TVToken Function will then not be nessessary to use this paramameter
		
		.EXAMPLE
			PS C:\> Get-TVDeviceInfoFromAlias -alias $value1
		
		.NOTES
			For more Details see Teamviewer API token Documentation
			https://www.teamviewer.com/en/for-developers/teamviewer-api/
			https://dl.tvcdn.de/integrate/TeamViewer_API_Documentation.pdf
	#>
	function Get-TVDeviceInfoFromAlias
	{
		[CmdletBinding(ConfirmImpact = 'Medium',
					   PositionalBinding = $false,
					   SupportsPaging = $true,
					   SupportsShouldProcess = $true)]
		param
		(
			[Parameter(Mandatory = $true)]
			$alias,
			$token
		)
		
		if($token)
        {}
		elseif ($global:TVToken)
		{
			$token = $global:TVToken
		}
		else
		{
			Write-Output "You need to Set the Token"
			break
		}
		$header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
		$header.Add("authorization", "Bearer  $token")
		$Device = Invoke-RestMethod -Uri "https://webapi.teamviewer.com/api/v1/devices?full_list=true" -Method GET -Headers $header -ContentType application/json
		$DeviceInformation = $Device.devices | Where-Object { $_.alias -like "*$alias*" }
		$DeviceInformation
	}

Answer :

remotecontrol_id   : r359023409
device_id          : d895162687
alias              : fts
groupid            : g113852238
online_state       : Online
assigned_to        : False
supported_features : remote_control, chat

How can I describe the answer in this .ps1 request?

#region: XML Output
Write-Verbose "XML Output..."
...

Created on May 30, 2019 10:25:27 AM



Votes:

0

Hi there,

In case you wonder what the output for PRTG should look like, please check the corresponding manual for this: https://www.paessler.com/manuals/prtg/custom_sensors

Best regards.

Created on May 30, 2019 10:45:15 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

I was looking for an example of output "Ok" status. Not found. Someone show how to transfer the status of the XML format?

Created on Jun 3, 2019 12:15:38 PM



Votes:

0

Hi there,

Please check how the output should look like for the Advanced Sensor:
https://www.paessler.com/manuals/prtg/custom_sensors#advanced_sensors

A simple "Ok" would be the following:

           <prtg>
            <result>
            <channel>First channel</channel>
            <value>10</value>
            </result>
            <result>
            <channel>Second channel</channel>
            <value>20</value>
            </result>
            </prtg>

Best regards.

Created on Jun 3, 2019 12:42:34 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Sensor gets code: PE231

If the answer contains the string: online_state : Online or online_state : Offline what then is the XML Output for PRTG?

Created on Jun 3, 2019 1:46:12 PM



Votes:

0

Hi there,

You will need to write a proper output as PRTG can't possibly know what "online_state : Offline" means. As displayed above, you can see sample output for PRTG in an XML format.

The best way would be to put the output into a number-based context, an example with limits (you can also use a value lookup)

$mysupercoolvariable = "Online"

if ($mysupercoolvariable -eq "Online"){
    $value = 0
} elseif ($mysupercoolvariable -eq "Offline"){
    $value = 1
} else {
    $value = -1
}

Write-Host @"
<prtg>
<result>
<channel>Status</channel>
<value>$($value)</value>
<LimitMode>1</LimitMode>
<LimitMaxError>0</LimitMaxError>
<LimitMinError>0</LimitMinError>
</result>
<text>The current status is: $($mysupercoolvariable)</text>
</prtg>
"@

Best regards.

Created on Jun 4, 2019 4:46:21 AM by  Dariusz Gorka [Paessler Support]



Votes:

2

<#
    .NOTES
    --------------------------------------------------------------------------------
     Code generated by:  K0NCTANT1N ([email protected])
     Generated on:       2019-06-06 8:27 PM
     Generated by:       K0NCTANT1N
     Filename:           TeamViewerDeviceStatus.ps1
     VERSION:            1.2
    --------------------------------------------------------------------------------
    .DESCRIPTION
        Script generated by K0NCTANT1N using TeamViewerPSModules from PowerShell Studio 2019
#>


	<#

		.SYNOPSIS
			Powershell script to monitor the Status Devices from TeamViewer using PRTG
		
		.DESCRIPTION
			This script is intended to be used with PRTG Network Monitor (as a custom "EXE/Script Advanced" sensor).
			It will return the Status Teamviewer Device from TeamViewer.
		
		.PARAMETER UserToken
			To create the API token with User level, please do the following:
			Sign in with your TeamViewer account on the Management Console (www.login.teamviewer.com)
			Open Management Console -> Edit profile -> Apps -> Create script token. Add the permission View for Computers & Contacts.
			Use Script and Not App Token and User not Company Token.

		.PARAMETER Alias
			Is the Name of the Device seen in Teamviewer Management Console
		
		.EXAMPLE
			#PS C:\> TeamViewerDeviceStatus.ps1 "$UserToken" "$Alias"
		
		.NOTES
			You must download and install the Powershell Module To manage Teamviewer: https://www.powershellgallery.com/packages/TeamViewerPSModules/1.3.0.0
			This script must be placed into the folder: C:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML
			Now you can add a new “EXE/Script Advanced” sensor (I would recommend adding the sensor to the probe device) and select TeamViewerDeviceStatus.ps1” in the dropdown for the “EXE/Script” setting.
		.LINK
			Topic link: https://kb.paessler.com/en/topic/76285-feature-request-teamviewer-sensor

	#>
	Param (
		[string]$UserToken,
		[string]$Alias
	)

	<#
		.SYNOPSIS
			Set Teamviewer Token for All Other Functions, Also Test the connection to Teamviewer API
		
		.DESCRIPTION
			Use to Set Teamviewer Token For All Other Functions.
			Will Also use the GET /api/v1/ping API Function
		
		.PARAMETER UserToken
			Is the User Level Token that you can create from the Teamviewer Management Console
			Use Script and Not App Token and User not Company Token.
		
		.EXAMPLE
			#PS C:\> Set-TVToken -UserToken $value1
		
		.NOTES
			For more Details see Teamviewer API token Documentation
			https://www.teamviewer.com/en/for-developers/teamviewer-api/
			https://dl.tvcdn.de/integrate/TeamViewer_API_Documentation.pdf
	#>
	Set-TVToken -UserToken $UserToken

	<#
		.SYNOPSIS
			Gets All Teamviewer Device Info from Alias Can be Portion of the alias
		
		.DESCRIPTION
			Get all possible information of a Device from it's alias
		
		.PARAMETER alias
			Is the Name of the Device seen in all console
		
		.PARAMETER token
			Is the User Level Token that you can create from the Teamviewer Management Console
			Can use Set-TVToken Function will then not be nessessary to use this paramameter
		
		.EXAMPLE
			PS C:\> Get-TVDeviceInfoFromAlias -alias $value1
		
		.NOTES
			For more Details see Teamviewer API token Documentation
			https://www.teamviewer.com/en/for-developers/teamviewer-api/
			https://dl.tvcdn.de/integrate/TeamViewer_API_Documentation.pdf
	#>
	$StatusVariable = Get-TVDeviceInfoFromAlias -alias $Alias


	if ($StatusVariable | ?{ $_.online_state -eq "Online"}){
	    $value = 0
	} elseif ($StatusVariable | ?{ $_.online_state -eq "Offline"}){
	    $value = 1
	} else {
	    $value = -1
	}

	<#
	Write Results XML Output...
	#>
	Write-Host "<prtg>"
		     "<result>"
		     "<channel>Status</channel>"
		     "<value>$($value)</value>"
		     "<LimitMaxError>0</LimitMaxError>"
		     "<LimitMinError>-1</LimitMinError>"
		     "<LimitMode>1</LimitMode>"
		     "</result>"
		     "<text>Last message: $($StatusVariable)</text>"
	Write-Host "</prtg>"

Created on Jun 13, 2019 11:41:07 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.