Contents 

Overview
Fundamentals
Variable declaration
Variable assignment
Adding variables
Setting variables
Include function
Evaluate function
Constants
Arrays
If...then...else Statement
For Statement
Foreach Statement
While Statement
Function definition
Operators
Comments
Performance Profiler
Functions
String processing
Overview
Length
Left
Right
Mid
Trim
TrimLeft
TrimRight
ToUpper
ToLower
Find
FindOneOf
ReverseFind
WildcardCompare
Tokenize
RegularExpressionMatch
RegularExpressionParse
Operator [ ]
Delete
Remove
Replace
MakeReverse
SpanIncluding
SpanExcluding
ToUTF8
FromUTF8
File IO routines
Overview
ReadData
ReadDataToString
WriteData
ReadString
WriteString
AppendString
GetLastFileError
EOF
CloseFile
CreateDir
RemoveDir
ChangeDir
GetCurrentDir
IsFileExist
FileSize
CopyFile
MoveFile
RemoveFile
Seek
SeekToBegin
SeekToEnd
SetFileEncoding
SetUseUnicodeBOM
ListFiles
CountFilesInFolder
MapNetworkDrive
DisconnectNetworkDrive
EnumerateDrives
GetDriveInfo
Time routines
Overview
Sleep
MilliSleep
GetTime
GetTimeString
FormatTime
ConvertToUnixTime
GetTickCount
SNMP management
Overview
SnmpGet
SnmpGetNext
SnmpGetBulk
SnmpSet
GetPduErrorStatus
GetPduErrorString
GetPduErrorIndex
GetVarCount
GetVarAt
CreatePdu
AppendVar
GetVarOID
GetVarResolvedName
GetVarValue
GetVarResolvedValue
GetVarResolvedDescription
GetVarSyntax
CreateVar
GetPduIp
GetPduEnterprise
GetPduTrapCode
GetPduTrapName
GetPduResolvedTrapName
GetPduResolvedTrapDescription
GetPduCommunity
GetPduVersion
SendTrap
ForwardTrap
PrepareTrapPdu
SetMaxPduSize
SNMP MIB functions
Overview
LoadMIB
ResolveOID
GetOidByName
ResolveTrap
UnloadMIB
QuickMibLookup
Cryptography
Overview
Encrypt
Decrypt
CalculateMD5Hash
CalculateSHA1Hash
HMAC
BuildKeyFromPassword
Base64Encode
Base64Decode
CRC16
CRC32
HexStringToByteArray
ByteArrayToHexString
Skype integration functions
Overview
SkypeGetContacts
SkypeSendChatMessage
SkypeSendSMS
SkypeCallAndSpeakText
XML processing
Overview
ReadXml
WriteXml
GetXmlTag
CreateXml
InsertAttr
IsXmlValid
SelectXmlNodes
XslTransform
GetAttrString
GetAttrInt
GetAttrDouble
GetXmlBody
GetXmlAttributes
SetXmlBody
AddChild
GetChildrenCount
GetChildAt
JSON processing
Overview
ParseJSON
ToJSON
FTP functions
Overview
FtpOpen
FtpClose
FtpGetCurrentDir
FtpSetCurrentDir
FtpCreateDir
FtpRemoveDir
FtpGet
FtpPut
FtpRemoveFile
FtpRenameFile
FtpListFiles
FtpCountFilesInFolder
TFTP functions
Overview
TFTPGet
TFTPPut
Networking functions
Overview
HttpPing
HttpGet
HttpPost
OpenTCPConnection
OpenUDPSocket
SendTCPData
SendUDPData
IsDataAvailable
ReadTCPData
ReadUDPData
CloseSocket
TCPListen
TCPAcceptConnection
GetHostByAddress
GetAddressByName
DnsQuery
SendMail
SendMailEx
SendHtmlMail
TestSMTPConnection
GetHostName
GetHostDnsSuffix
GetSocketName
SetSocketOption
TestPOP3Connection
POP3GetStats
POP3 Mail Client Example
Ping
TraceRoute
GetMacAddress
EnumerateSharedResources
Working with serial ports and USB HID devices
Overview
OpenSerialPort
CloseSerialPort
IsSerialDataAvailable
ReadSerialData
WriteSerialData
WriteSerialControlChar
SetSerialFlowControl
ClearSerialDTR
ClearSerialRTS
SetSerialDTR
SetSerialRTS
SetSerialXOFF
SetSerialXON
SetSerialBreak
ClearSerialBreak
GetSerialModemStatus
USBOpen
USBClose
USBWriteFeatureReport
USBReadFeatureReport
USBWriteData
USBReadData
USBEnumerateDevices
USBGetFeatureReportLength
Working with Ginkgo USB-I2C adapter
Overview
USBAdapterOpen
USBAdapterClose
USBAdapterBoardInfo
USBAdapterSetPins
USBAdapterResetPins
USBAdapterSetInput
USBAdapterSetOutput
USBAdapterSetOpenDrain
USBAdapterReadGPIO
USBAdapterGetErrorString
USBAdapterSetReadBufferSize
USBAdapterInitI2C
USBAdapterInitTimeConfig
USBAdapterInitADC
USBAdapterInitPWM
USBAdapterInitCNT
USBAdapterInitUART
USBAdapterReadI2C
USBAdapterReadSlaveI2C
USBAdapterReadADC
USBAdapterReadUART
USBAdapterWriteI2C
USBAdapterWriteSlaveI2C
USBAdapterWriteUART
USBAdapterSetPWMPulse
USBAdapterSetPWMPeriod
USBAdapterStartPWM
USBAdapterStopPWM
USBAdapterSetCounter
USBAdapterStartCounter
USBAdapterGetCounter
USBAdapterStopCounter
Working with GSM modems
Overview
SendSMS
RetrieveAllSMSMessages
RetrieveUnreadSMSMessages
DeleteSMSMessage
DeleteAllSMSMessages
Working with zip archives
Overview
ZipFiles
UnzipFiles
AddFileToZip
AddFolderToZip
RemoveFileFromZip
ListFilesInZip
UnzipFile
Mathematical routines
Overview
abs
acos
asin
atan
CalculateScaleFactor
cos
cosh
exp
IsNAN
log
log10
max
mod
pow
ScaleArray
sin
sinh
sqrt
tan
tanh
Charts
Overview
CreateGauge
CreatePieChart
CreateBarChart
CreateLineChart
CreateXYLineChart
Database Interface
Overview
DBOpen
DBClose
DBExecuteSQL
DBSelect
DBInsertSelect
DBGetSQLStatus
DBGetSQLErrorString
CompactAccessDB
GetDataSources
CreateDataSource
RemoveDataSource
DBSetLoginTimeout
DBSetQueryTimeout
Using in-memory cache
Overview
AddCacheEntry
RemoveCacheEntry
RemoveAllCacheEntries
GetCacheEntriesCount
CacheLookup
FindEntryInCache
CacheLoad
CacheSave
CacheToString
Round Robin Databases
Overview
RrdCreate
RrdUpdate
RrdRemove
RrdFetch
RrdGetCurrentValue
Event Log functions
Overview
EventLogGetNumberOfRecords
EventLogGetOldestRecord
EventLogReadRecord
EventLogWaitForEvent
EventLogWriteRecord
Service Control Manager
Overview
SCMEnumerateServices
SCMGetServiceInfo
SCMStartService
SCMStopService
Parameter Files
Overview
GetParameterCount
GetParameterName
GetParameterType
GetParameterValue
GetParameterDisplayName
GetParameterDescription
GetParameterEnumValues
GetParameterEnumValue
GetEnumValueNameFromInt
Process management functions
Overview
ExecuteCommand
RunCommand
FindProcess
GetProcesses
RedirectOpen
RedirectClose
RedirectGetStdOut
RedirectGetStdError
RedirectSendInput
GetProcessorUsage
GetMemoryUsage
WMI functions
Overview
WMIOpen
WMIClose
WMIQuery
WMIGetErrorStatus
Short Message Peer-to-Peer (SMPP)
Overview
SmppOpen
SmppClose
SmppSubmitMessage
SmppEnquireLink
SmppGetLastError
Query functions
Overview
LDAPQuery
REGQuery
CSVQuery
TSVQuery
EventLogQuery
TextLineQuery
TextWordQuery
FSQuery
GetQueryStatus
GetQueryErrorString
Microsoft Outlook integration
Overview
OpenOutlookSession
CloseOutlookSession
OutlookSendMail
OutlookSendMeetingRequest
OutlookCreateTask
Ports IO
Overview
ReadPort
WritePort
IBM WebSphere Message Queue (MQ) functions
Overview
WMQConnect
WMQDisconnect
WMQOpenQueue
WMQCloseQueue
WMQPutMessage
WMQGetMessages
WMQGetManagerStatus
WMQGetQueueStatus
WMQSetOptions
Other routines
Overview
Println
MessageBox
ToString
ToInteger
ToDouble
ToChar
ToByte
ToXml
LogMessage
GetLastSystemError
GetSystemErrorString
GetEnvironmentStrings
GetEnv
SetEnv
IsVariableExist
IsArrayElementExist
GetArraySize
GetArrayIndex
PreallocateArrayHashTable
Sort
IsBitSet
SetBit
ClearBit
ToggleBit
Beep
GetNetDecisionSystemDir
PlaySound
TextToSpeech
Rand
SeedRand
GenerateUID
RGB
Logon
Reboot

NetDecision Script Language Reference

Prev Page Next Page

RrdCreate

int RrdCreate ( string filename, int step, array datasources, array archives )

int RrdCreate ( string filename, int step, int startTime, array datasources, array archives )

Return Value

OK if RRD file has been created successfully with given parameters; otherwise FAIL. 

Parameters

filename string variable that specifies the full path to the RRD file you want to create.

step integer variable that specifies the base interval in seconds with which data will be fed into the RRD.

startTime integer variable that specifies the time in seconds since 1970-01-01 UTC when the first value should be added to the RRD. Optional parameter. Default value is Now-10s.

datasources two-dimensional array variable that defines basic properties of each data source you want to store in the RRD. Data source properties must be specified in the array using the following structure:

array[0][DsName] - the name you will use to reference data source 0 in the RRD.
array[0][DsType] - string that defines the data source 0 type. GAUGE, COUNTER, DERIVE, and ABSOLUTE types are supported. See remarks section for data source types definitions.
array[0][HeartBeat] - integer variable that defines the maximum number of seconds that may pass between two updates of data source 0 before the value of the data source is assumed to be *UNKNOWN*.
array[0][MinValue] - double variable that defines the expected min value for data supplied by the data source 0. 
array[0][MaxValue] - double variable that defines the expected max value for data supplied by the data source 0.
array[1][DsName] - the name of data source 1.
array[1][DsType] - the type of data source 1.
...

archives two-dimensional array variable that defines how to store data in the round robin archives (RRA). An archive consists of a number of data values or statistics for each of the defined data sources. All archives, specified in this array will be created for each data source specified in datasources array. Archive properties must be specified in the array using the following structure:

array[0][ConsolFun] - string that defines the consolidation function (CF) of the archive 0. There are several consolidation functions that consolidate primary data points via an aggregate function: AVERAGE, MIN, MAX, LAST.
array[0][Xff] - double variable representing the xfiles factor that defines what part of a consolidation interval may be made up from *UNKNOWN* data while the consolidated value is still regarded as known. It is given as the ratio of allowed *UNKNOWN* primary data points to the number of primary data points in the interval. Thus, it ranges from 0 to 1 (exclusive).
array[0][Steps] - integer variable that defines how many of primary data points are used to build a consolidated data point which then goes into the archive.
array[0][Rows] - integer variable that defines how many generations of data values are kept in an round robin archive..
array[1][ConsolFun] - consolidation function (CF) of the archive 1.
array[1][Xff] - Xff of the archive 1.
...

Remarks

Call this function to set up a new Round Robin Database (RRD) file. A single RRD can accept input from several data sources (DS), for example incoming and outgoing traffic on a specific communication line. The following types of data source are supported:

  • GAUGE is for things like temperatures or number of people in a room or the value of a RedHat share.
  • COUNTER is for continuous incrementing counters like the ifInOctets counter in a router. The COUNTER data source assumes that the counter never decreases, except when a counter overflows. The update function takes the overflow into account. The counter is stored as a per-second rate. When the counter overflows, RRD checks if the overflow happened at the 32bit or 64bit border and acts accordingly by adding an appropriate value to the result.
  • DERIVE will store the derivative of the line going from the last to the current value of the data source. This can be useful for gauges, for example, to measure the rate of people entering or leaving a room. Internally, derive works exactly like COUNTER but without overflow checks. So if your counter does not reset at 32 or 64 bit you might want to use DERIVE and combine it with a MIN value of 0.
  • ABSOLUTE is for counters which get reset upon reading. This is used for fast counters which tend to overflow. So instead of reading them normally you reset them after every read to make sure you have a maximum time available before the next overflow. Another usage is for things you count like number of messages since the last update.

Package

Plug-in module: nd_rrdplg.npl

Example

The following example demonstrates the use of RrdCreate.

array Datasource1
Datasource1["DsName"] = "sun"
Datasource1["DsType"] = "GAUGE"
Datasource1["HeartBeat"] = 600
Datasource1["MinValue"] = 0.0
Datasource1["MaxValue"] = 100000.0
 
array Datasources
Datasources[0] = Datasource1
 
array Archive1
Archive1["ConsolFun"] = "MAX"
Archive1["Xff"] = 0.5
Archive1["Steps"] = 1
Archive1["Rows"] = 600
 
array Archives
Archives[0] = Archive1
 
int nStart = 1103760000
if (RrdCreate(GetNetDecisionSystemDir(ND_RRD_DIR) + "test.rrd", 300, nStart - 1, Datasources, Archives) == FAIL)
  Println("Failed to create RRD")
endif

 

 

 
  

   
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)