Submit a ticketCall us

Training ClassThe Orion® Platform Instructor-led Classes

Provided by SolarWinds® Academy, these trainings will introduce users to the Orion Platform and its features, management, and navigation. These courses are suitable for users looking to discover new tips, tricks, and ways to adapt their Orion products to better suit their monitoring needs:
Deploying the Orion Platform
Configuring Orion views, maps, and accounts
Configuring Orion alerts and reports

Reserve your seat.

Home > Success Center > Kiwi CatTools > Kiwi CatTools Documentation > Kiwi CatTools 3.11 Administrator Guide > Custom scripting > Functions


Table of contents
No headers
Created by Caroline Juszczak, last modified by Caroline Juszczak on Jun 28, 2016

Views: 339 Votes: 0 Revisions: 1


Below are a list of the built in functions available to the Client scripts.


Use the "cl" prefix to access a function from the client.


For example: cl.Log 1, "Expected response not received from command ..."




Function ConnectHost() As Boolean


Attempts to connect to the current host specified in CurDevHostAddress. If the connection is successful, a value of true is returned. The connection will be attempted 3 times before failing. A warning message is logged if a connection attempt fails. After 3 failed attempts, an error message is logged.


Function ConnectHostSingleAttempt() As String


Attempts to connect to the current host specified in CurDevHostAddress. If the connection is successful, a value of "OK" is returned, otherwise the error description will be returned. This function is called 3 times by ConnectHost.


Function ConvertToFilename(Filename as variant) As String


Replaces any invalid characters in the filename with an underscore. The following characters are considered illegal in a filename: "&+?:;,()=|\/<>*^%@". Quotes and spaces are also replaced. This function can be used to convert a device name into a suitable filename.


Function CreateFile(Filename) As Boolean


Attempts to create the specified file even if the path does not exist. If the file already exists, no action will be taken. If the file does not exist, the path and a file are created. The file will be 0 bytes in length.


Function CurrentDateStamp(Format as long) as String


Returns the current date formatted based on the value of "Format".


Format values:

0 = ISO Format (YYYY/MM/DD)

1 = US Format (MM/DD/YYYY)

2 = UK Format (DD/MM/YYYY)


Function CurrentDateTime(Format as long) as String


Returns the current date and time formatted based on the value of "Format".


Format values:





Function CurrentDateTimeStamp(Format as long) as String


Returns the current date and time without separators, formatted based on the value of "Format".


Format values:

0 = ISO Format (YYYY/MM/DD HH:MM:SS)

1 = US Format (MM/DD/YYYY HH:MM:SS)

2 = UK Format (DD/MM/YYYY HH:MM:SS)


Function DBCheckScheduleOption(ScheduleNumber, Option Number) As Long

Returns the activity specific option check box value. Each activity has 10 optional data values that can be set for the activity. Pass the activity number and an option value (from 1 to 10) and the return value of the specific option check box will be returned. 0 = unchecked, 1 = checked. Refer to the activity ini file for details of each specific option.


Sub DBDevicesClearCurDevFields()

Clears all the current device variables and sets them to ""


Sub DBDevicesGetAllFields(DeviceName)

Locates the specified device in the database and loads all the fields into the CurDevXXX variables. To check if the function worked, check len(CurDevName) > 0.


Function DBDevicesGetField(DeviceName, FieldName) as Variant

Returns the data contained in the field "FieldName" of device "DeviceName" from the Database file.

Returns blank if retrieval failed.


Function DBScheduleGetField(ScheduleNumber, FieldName) as String

Returns the data contained in the field "FieldName" of activity "ScheduleNumber" from the Database.

Returns blank if retrieval failed.


Function DeleteFile(Filename) As Boolean

Deletes the specified file and returns true or false based on if the file exists after the delete attempt. True = File deleted. False = File still exists and was not deleted successfully.


Sub DisconnectHost()

Closes the active connection to the current device


Function FileExists(Filename) As Boolean

Tests to see if the specified file exists. Returns true if the file is found, false if it is not.


Sub FlushRxBuffer()

Flushes the data found in the receive buffer and waits until there is no further data being received from the active socket.


Sub InfoUpdate(Message)

Sends an info update message back to the main program.


Sub LogToFile(Filename, Data, Append)

Opens a file for writing. Writes the data stored in Data to the file.

If Append is set to 1, the data is appended to the end of the file. If Append is set to 1, the file is overwritten with the new data.


Function Ping(Hostname As String, Timeout As Long, PingCount As Long, ProcessID As Long) As String

Attempts to ping the host name and returns the results in the format:

!!!!! TAB 100% TAB 10 TAB 100 TAB 80 or ..... TAB 0% TAB TAB TAB

Hostname is the IP address or hostname of the device to ping

Timeout is in seconds. The default is 5 seconds.

PingCount is the number of Ping echo requests to send. Default is 5 pings.

ProcessID is the current processID (cl.ProcessID). This is used to identify the sent ping packets so that the responses can be tied back to the correct process that sent them.

The min, max and average response times will be calculated from any ping echoes received.

The return data is tab delimited for easy parsing and reporting.


Function ReadFromFile(Filename) As String

Reads the contents of the specified filename and returns the data as a string value. A "" value is returned if the file doesn't exist or contains no data.


Function ReplaceClientFilenameVariables(Filename) As String

Replaces the %Variable% item with the associated value.

%AppPath% = cl.AppPath

%GroupName%" = cl.CurDevGroup

%DeviceName% = cl.CurDevName

%DateISO% = cl.CurrentDateStamp(0) ("YYYY-MM-DD")


Sub SaveResults(Data, Append)

Saves results data into separate files. The file name is created from the device name and UniqueFileID set in the Main script.


Filename format:

Filename = cl.AppPath + "\ClientTemp\" + UniqueFileID + ConvertToHex(DeviceName) + ".txt"

DeviceName is converted to hex format to remove any invalid chrs present.


Sub SendData(MessageText)

Sends the string in MessageText to the current connection.


Function WaitForMultData(Mult, Choices, Timeout) As Long

Monitors the RxBuffer for data contained in the Mult() array. If a match is found, the array index value is returned. A return value of 0 indicates that no match was found before the timeout occurred. The timeout is specified in seconds and the variable cl.RecDataTimeOut is usually passed as this value. Choices indicates the number of elements in the Mult array. Example: Mult(1) = "Login:" Mult(2)= "Password:", Choices=2.


Function ReplaceControlChrs(Message) As String

Replaces any control characters (less than ASCII value of 32) with a text string of the numeric value. For example: A tab character (ASCII 9) becomes <009>. This is used when logging debug data to the display or file for later analysis.

Last modified