If you run the Citrix Director Web-based management console well keep Citrix Director Plugin Model

11:42 AM

If you run the Citrix Director Web-based management console well keep Citrix Director Plugin Model - XenDesktop and XenApp sites, you might want to add customized fields for monitoring tool. Why?

For most companies, it is often necessary to add a few custom fields to the monitoring tool. For example, you can expose the SNMP traps information by Director Server as a JSON API. Or maybe you want to show additional information on Director User Details page.

This post explains how to write the Director of plugins.

Citrix Director is designed to allow us to add our own plugins. There are 2 types of plugins, plugin backend and UI plugin. If we expose any additional information as JSON API calls, back-end plug-in mechanism can be used. If we want to be displayed on the UI Director additional information or if we want to show to other Director Console, the UI plug-in is used.

Director plugin architecture

architecture

As the diagram shows, can invite Director Internal and external plugins. For the internal plugins plug-in code is loaded and hosted by director webservice. External plugins are those that are hosted on a separate Web server and embedded in Director.

As a Director Backend Plugin add

director is hosted as a web service that makes several APIs for trends, Dashboard and other pages. For suspend our own APIs by Director, we need to write a Director backend plugin.

a plugin Director to write back, is very simple. All we need is a DLL file and place it to create the folder "C: inetpub wwwroot Director plugin" in Director Server and restart the IIS server

Here Code as we is sample. can write a backend plugin. You can directly use this code to write the business logic in test function. Then build a DLL and use it, you are your plugin. There are comments from the code to make it easier to understand. We recommend using Visual Studio for development and the creation of the dll.

Just to have an insight into the code, we first need to import the namespaces. There are three major classes must we import, webservice, Plugin. Inetpub wwwroot Director bin

code1

We need to define a return class that is returned by a Web service request: You can find these DLLs in C , Ensure DataContract and DataMember properties to add. This is to register these classes and property as public.

code2

Then you need to create an interface with plug-attributes property. It should contain the prototype of the function that is exposed as a web service. In this case, "MakeOdataQuery" is the API that is exposed.

code3

Finally, the interface should be implemented in a class. Have to get the complete code a look at the OdataQuery.cs.

How to write Director UI plugin

Director supports our own UI plugin on dashboard add Trends, endpoint details, Equipment details, user details page. For the plugin to show, we need to follow two steps.

  • to create a plugin config file

a configuration file for creating plugin and place them in a folder in the location " C: inetpub wwwroot Director displayconfig "

If you want the external side load, as would the config file .:

</p> <p> <en> MyPlugin </en> </p> <p> <ja> MyPlugin </ja> </p> <p> <zh_CN> MyPlugin </zh_CN> </p> <p>

http://www.citrix.com

http : //www.citrix.com

649

[1945003[

the Config file looks like this when you want to load the file into Director Server:

</p> <p> <en> MyPlugin </en> </p> <p> <ja> MyPlugin </ja> </p> <p> <zh_CN> MyPlugin </zh_CN> </p> <p>

plugins / MyPLugin.html

plugins / MyPLugin.html - the HTML file should be / Plugins folders are stored

649

Note: you can copy the content above and as mypluginConfig .xml

  • Edit page config file

dashboards, trends and UserDetial side have their own configuration file. ": Inetpub wwwroot Director displayconfig C" in Director Server We can find in the folder. Inorder to add the plugin, we have the following lines in each file.

By adding the above lines to the configuration file, we will see a new line on the Add each page. In this line, the plugin is loaded. If you want 2 plugin page like to add on the same line of page, you can do this by adding the following lines

[1945040HieristdieHTMLsamplejavascriptCodedesUIplugin]

, which calls the backend service and is a the JSON response to the text box.

Director Plugin

[1945057speichern]

the above code as MyPLugin.html in the folder "C :.. inetpub wwwroot Director "Now restart the server and plug-in will be charged the Director user interface

example

Let's look at a have sample. We have implemented a plugin for creating custom report via XenDesktop.

customer report plugin

This plugin has two parts. UI plugin and backend plugin. You can download from here complete code and executables.

Custom Reports code

Custom Report Installer XD 7.6

GiHub Repository

Add

UI plugin, unzip the downloaded file. Full logic of the user interface to be loaded into index.html file in custom reports folder

steps Director configure UI plugin on trend page .:

  • Location Custom Report folder in c: inetpub , wwwroot Director Plugins directory
  • you have to edit TrendspageConfig.xml within c: inetpub wwwroot Director displayconfig. Replace the file with the in zip folder
  • Create a Custom Report folders inside C: .. Inetpub wwwroot Director displayconfig and copy XDCustomreportConfig.xml file into

This will load UI plugin director. It sees this

custom report

add a backend plugin, you must OdataQuery.dll and start to copy IIS. , Director service will import this DLL and expose the API of this DLL as WebService

Just to have a little taste, in the dll, provides template code as follows:

// Director namespaces we have to use

with Citrix.Dmc.Common;

with Citrix.Dmc.Common.Utilities;

with Citrix.Dmc.Common.Plugin;

with Citrix.Dmc.Connector;

Citrix.Dmc.WebService.Utilities used;

with Citrix.Dmc.Connector.Broker;

with Citrix.Dmc .Resources.Service;

using System.Diagnostics;

with Citrix.Dmc.WebService;

// the namespace that you implement

namespace OdataQuery

{

[DataContract]

public class OdataReturn

{

[DataMember]

public string [] [] response;

public OdataReturn (string [] [] res)

{

response = res;

}

}

[PluginAttribute]

public interface pluginDllInterafce

{

[OperationContract]

[FaultContract(typeof(DmcServiceFault))]

[WebInvoke(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]

string MakeOdataQuery (string Report, string SITEID, string query);

}

// Class

public class Plugin Test: pluginDllInterafce, IDisposable

{

public string MakeOdataQuery (String Report, string SITEID, string query)

{

/ * Login * implementation?

}}}

Previous
Next Post »
0 Komentar