A.1
Operations Interpreter Functions
The command line functions are accessed via the OI Command Prompt. To read more about the
interpreter, see 4.3 - OI API.A.1.1 Standard and Arithmetic Operators
The following standard mathematical
operations can be used in expressions:
( ) + - *
/ % . 0 1 2 3 4 5
6 7 8 9
These operators work as any standard infix
operators work. For instance, the following expression:
(5+3)/10*100%5-3^10
evaluates to -9.
Additionally the comma ,
operator is used to separate multiple arguments to be evaluated and the quote "
operator is used to declare specific strings as in the following example:
"John" + " "
+ "Smith"
Evaluates to the string "John
Smith".
A.1.2 Mathematics Functions
The AutoNOC OSP Command Prompt includes
full support for the majority of mathematical functions in standard use. A list of these
is shown below:
sin(x) cos(x) tan(x) asin(x)
acos(x) atan(x) sinh(x) cosh(x) tanh(x) exp(x)
log(x) log10(x) sqrt(x) floor(x) ceil(x)
abs(x) hypot(x,y) deg(x) rad(x) pow(x,y)
These functions evaluate according to
their standard rules and AutoNOC makes use of the reference C++ standard library
implementations of these functions. If you need a more detailed description of how they
work, see any C++ reference manual.
A.1.3 Bitwise Operators
AutoNOC also implements the complete set of
bitwise C++ operators including the following operators:
<< >> & | ^
These operators, like bitwise shift left
( 128<<1 evaluates to 256 ) and bitwise & ( 16 | 256 evaluates to 272 ) can be
useful for extracting information out of incoming data that may be bitwise encoded.
A.1.4 Logic
The interpreter implements a robust set of
expression logic operators including the following operators:
<> <
> <= >= != = ! || &&
NOT OR AND
These operators work in the standard
manner. For instance <> is greater or less than. The ! operator is
the same as NOT, the || operator is the same as OR, and the AND
operator is the same as &&.
Additionally, AutoNOC provides some more
sophisticated logic functions as described below.
| Function |
|
if(Condition,Then,Else) |
| Parameters |
|
| Condition |
If this evaluates to a
non-zero value (when cast to an integer) than this expression will return the parameter
provided for Then. If the condition is zero (0), then the parameter provided for Else
will be returned. |
| Then |
Parameter returned when Condition
is non-zero. |
| Else |
Parameter returned when Condition
is zero. |
|
| Return Value |
|
Returns either the Then
paramemter (when Condition is non-zero) or the Else parameter (when Condition
is zero). |
| Description |
|
Performs a logical operation on the
parameters to selectively choose one value over another. |
| Example(s) |
|
if(1<3,4,5) Returns
4
if(1==3,4,5) Returns 5 |
A.1.5 Acquisition Functions
Acquisition functions go out and query data
over the network. AutoNOC supports a variety of acquisition functions that are utilized by
the software in a variety of ways.
|
|
|
| Function |
|
Agent_List(IP, AgentPW
{, Keyword}) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| AgentPW |
The password currently
enabled for the AutoNOC agent. |
| Keyword |
Optional text to search
the agent probe list for. |
|
| Return Value |
|
Returns a carriage return delimited
list of all probes available on the remote agent. |
| Description |
|
This function queries a remote AutoNOC
agent and grabs the list of probes that the device and agent currently support querying
of. |
| Example(s) |
|
Agent_List(192.168.1.1,"public")
Agent_List(%IP,%AGENTPW) |
|
|
|
|
|
|
| Function |
|
Agent_GetPerfmon(IP, AgentPW,
Probe) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| AgentPW |
The password currently
enabled for the AutoNOC Agent. |
| Probe |
The name of the probe to
query. |
|
| Return Value |
|
Returns the value of the ocunter for
the probe, or ? if unable to query the value. |
| Description |
|
This function performs an AutoNOC Agent
query to query the remote agent for the specified probe (as provided by Agent_List). |
| Example(s) |
|
Agent_GetPerfmon(192.168.1.10,"public","\Memory\Available
Bytes")
Agent_GetPerfmon(%IP,%AGENTPW,"\SMTP Server("+String(%EMAILSERV)+")\Bytes
Sent Total" |
|
|
|
| Function |
|
ICMP_GetResponseTime(IP)
Alternative Syntax:
Ping(IP) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
|
| Return Value |
|
Returns either the amount of time in
milliseconds it takes for the device to respond or "X" indicating that the
device did not respond. |
| Description |
|
This function is virtually identical to
the normal ping command that most administrators are familiar with. |
| Example(s) |
|
ICMP_GetResponseTime(%IP)
ICMP_GetResponseTime(192.168.1.10) |
|
|
|
| Function |
|
SNMP_Get(IP, Community,
OID)
SNMP_Get(IP, Community, Version, OID) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
|
| Return Value |
|
Returns the value queried, or ? if
unable to query the value. |
| Description |
|
This function performs a normal SNMP
Get Next operation on the target client device. |
| Example(s) |
|
SNMP_Get(192.168.1.1,public,".1.3.6.1.4.1.311.1.7.3.1.7")
SNMP_Get(%IP,%COMMUNITY,".1.3.6.1.4.1.311.1.7.3.1.7") |
|
|
|
| Function |
|
SNMP_GetRowCount(IP, Community,
OID)
SNMP_GetRowCount(IP, Community, Version, OID) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
|
| Return Value |
|
Returns the number of rows returned by
SNMP walking the device on the specified OID or "?" if it received a
failed response. |
| Description |
|
This function performs an SNMP walk on
the target device and counts the number of rows. It is useful for computing counts of
entries, such as the number of cable modems active on a given CMTS transmission. |
| Example(s) |
|
SNMP_GetRowCount(192.168.1.1,public,".1.3.6.1.4.1.311")
SNMP_GetRowCount(%IP,%COMMUNITY,".1.3.6.1.4.1.311") |
|
|
|
| Function |
|
SNMP_GetByOIDIndex(IP,
Community, OID, Index)
SNMP_GetByOIDIndex(IP, Community, OID, Version,
Index) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
| Index |
The object ID index to
grab. |
|
| Return Value |
|
Returns the value queried, or ? if
unable to query the value. |
| Description |
|
This function performs a normal SNMP
Walk operation on the target client device and returns the value that has an object ID
index of Index. This function is useful when looking up specific values in tables
with indexes. |
| Example(s) |
|
SNMP_GetByOIDIndex(
%IP,%COMMUNITY,
".1.3.6.1.2.1.10.127.1.1.4.1.5",
%IFINDEX) |
|
|
|
| Function |
|
SNMP_GetByIndex(IP, Community,
OID, Row)
SNMP_GetByIndex(IP, Community, OID, Version, Row) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
| Row |
Row number to retrieve. |
|
| Return Value |
|
Walks the object ID and returns the
value stored at row number Row or "?" if the walk has too few rows. |
| Description |
|
This function performs a normal SNMP
Walk operation on the target client device and then returns Row-th value
beginning with zero. |
| Example(s) |
|
SNMP_GetByIndex(
%IP,%COMMUNITY,
".1.3.6.1.2.1.25.3.3.1.2",
%SNMPROW) |
|
|
|
| Function |
|
SNMP_GetByRowMatch(
IP, Community, OID,
LookupOID1, Value1,
LookupOID2, Value2,
...
LookupOIDN, ValueN)
SNMP_GetByRowMatch(
IP, Community, OID, Version,
LookupOID1, Value1,
LookupOID2, Value2,
...
LookupOIDN, ValueN) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
| LookupOID? |
The same table
corresponding OID to try to match. |
| Value? |
The value to match the
lookup OID with. |
|
| Return Value |
|
Returns the matching value
queried, or ? if unable to find the value. |
| Description |
|
This function provides a
sophisticated table searching capability that can dynamically adapt to tables. It will
first walk OID, and then walk LookupOID1. It will search the lookup OID
for Value1 and if it finds it, it will return the corresponding row in OID. If it
doesn't find it, it proceeds to the next lookup OID and pair to try to find a match. |
| Example(s) |
|
SNMP_GetByRowMatch(
%IP,%COMMUNITY,
".1.3.6.1.2.1.2.2.1.10",
".1.3.6.1.2.1.2.2.1.2",
%SNMPNAME,
".1.3.6.1.2.1.2.2.1.1",
%IFINDEX) |
|
|
|
| Function |
|
SNMP_HasItem(IP,
Community, OID, Item)
SNMP_HasItem(IP, Community, OID, Version, Item) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
| Item |
Value to find in response
set. |
|
| Return Value |
|
Returns TRUE (1) or FALSE
(0) depending on the text of the item queried is available. |
| Description |
|
This function performs an
SNMP walk on the provided object-ID and searches the result to see if it contains Item.
If it does, then the function returns TRUE and if not it returns FALSE. |
| Example(s) |
|
SNMP_HasItem(%IP,%COMMUNITY,
".1.3.6.1.4.1.77.1.2.3.1.1",%SERVICE) |
|
|
|
| Function |
|
SNMP_Walk(IP,
Community, OID)
SNMP_Walk(IP, Community, Version, OID) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID to query on the device. |
|
| Return Value |
|
Object-IDs, descriptions,
and values returned from the query in the following form:
.1.3.6.1.4.1.77.1.2.3.1.1.6.83.101.114.118.101.114:
.iso.org.dod.internet.private.enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcName.6.83.101.114.118.101.114
="Server" |
| Description |
|
This function performs an
SNMP walk on the provided object-ID and returns all of the results in a "\r\n"
delimited string. |
| Example(s) |
|
SNMP_Walk(%IP,%COMMUNITY,".1.3.6.1.4.1.77.1.2.3.1.1") |
|
|
|
| Function |
|
SNMP_GetTable(IP,
Community, OID)
SNMP_GetTable(IP, Community, Version, OID) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Community |
SNMP read community string
to use. |
| Version |
SNMP Version, can be
"1", "2", "2c", "3". |
| OID |
Absolute (numerical) SNMP
Object ID for the table to query on the device. |
|
| Return Value |
|
Returns an integrated table with
columns deliminated by tabs (\t) and rows delimited by carriage returns (\r\n). The
resultint table is suitable for parsing and breaking information down into composite parts
using other functions. |
| Description |
|
This function performs an
SNMP walk and then creates a delimited table that can be used to extract different parts
of the table. |
| Example(s) |
|
SNMP_GetTable(192.168.1.10,anocpublic,.1.3.6.1.2.1.25.2.3)
2 iso.3.6.1.2.1.25.2.1.2 Real Memory 1024 1036980 839548
3 iso.3.6.1.2.1.25.2.1.3 Swap Space 1024 1060272 0
4 iso.3.6.1.2.1.25.2.1.4 / 4096 18969143 5824243
5 iso.3.6.1.2.1.25.2.1.4 /sys 4096 0 0
6 iso.3.6.1.2.1.25.2.1.4 /backup 4096 19230104 6863612 |
|
|
|
| Function |
|
Mkdir(Name) |
| Parameters |
|
| Name |
Name of the folder to
create. |
|
| Return Value |
|
Returns a 1 (TRUE) if successful in
creating the folder and a 0 (FALSE) if unsuccessful. |
| Description |
|
This function creates a new
folder of named Name as a child of the current object if allowed. |
| Example(s) |
|
cd("/Devices")
MkDir("Lancaster") |
|
|
|
| Function |
|
SOCK_IsListening(IP,
Port) |
| Parameters |
|
| IP |
IP Address for the client
to be queried. |
| Port |
Port number to connect to. |
|
| Return Value |
|
Returns either the amountof
time in milliseconds it takes for the socket port to respond or an "X"
indicating that the device did not respond. |
| Description |
|
This function performs a
TCP/IP socket connect to the specified port to determine if it is listening. |
| Example(s) |
|
SOCK_IsListening(%IP,5190)
SOCK_IsListening(192.168.1.1,5190) |
|
|
|
| Function |
|
HTTP_GetErrorCode(URL)
HTTP_GetErrorCode(URL, Port) |
| Parameters |
|
| URL |
The URL for AutoNOC to
query. |
| Port |
The port number to connect
to. |
|
| Return Value |
|
The error code as specified
by the HTTP return header from the query. Additionally, it supports several additional
AutoNOC provided error codes including:
| 100000 |
Malformed HTTP URL
request. |
| 100001 |
Bad server name specified. |
| 100004 |
Could not connect to port. |
| 100005 |
Send failed. |
| 100006 |
Receive error. |
| 100007 |
Binary Size mistmatch. |
| 100008 |
Request timed out. |
|
| Description |
|
This function uses HTTP to
query a URL page and return the error code, either the web server response provided code,
or an AutoNOC specified code as listed above.. |
| Example(s) |
|
HTTP_GetErrorCode("http://www.autonoc.com")
200
HTTP_GetErrorCode("http://192.168.1.44",70)
10004 |
|
|
|
| Function |
|
HTTP_Query(URL)
HTTP_Query(URL, Port) |
| Parameters |
|
| URL |
The URL for AutoNOC to
Query. |
| Port |
Port number to connect to. |
|
| Return Value |
|
The data from the web page
or object that is a result of this query. |
| Description |
|
Resolves and queries the
specified URL, requests the information, transfers the information, and returns it as a
string to the interpreter. Note that this function can be used to see if web pages have
changed (in case of a hacker). |
| Example(s) |
|
Length(HTTP_Query("http://www.autonoc.com"))
4392 |
|
|
|
| Function |
|
HTTP_GetResponseTime(URL)
HTTP_GetResponseTime(URL, Port) |
| Parameters |
|
| URL |
The URL for AutoNOC to
Query. |
| Port |
Port number to connect to. |
|
| Return Value |
|
Returns the amount of time,
in milliseconds, that it took to query and receive the requested URL or 'X' indicating the
request failed. |
| Description |
|
This function uses the HTTP
protocol to request and receive an object using HTTP. It times how long the request takes
and whether or not the request worked. AutoNOC marks any request that does not return a
"200 - OK" response as a failed request in the case of this function. |
| Example(s) |
|
HTTP_GetResponseTime("http://www.autonoc.com") |
A.1.6 Intermediate Look Up Functions
| Function |
|
Previous(Index) |
| Parameters |
|
| Index |
IP Address for the client
to be queried. |
|
| Return Value |
|
Returns the previous value for the
function in this expression with Index or "?" if no previous value is
available. |
| Description |
|
If you have two SNMP_Get calls in an
expression and the index is 0, then the previous value of the first SNMP_Get call will be
returned. If the index was 1, then the previous value for the second SNMP_Get call will be
returned. This function
makes handling SNMP counters easy by allowing an expression to refer only to the amount of
difference between the current value and the previous value. If the function returns a
counter and there is an overflow, then AutoNOC will adjust for the overflow. |
| Example(s) |
|
Previous(0) |
| |
|
|
| Function |
|
Elapsed(Index) |
| Parameters |
|
| Index |
IP Address for the client
to be queried. |
|
| Return Value |
|
Returns the time in seconds since the
last acquisition for the function with Index. |
| Description |
|
Looks up the time in seconds since the
last acquisition for the function with Index. If you have two SNMP_Get calls in an expression
and the index is 0, then the time since the last acquistion for the first SNMP_Get call
will be returned. If the index was 1, then the time since the last acquisition for the
second SNMP_Get call will be returned.
This function makes it easy to handle
expressions that need to know how much time has elapsed since the prior acquisition. This
is useful when trying to determine rates of flow, such as when analyzing SNMP and other
counters. |
| Example(s) |
|
Elapsed(0) |
A.1.7 Data Processing and Parsing
| Function |
|
Length(Value) |
| Parameters |
|
| Value |
Input string or number to
be analyzed. |
|
| Return Value |
|
Returns the number of characters in the
input string. |
| Description |
|
Examines the input string and returns
the number of characters it contains. |
| Example(s) |
|
Length("Boston")
Evaluates to 6. |
| |
|
|
| Function |
|
String(Value) |
| Parameters |
|
| Value |
Input string or number to
be processed. |
|
| Return Value |
|
Returns the provided Value
with it's internal type idenfitier set to String. |
| Description |
|
This function is commonly used to cast
a number to a string in certain cases, such as in concatenating values into a string with
the + operator. |
| Example(s) |
|
String(55)+String(55)
Evaluates to "5555" |
| |
|
|
| Function |
|
Number(Value) |
| Parameters |
|
| Value |
Input string or number to
be processed. |
|
| Return Value |
|
Returns the provided Value
with it's internal type identifier set to Number. |
| Description |
|
This function is commonly used to cast
a string to a number in certain cases, such as when adding values arithmetically. |
| Example(s) |
|
Number(55)+Number(55)
Evaluates to "110". |
| |
|
|
| Function |
|
Grep(Expression,String)
Grep(Expression,String,Delimiter) |
| Parameters |
|
| Expression |
The specified input string
to be scanned. |
| String |
The string to find within
the text. |
| Delimieter |
The string to find within
the text. |
|
| Return Value |
|
When processing the regular Expression,
if it finds values in String then it will either return TRUE (1) or FALSE (0)
based on the results, or, if a delimiter is provided, it will return each individual
record containing the results. |
| Description |
|
Processes the regular Expression
using String as an input and returns either a boolean value if the string
contains the expression, or the current entire record if it is delimited. |
| Example(s) |
|
Grep("c[a-z]at","czatskills")
Evaluates to TRUE (1)Grep("J[o,e]","John,Jerry,Julius,Gary,Larry",",")
Evaluates to "John,Jerry"
Grep("\w",%OBJNAME)
(When used in a set).
Finds all Objects with Names Containing White Space |
| |
|
|
| Function |
|
Contains(String,Find) |
| Parameters |
|
| String |
The specified input string
to be scanned. |
| Find |
The string to find within
the text. |
|
| Return Value |
|
TRUE (1) or FALSE (0) if String
contains the text Find. |
| Description |
|
Scans String for the text Find
and returns TRUE if the text is in the string and FALSE if it is not. |
| Example(s) |
|
Contains("Boston New
York","New")
Evaluates to TRUE (1) |
| |
|
|
| Function |
|
Strip(String,Characters) |
| Parameters |
|
| String |
String to analyze. |
| Characters |
Characters to remove from
the string. |
|
| Return Value |
|
Returns String with the Characters
removed. |
| Description |
|
This function scans String and
creates a new string that does not have any of the characters contained in the string Characters. |
| Example(s) |
|
Strip("A-B-C","A-")
Evaluates to "BC" |
| |
|
|
| Function |
|
Get(Index,String,Delimiter) |
| Parameters |
|
| Index |
The index of the string to
get. |
| String |
The source string to
extract a sub-string from. |
| Delimiters |
The delimiter to use to
separate the original strings in the string. |
|
| Return Value |
|
Returns the sub-string as broken down
into records bounded by Delimiters. |
| Description |
|
This function is designed to extract
specific sub-strings out of delimited strings. It first breaks the string down into
individual strings as bounded by Delimiters and the returns the string with the
zero-based Index. |
| Example(s) |
|
Get(2,"A;B;C;D",";")
Evaluates to "C" |
| |
|
|
| Function |
|
Replace(String,Find,Replace) |
| Parameters |
|
| String |
Text to scan and analyze. |
| Find |
Text to search String
for. |
| Replace |
Text to replace every
occurrence of the string Find with. |
|
| Return Value |
|
Returns the new string with the
replaced text. |
| Description |
|
This function scans the text in String
for the string Find and replaces every instance of it with the text Replace. |
| Example(s) |
|
Replace("The lazy brown dog walked down the
street.","own","iwn")
Evaluates to "The lazy briwn dog walked diwn the street." |
| |
|
|
| Function |
|
Find(String,Find) |
| Parameters |
|
| String |
Text to scan and analyze. |
| Find |
Text to find in String. |
|
| Return Value |
|
Returns the zero-based index to the
first character of the text Find in the string. |
| Description |
|
Scans the provided String for
the text Find and then returns the index of the location for the text. |
| Example(s) |
|
Find("A22;B;C;D","B")
Evaluates to "4" |
| |
|
|
| Function |
|
Sort(Ascending,String,Delimiter) |
| Parameters |
|
| Ascending |
TRUE (1) or FALSE (0)
indicating whether sorting should be ascending or descending. |
| String |
String containing records
to sort. |
| Delimiter |
Delimiter that separates
each record for sorting order. |
|
| Return Value |
|
Returns a new reconstituted string
containing String sorted as separated by the delimiters. |
| Description |
|
This function takes String,
breaks it down into separate strings as bounded by the Delimiter, sorts the
strings in either ascending or descending order depending on if Ascending is
true, and the reconsitutes a new, sorted string list. |
| Example(s) |
|
Sort(TRUE,"john,
jerry,steve,larry",",")
Evaluates to "jerry,john,larry,steve" |
| |
|
|
| Function |
|
Count(String)
Count(String,Delimiter) |
| Parameters |
|
| String |
String containing records
to sort. |
| Delimiter |
Delimiter that separates
each record. |
|
| Return Value |
|
Returns an integer indicating the
number of elements in the provided string. |
| Description |
|
This function takes String,
breaks it down into separate strings as bounded by the Delimiter, counts them,
and returns the count. If no delimiter is specified, then it will return the number of
characters in the string. |
| Example(s) |
|
Count("john,
jerry,steve,larry",",")
Evaluates to "4" |
| |
|
|
| Function |
|
Delete(Index) |
| Parameters |
|
| Index |
Specify the index of the
record in the string to remove. |
| String |
IP Address for the client
to be queried. |
| Delimiter |
IP Address for the client
to be queried. |
|
| Return Value |
|
Returns a new reconstituted string with
the delimited record at zero-based Index removed. |
| Description |
|
This function scans String,
breaks it down into specific records bounded by Delimiter, removes the zero-based
record at Index and then creates a newly reconstituted string. |
| Example(s) |
|
Delete(2,"john,jerry,steve,larry",",")
Evaluates to "john,jerry,larry" |
A.1.7 Data Processing and Parsing
| Function |
|
Length(Value) |
| Parameters |
|
| Value |
Input string or number to
be analyzed. |
|
| Return Value |
|
Returns the number of characters in the
input string. |
| Description |
|
Examines the input string and returns
the number of characters it contains. |
| |