Home Directory Addons Others GenerateRDPFile

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree


3 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
Generating RDP files in Nagios.txtGenerating RDP Files notes
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Generate RDP files directly from Nagios.
I ran into this link when I was trying to figure out how to open Remote Desktop directly from Nagios:

It was originally created for use in Nagvis, but I have modified it to suit my needs and implemented it in Nagios instead.

First, you need to create a file in the Nagiossbin folder called "GenerateRDPFile" or something that works for you. Then fill it with this code (file provided above):

ADDRESS=$(echo ${QUERY_STRING} | grep -oE "(^|[?&])address=b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)b" | cut -f 2 -d "=" | head -n1)
HOST=$(echo ${QUERY_STRING} | grep -oE "(^|[?&])host=.+" | cut -f 2 -d "=" | head -n1)

echo Content-type: application/octet-stream
echo "content-disposition: attachment;filename=$HOST.rdp"

echo screen mode id:i:1
echo desktopwidth:i:800
echo desktopheight:i:600
echo session bpp:i:16
echo winposstr:s:0,9,603,284,1891,1335
echo auto connect:i:0
echo full address:s:$ADDRESS
echo compression:i:1
echo keyboardhook:i:2
echo audiomode:i:2
echo redirectdrives:i:0
echo redirectprinters:i:1
echo redirectcomports:i:0
echo redirectsmartcards:i:1
echo displayconnectionbar:i:1
echo autoreconnection enabled:i:1
echo alternate shell:s:
echo shell working directory:s:
echo disable wallpaper:i:0
echo disable full window drag:i:0
echo disable menu anims:i:0
echo disable themes:i:0
echo disable cursor setting:i:0
echo bitmapcachepersistenable:i:1
echo redirectclipboard:i:1
echo redirectposdevices:i:0
echo authentication level:i:0
echo prompt for credentials:i:0
echo negotiate security layer:i:1
echo remoteapplicationmode:i:0
echo allow desktop composition:i:0
echo allow font smoothing:i:1
echo gatewayhostname:s:
echo gatewayusagemethod:i:0
echo gatewaycredentialssource:i:4
echo gatewayprofileusagemethod:i:0
echo drivestoredirect:s:
echo promptcredentialonce:i:1

Then make it executable: "chmod 755 GenerateRDPFile".

Then use this bit as an action_url or notes_url for your hosts (or in your windows-server template so it will be applied to all of your Windows servers): "/nagios/cgi-bin/GenerateRDPFile?address=$HOSTADDRESS$&host=$HOSTNAME$"

Save, check your config, then restart Nagios. When you click on your extra actions or notes icon it will produce an RDP file with the host_name of the server. When you run it it will use the IP address to access the server with RDP.

This can also be extended for use with VNC files as well. Hope this is helpful to some of you.
Reviews (1)
bysvissa, August 15, 2012
Hey, This helped me a lot.

This didn't worked for me, i have changed the first 2 lines, then it worked like a charm..

ADDRESS=$(echo ${QUERY_STRING} | grep -oE "address=.*" | cut -f 1 -d "&" | cut -f 2 -d "=" | head -n1)
HOST=$(echo ${QUERY_STRING} | grep -oE "(^|[?&])host=.+" | cut -f 2 -d "=" | head -n1)