Samples are the source codes of console utilities, which implement loading events into Traffic Monitor using Thrift interface of pushAPI SDK.
The first utility is pushapi-cpp. It is implemented in С++ and prepared for assembly in Windows and Linux operating systems. This utility demonstrates scripts of loading all event types that are already registered with Traffic Monitor.
The second utility is pushapi-csharp. It is implemented in С# and prepared for assembly in Windows operating system. This utility demonstrates scripts of loading all event types that are already registered with Traffic Monitor.
The third utility is pushapi-demo.py. Is implemented in Python. Is prepared for assembly in Windows and Linux operating systems. This utility demonstrates scripts of loading all event types that are already registered with Traffic Monitor.
The fourth utility is pushapi-util. It is implemented in С++ and prepared for assembly in Windows and Linux operating systems. This utility has an advanced command-line interface which enables uploading any events to Traffic Monitor system, including events registered with an external system. Here is the command line description:
./pushevent-util --host <pushapi address > [--port <pushapi port>]
--token <plugin token>
--id <company>--class <event class>
--service <event service>--evtattr <attr_name:attr_value,…, attr_name:attr_value>--sender <contact_type:contact_value,attr_name:attr_value,…,attr_name:attr_value>--receiver <contact_type:contact_value,attr_name:attr_value,…,attr_name:attr_value>--data file:<data_falie_name>, attr_name:attr_value,…, attr_name:attr_value--mes <contact_type:contact_value,"message text"[–addctx]
Where:
- <pushapi address > – pushAPI server address;
- <pushapi port> – pushAPI server port; if the port is not specified, a default value is used;
- <plugin token> – the plugin authorization token. It is retrieved from the console, from the section of the given plugin;
- <company> – an identifier of the plugin vendor. A string, which must be the same as the string used for generating a license for the plugin;
- <event class> – the class of the passed event;
- <event service> – the service of the passed event. The plugin can register intercepted services by their names and pass the names;
- --evtattr – attributes of the passed event. Can be viewed in the list of commands with a sample. Some attribute names have fixed values and business sense;
--sender – the event sender. The first pair of parameters defines the sender's contact. Then the sender's attributes are specified. There are three "special" contact types: dev (the sender/recipient is a device), res (the sender/recipient is a resource), ws (the sender/recipient is a "Workstation"). If no sender is specified, then two senders will be generated: one sender with "Person" type and "auth" contact type and the other sender with "Workstation" type and
dnshostnamecontact. Only one sender can be specified;- --receiver – the event recipient. Has the same parameters as the sender;
- --data – the event data. The first pair of parameters defines the path to a file with the event body. Other parameters describe attributes of these data. Some of the attributes are required for some event types;
- --mes – passing events of "Chat" class. A contact of the message sender and the message contents are specified. There can be several messages;
- --addctx – an optional parameter. Automatically adds two senders to the event: one sender with "Person" type and "auth" contact type and the other sender with "Workstation" type and dnshostname contact type.
Examples of calling this utility can be found in the source codes of samples.
Besides, SDK samples include:
- pluging.json file – JSON scheme of mainifest.json file, which is included in the registration file for a new plugin;
plugin.zip file – a sample of file used for registration of an external plugin.
Important!
The file contains an expired license. To use the sample file for registration of the plugin, you need to obtain a new license.