| 1 |
root |
1.1 |
=head1 DESCRIPTION |
| 2 |
|
|
|
| 3 |
|
|
This document describes the porttracker API for third-party programs to |
| 4 |
|
|
use (it is also used internally to communicate with the tawnyd). |
| 5 |
|
|
|
| 6 |
|
|
=head1 CONVENTIONS |
| 7 |
|
|
|
| 8 |
|
|
In this document, command names, paths and similar entities are F<formatted like this>. |
| 9 |
|
|
|
| 10 |
|
|
Preformatted sections are indented like this. This is used for verbatim |
| 11 |
|
|
text. Portions of the section that need to be replaced by dynamic |
| 12 |
|
|
content are enclosed in <angle brackets>. |
| 13 |
|
|
|
| 14 |
|
|
< Lines starting with "< " are received from the server. |
| 15 |
|
|
> Lines starting with "> " are sent to the server. # and this is a comment |
| 16 |
|
|
|
| 17 |
|
|
Both text refering to these variable sections and verbatim text inside |
| 18 |
|
|
other paragraphs is formatted C<like this>. |
| 19 |
|
|
|
| 20 |
|
|
=head1 OVERVIEW |
| 21 |
|
|
|
| 22 |
|
|
=head2 SOCKET LAYER |
| 23 |
|
|
|
| 24 |
root |
1.5 |
The API uses a TCP connection to port 55 on the porttracker management |
| 25 |
root |
1.1 |
machine. The TCP connection must be 8-bit-clean (as UTF-8 is used as |
| 26 |
|
|
character encoding) and can be driven either in binary or text mode. |
| 27 |
|
|
|
| 28 |
|
|
Alternatively, the server also listens on the Unix socket |
| 29 |
|
|
F</tmp/.tawny/.tawnyd> for local connections (where "none" is one of the |
| 30 |
|
|
guaranteed auth methods). |
| 31 |
|
|
|
| 32 |
root |
1.2 |
There are currently no timeouts for the connection itself, but TCP |
| 33 |
|
|
keepalive might be enabled server-side. |
| 34 |
|
|
|
| 35 |
root |
1.1 |
=head2 PACKAGE ENCAPSULATION LAYER |
| 36 |
|
|
|
| 37 |
|
|
The protocol is based on sending and receiving JSON arrays encoded as |
| 38 |
|
|
UTF-8. The server expects JSON arrays to be sent back-to-back, without any |
| 39 |
|
|
separators, but for testing purposes it is often convenient to end JSON |
| 40 |
|
|
arrays with ASCII LF (or ASCII CR LF) characters ("newline"), effectively |
| 41 |
|
|
treating it as a line-based protocol. |
| 42 |
|
|
|
| 43 |
|
|
To support programming languages without incremental JSON parsers, |
| 44 |
|
|
the server will append an ASCII LF character to each JSON array and |
| 45 |
|
|
additionally will make sure that its replies will never contain any ASCII |
| 46 |
|
|
LF characters, so instead of directly parsing the JSON stream, the client |
| 47 |
|
|
may also read single lines and then decode the JSON array contained in |
| 48 |
|
|
each line. |
| 49 |
|
|
|
| 50 |
|
|
Note 1: This means that one can use C<telnet> or a similar program to test |
| 51 |
|
|
the protocol, as the server ignores ASCII CR and LF characters but sends |
| 52 |
|
|
its responses as single lines. |
| 53 |
|
|
|
| 54 |
|
|
Note 2: There are two principal parsing strategies: the obvious one is to |
| 55 |
|
|
read a single (potentially very large) line and then decode it, and the |
| 56 |
|
|
less obvious one is to use a streaming parser and simply read JSON arrays |
| 57 |
|
|
one after each other. |
| 58 |
|
|
|
| 59 |
|
|
=head2 MESSAGE LAYER |
| 60 |
|
|
|
| 61 |
|
|
Server and client can send messages to each other at any time (usually the |
| 62 |
|
|
client first has to wait and parse the initial server greeting, though, to |
| 63 |
|
|
see what kind of authentication is required). |
| 64 |
|
|
|
| 65 |
|
|
All messages are JSON arrays in one of the following formats: |
| 66 |
|
|
|
| 67 |
|
|
[<id>, <type>, <args...>] # client request |
| 68 |
|
|
[<id>, <status>, <args...>] # server response |
| 69 |
|
|
[null, <type>, <args...>] # server notification |
| 70 |
|
|
|
| 71 |
|
|
The first member, C<id>, identifies the request/response pair: Each |
| 72 |
|
|
request the client sends has to use a unique ID not currently in use |
| 73 |
|
|
by any request that is still ongoing. Any string or number can be |
| 74 |
|
|
used for the C<id> value. The C<type> member is a string indicating |
| 75 |
|
|
the type of request to the server. The remaining members (if any) are |
| 76 |
|
|
request-specific. |
| 77 |
|
|
|
| 78 |
|
|
Each server response to a request will use the same C<id> value as the |
| 79 |
|
|
request. The second member, C<status>, is either C<0> for failure, |
| 80 |
|
|
followed by an error message and optionally more information, or C<1> for |
| 81 |
|
|
success and request-specific return values. |
| 82 |
|
|
|
| 83 |
|
|
The protocol supports pipelining (sending multiple requests without |
| 84 |
|
|
processing any replies) and responses to a request can come in any |
| 85 |
|
|
order. Most requests will be handled in parallel, only some (like the |
| 86 |
|
|
login messages) are guaranteed to get processed in order. |
| 87 |
|
|
|
| 88 |
|
|
If the first member is the JSON C<null> value, then the message is a |
| 89 |
|
|
server notification and the C<type> member identified the notification |
| 90 |
|
|
type. This mechanism is used for the initial server greeting and any fatal |
| 91 |
|
|
errors (such as wrongly formatted client requests). |
| 92 |
|
|
|
| 93 |
|
|
Note: The type model used for JSON is "soft", that is, numbers might |
| 94 |
|
|
sometimes be returned as strings, and vice versa. The only values in the |
| 95 |
|
|
protocol where you can be sure of the type are the C<id> and status return |
| 96 |
|
|
values, for other values you have to be liberal in what you accept. |
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
=head1 SESSION STRUCTURE |
| 100 |
|
|
|
| 101 |
|
|
When connecting, the server sends a server greeting notification |
| 102 |
|
|
("hello"), informing the client of the protocol version, whether |
| 103 |
|
|
authentication is required and which kind of authentication is supported. |
| 104 |
|
|
|
| 105 |
|
|
If the server indicated that authentication is required, the client will |
| 106 |
|
|
then have to send login requests until it successfully authenticated. |
| 107 |
|
|
|
| 108 |
|
|
After that, the server will continue serving client requests. |
| 109 |
|
|
|
| 110 |
|
|
To end a session, the client just should simply drop the connection. |
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
=head1 EXAMPLE SESSION |
| 114 |
|
|
|
| 115 |
|
|
< [null,"hello",1,["login"]] |
| 116 |
|
|
Server sent the initial greeting and requests the |
| 117 |
|
|
use of a login request for authentication. |
| 118 |
|
|
|
| 119 |
|
|
> ["someid", "realm_poll", 5100005442] |
| 120 |
|
|
< ["someid",0,"you need to authenticate first"] |
| 121 |
|
|
Most requests are only valid once logged-in. |
| 122 |
|
|
|
| 123 |
|
|
> [100, "login", "username", "password"] |
| 124 |
|
|
< [100,1] |
| 125 |
|
|
The client sent a login request with credentials, |
| 126 |
|
|
and the server accepted them. |
| 127 |
|
|
|
| 128 |
|
|
> ["someid", "realm_poll", 5100005442] |
| 129 |
|
|
Starts a poll, which takes a long time. |
| 130 |
|
|
|
| 131 |
|
|
> [3, "ping"] |
| 132 |
|
|
< [3,1,1202674637.64799,17372] |
| 133 |
|
|
Ping simply returns a timestamp and the daemon pid as fast as possible. |
| 134 |
|
|
|
| 135 |
|
|
> ["someid",1,{"port_updates":"2","device_seens":"88","device_inserts":"9","switch_updates":"3","port_seens":"73"}] |
| 136 |
|
|
The result of the poll, with some statistical data. |
| 137 |
|
|
|
| 138 |
|
|
|
| 139 |
|
|
=head1 MESSAGE TYPES |
| 140 |
|
|
|
| 141 |
|
|
Messages might contain more than the documented number of array |
| 142 |
|
|
members. If that is the case, the application must simply ignore them. |
| 143 |
|
|
|
| 144 |
|
|
=head2 NOTIFICATIONS |
| 145 |
|
|
|
| 146 |
|
|
=over 4 |
| 147 |
|
|
|
| 148 |
|
|
=item "hello" - initial server greeting |
| 149 |
|
|
|
| 150 |
|
|
< [null, "hello", <version>, [<auth-types...>], <nonce>] |
| 151 |
|
|
|
| 152 |
|
|
The server usually sends this notification after the initial connect and |
| 153 |
|
|
never thereafter. The C<version> argument specified the protocol version |
| 154 |
|
|
(always C<1>), the C<auth-types> argument is an array of authentication |
| 155 |
|
|
types that the server accepts (there can be more than one). The nonce can |
| 156 |
|
|
be used to securely authenticate, and is base64-encoded. |
| 157 |
|
|
|
| 158 |
|
|
Before a client is authenticated, all other requests will fail. |
| 159 |
|
|
|
| 160 |
|
|
The defined authentication types are: |
| 161 |
|
|
|
| 162 |
|
|
=over 4 |
| 163 |
|
|
|
| 164 |
|
|
=item "none" |
| 165 |
|
|
|
| 166 |
|
|
No additional authentication is required, the client can simply |
| 167 |
|
|
start sending other requests. This is available when the server |
| 168 |
|
|
detects a "secure" connection, e.g. from the local host, or when other |
| 169 |
|
|
authentication methods are used, such as an SSL certificate or IP-based |
| 170 |
|
|
authentication. |
| 171 |
|
|
|
| 172 |
|
|
=item "login" |
| 173 |
|
|
|
| 174 |
|
|
The client may use password authentication by sending a login request |
| 175 |
|
|
(described later). |
| 176 |
|
|
|
| 177 |
|
|
=item "login_cram_md6" |
| 178 |
|
|
|
| 179 |
|
|
The client may use a challenge response mechanism based on MD6 to authenticate. |
| 180 |
|
|
|
| 181 |
|
|
=back |
| 182 |
|
|
|
| 183 |
|
|
=item "info" - an informational message |
| 184 |
|
|
|
| 185 |
|
|
< [null, "info", <informational-message>] |
| 186 |
|
|
|
| 187 |
|
|
The server sends an informational message. These can be ignored by the |
| 188 |
|
|
client, or logged, depending on taste. |
| 189 |
|
|
|
| 190 |
|
|
=item "error" - a fatal error has occured |
| 191 |
|
|
|
| 192 |
|
|
< [null, "error", <error-message>] |
| 193 |
|
|
|
| 194 |
|
|
A fatal error has occurred. This should be logged, and the connection |
| 195 |
|
|
should probably be closed if the cause cannot be identified, as this |
| 196 |
|
|
signifies fatal events such as a non-decodable request or runtime errors |
| 197 |
|
|
in the server. |
| 198 |
|
|
|
| 199 |
|
|
=item "start_tls" - TLS negotiation starts |
| 200 |
|
|
|
| 201 |
|
|
< [null, "start_tls"] |
| 202 |
|
|
|
| 203 |
|
|
This notice is sent when the server wants to start TLS/SSL negotiation, |
| 204 |
|
|
either because the server requires TLS to proceed, or because the client |
| 205 |
|
|
requested it via a C<start_tls> request. |
| 206 |
|
|
|
| 207 |
|
|
TLS negotiation will start directly after the final ASCII LF ending the |
| 208 |
|
|
notice. The protocol will continue as normal after the TLS handshake. |
| 209 |
|
|
|
| 210 |
root |
1.3 |
=item "event" - subscribed system event |
| 211 |
|
|
|
| 212 |
|
|
< [null, "event", <type>, <args...>] |
| 213 |
|
|
|
| 214 |
|
|
This notice is sent each time an event occurs that the session is |
| 215 |
|
|
subscribed to (see C<subscribe> and C<unsubscribe> commands). |
| 216 |
|
|
|
| 217 |
|
|
Currently known events are: |
| 218 |
|
|
|
| 219 |
|
|
=over 4 |
| 220 |
|
|
|
| 221 |
|
|
=item realm_discover_start realm-gid |
| 222 |
|
|
|
| 223 |
|
|
Called with the GID of the realm that has just started a discovery process. |
| 224 |
|
|
|
| 225 |
|
|
=item realm_discover_stop realm-gid |
| 226 |
|
|
|
| 227 |
|
|
Called with the GID of the realm that has just finished a discovery process. |
| 228 |
|
|
|
| 229 |
|
|
=item realm_poll_start realm-gid |
| 230 |
|
|
|
| 231 |
|
|
Called with the GID of the realm that has just started a poll process. |
| 232 |
|
|
|
| 233 |
|
|
=item realm_poll_stop realm-gid |
| 234 |
|
|
|
| 235 |
|
|
Called with the GID of the realm that has just finished a poll process. |
| 236 |
|
|
|
| 237 |
|
|
=back |
| 238 |
|
|
|
| 239 |
root |
1.1 |
=back |
| 240 |
|
|
|
| 241 |
|
|
|
| 242 |
|
|
=head2 REQUESTS AND RESPONSES |
| 243 |
|
|
|
| 244 |
|
|
=over 4 |
| 245 |
|
|
|
| 246 |
|
|
=item "login" - username/password-based authentication |
| 247 |
|
|
|
| 248 |
|
|
> [<id>, "login", <username>, <password>] |
| 249 |
|
|
< [<id>, 1] |
| 250 |
|
|
|
| 251 |
|
|
Tries to log-in with the given username and password. The username |
| 252 |
|
|
and password must belong to a valid admin user configured in the user |
| 253 |
|
|
interface. |
| 254 |
|
|
|
| 255 |
|
|
=item "login_cram_md6" - secure username/password-based authentication |
| 256 |
|
|
|
| 257 |
|
|
> [<id>, "login_cram_md6", <username>, <cr>, <cc>] |
| 258 |
|
|
< [<id>, 1, <sr>] |
| 259 |
|
|
|
| 260 |
|
|
Tries to securely login with a username and password. First, a shared key |
| 261 |
|
|
is calculated, by using (all MD6 invocations are with blocksize 64 and |
| 262 |
|
|
hashsize 256): |
| 263 |
|
|
|
| 264 |
|
|
key = hmac_md6 (password, username) # as defined by RFC 2104 |
| 265 |
|
|
|
| 266 |
|
|
Then, the client generates a a nonce of any length (empty nonces are ok), |
| 267 |
|
|
called C<cc>. Then it calculates C<cr> using the C<key>, C<cc> and the |
| 268 |
|
|
server C<nonce> as follows ("+" means concatenation): |
| 269 |
|
|
|
| 270 |
|
|
cr = hmac_md6 (key, cc + nonce) |
| 271 |
|
|
|
| 272 |
|
|
Then it sends both C<cr> and C<cc> in the login request, base64-encoded. |
| 273 |
|
|
|
| 274 |
|
|
If authentication is successful, the server responds with a base64-encoded |
| 275 |
|
|
C<sr>: |
| 276 |
|
|
|
| 277 |
|
|
sr = hmac_md6 (key, nonce + cc) |
| 278 |
|
|
|
| 279 |
|
|
If the client used a non-empty C<cc>, then it can use the C<sr> value to |
| 280 |
|
|
shield against man-in-the-middle attacks by comparing it with its own |
| 281 |
|
|
calculation. |
| 282 |
|
|
|
| 283 |
|
|
Test vectors: |
| 284 |
|
|
|
| 285 |
|
|
nonce/base64 = YWVlYWJkZjQzMWEzYWM2 |
| 286 |
|
|
username/text = user |
| 287 |
|
|
password/text = pass |
| 288 |
|
|
key/base64 = C1JQ4jnjsrBzJtTZXt8Po+wA/iXtaM5r4BIIjl0lfMA |
| 289 |
|
|
cc/base64 = ZmZiOTczMjE= |
| 290 |
|
|
cr/base64 = 5UJKUqehqBKwXiSk6RzYjsPWqivMJcEgE2crTLVyw04 |
| 291 |
|
|
sr/base64 = gGKEpOuv5WuuQ7ZbwDWNIdyJtAnCimVN/faM5qWtOZM |
| 292 |
|
|
|
| 293 |
|
|
=item "ping" - ping the server, return some informational data |
| 294 |
|
|
|
| 295 |
|
|
> [<id>, "ping"] |
| 296 |
|
|
< [<id>, 1, <timestamp>, <server-pid>] |
| 297 |
|
|
|
| 298 |
|
|
=item "start_tls" - request SSL/TLS handshake |
| 299 |
|
|
|
| 300 |
|
|
> [<id>, "start_tls"] |
| 301 |
|
|
< [null, "start_tls"] |
| 302 |
|
|
<--tls negotiation--> |
| 303 |
|
|
< [<id>, 1] |
| 304 |
|
|
|
| 305 |
|
|
This request request TLS negotiation. If accepted, the server replies |
| 306 |
|
|
first with a C<start_tls> notification, followed by the TLS handshake, |
| 307 |
|
|
followed by the request reply. If TLS is rejected, then there will be no |
| 308 |
|
|
notification and no handshake, just the reply. |
| 309 |
|
|
|
| 310 |
|
|
|
| 311 |
|
|
The client must not send anything after sending this request until |
| 312 |
|
|
the server sends a C<start_tls> notification (i.e. nothing must be |
| 313 |
|
|
written after the closing C<]> until either a reply or a notification is |
| 314 |
|
|
received). |
| 315 |
|
|
|
| 316 |
|
|
The handshake must be started immediately after the final ASCII LF that |
| 317 |
|
|
ends the notification reply. |
| 318 |
|
|
|
| 319 |
|
|
Note that it is quite possible to receive other responses and |
| 320 |
|
|
notifications before the TLS notification is received. |
| 321 |
|
|
|
| 322 |
|
|
=item "product_id" - return the product id |
| 323 |
|
|
|
| 324 |
|
|
> [<id>, "product_id"] |
| 325 |
root |
1.2 |
< [<id>, 1, <branding>, <product-id>] |
| 326 |
root |
1.1 |
|
| 327 |
|
|
Example: |
| 328 |
|
|
|
| 329 |
|
|
> [1,"product_id"] |
| 330 |
|
|
< [1,1,"n","00:1d:60:e8:6e:36"] |
| 331 |
|
|
|
| 332 |
root |
1.2 |
Returns the branding (e.g. "n" for Porttracker, "i" for PortIQ) and |
| 333 |
|
|
product ID for licencing purposes. |
| 334 |
root |
1.1 |
|
| 335 |
root |
1.3 |
=item "subscribe" - subscribe to system events |
| 336 |
|
|
|
| 337 |
|
|
> [<id>, "subscribe", <events...>] |
| 338 |
|
|
< [<id>, <status>] |
| 339 |
|
|
|
| 340 |
|
|
Tries to subscribe to the specified events (see the C<event> notification |
| 341 |
|
|
earlier in this document for a list of supported events). As a special |
| 342 |
|
|
case, the event named C<*> matches all events. |
| 343 |
|
|
|
| 344 |
|
|
=item "unsubscribe" - unsubscribe from system events |
| 345 |
|
|
|
| 346 |
|
|
> [<id>, "unsubscribe", <events...>] |
| 347 |
|
|
< [<id>, <status>] |
| 348 |
|
|
|
| 349 |
|
|
Unsubscribes from the specified events - no further events of the |
| 350 |
|
|
specified types will be received by this session. |
| 351 |
|
|
|
| 352 |
|
|
=item "log" - log a message |
| 353 |
|
|
|
| 354 |
|
|
> [<id>, "log", <message>, <priority>] |
| 355 |
|
|
< [<id>, <status>] |
| 356 |
|
|
|
| 357 |
|
|
Logs the given message as if tawnyd had logged it. The C<priority> is a |
| 358 |
|
|
standard syslog priority, ranging from C<0> (C<emerg>) to 7 (C<debug>). IF |
| 359 |
|
|
it is missing, then the message will be logged with priority C<info>. |
| 360 |
|
|
|
| 361 |
root |
1.1 |
=item "set_license" - configure a new licence |
| 362 |
|
|
|
| 363 |
root |
1.2 |
> [<id>, "set_license", <license-string>] |
| 364 |
root |
1.1 |
< [<id>, <status>] |
| 365 |
|
|
|
| 366 |
|
|
Configures the given licence string as new licence for the box. Returns |
| 367 |
|
|
successful if the licence is valid, fails otherwise. |
| 368 |
|
|
|
| 369 |
|
|
Setting the license requires admin privileges. |
| 370 |
|
|
|
| 371 |
|
|
=item "realm_info" - information about realms |
| 372 |
|
|
|
| 373 |
|
|
> [<id>, "realm_info", [<fields...>], [<realms...>]] |
| 374 |
|
|
< [<id>, 1, [ [<fields...>]... ]] |
| 375 |
|
|
|
| 376 |
|
|
Example: |
| 377 |
|
|
|
| 378 |
|
|
> [1,"realm_info",["gid","description","polling","name","seeds"]] |
| 379 |
|
|
< [1,1,["5000015442","","0","Realm Name","192.168.33.19"]] |
| 380 |
|
|
|
| 381 |
|
|
> [1, "realm_info", ["gid", "discovery_result", "poll_result", "sync_result"]] |
| 382 |
|
|
< [1,1,["64424509927",{"infrastructure":13},{"poll":{"infrastructure":13, |
| 383 |
|
|
"ports":"339","end":"79"}},{"sync":{"qsync":null,"bsync":"Success"}}]] |
| 384 |
|
|
|
| 385 |
|
|
Requests information about the given realms (or all realms if specified as |
| 386 |
|
|
C<null>). The following fields can be requested, and their contents will be |
| 387 |
|
|
returned in the order specified in the C<fields> array: |
| 388 |
|
|
|
| 389 |
|
|
=over 4 |
| 390 |
|
|
|
| 391 |
|
|
=item gid - the gid (id value) identifying the realm |
| 392 |
|
|
|
| 393 |
|
|
=item name - the user-specified name of the realm |
| 394 |
|
|
|
| 395 |
|
|
=item description - the user-specified description for this realm |
| 396 |
|
|
|
| 397 |
|
|
=item last_discover - timestamp of last discover run |
| 398 |
|
|
|
| 399 |
|
|
=item last_poll - timestamp of last poll run |
| 400 |
|
|
|
| 401 |
|
|
=item last_sync - timestamp of last sync run |
| 402 |
|
|
|
| 403 |
|
|
=item polling - 0 (not polling) or 1 (currently polling) |
| 404 |
|
|
|
| 405 |
|
|
=item syncing - 0 (not syncing) or 1 (currently syncing) |
| 406 |
|
|
|
| 407 |
|
|
=item seeds - the seed list (whitespace-separated list of seed devices) |
| 408 |
|
|
|
| 409 |
|
|
=item pollers - a list of poller-gids of pollers attached to the realm |
| 410 |
|
|
|
| 411 |
root |
1.5 |
=item discovery_result - a hash with key as infrastructure and value as number of devices discovered |
| 412 |
root |
1.1 |
|
| 413 |
|
|
=item poll_result - a hash with keys infrastructure, ports and end and values as their counts |
| 414 |
|
|
|
| 415 |
|
|
=item sync_result - a hash with keys qsync and bsync and values as their results |
| 416 |
|
|
|
| 417 |
|
|
=item ageing_interval - ping sweep interval for this realm. |
| 418 |
|
|
|
| 419 |
|
|
=back |
| 420 |
|
|
|
| 421 |
|
|
=item "realm_info_modify" - edits the given realm |
| 422 |
|
|
|
| 423 |
|
|
> [<id>, "realm_info_modify", <realm-gid>, {<prop>:<value>,...}] |
| 424 |
|
|
< [<id>, 1] |
| 425 |
|
|
|
| 426 |
|
|
A property hash followed by a realm gid. Keys of the hash are name, |
| 427 |
|
|
description, discovery_poller and ageing_interval. |
| 428 |
|
|
|
| 429 |
|
|
Example: |
| 430 |
|
|
|
| 431 |
|
|
> [1, "realm_info_modify", "38952865423", {"name":"default-1"}] |
| 432 |
|
|
< [1, 1] |
| 433 |
|
|
|
| 434 |
|
|
=item "realm_modify" - adds and/or deletes realms |
| 435 |
|
|
|
| 436 |
|
|
> [<id>, "realm_modify", [delete-ids...], [[add-realm],...]] |
| 437 |
|
|
< [<id>, 1] |
| 438 |
|
|
|
| 439 |
|
|
Two arrays expected as input. First array is a list of realm gids needs to be deleted. |
| 440 |
|
|
Second array is a list of realm needs to be added. An array per realm can contain |
| 441 |
|
|
realm name and description. |
| 442 |
|
|
|
| 443 |
|
|
Example: |
| 444 |
|
|
|
| 445 |
|
|
> [1, "realm_modify", ["38456782341"], [["Test Realm", "for test"]]] |
| 446 |
|
|
< [1, 1] |
| 447 |
|
|
|
| 448 |
|
|
=item "realm_discover" - run discovery on a given realm |
| 449 |
|
|
|
| 450 |
|
|
> [<id>, "realm_discover", <realm-gid>] |
| 451 |
|
|
< [<id>, 1] |
| 452 |
|
|
|
| 453 |
|
|
=item "realm_poll" - run a poll on a given realm |
| 454 |
|
|
|
| 455 |
|
|
> [<id>, "realm_poll", <realm-gid>] |
| 456 |
|
|
< [<id>, 1, { <statistical data> } ] |
| 457 |
|
|
|
| 458 |
|
|
=item "switch_poll" - run a poll on a given realm and switch ip |
| 459 |
|
|
|
| 460 |
|
|
> [<id>, "switch_poll", <realm-gid>, <switch ip>] |
| 461 |
|
|
< [<id>, 1, { <statistical data> } ] |
| 462 |
|
|
|
| 463 |
|
|
=item "realm_sync" - run a sync on a given realm and plugin |
| 464 |
|
|
|
| 465 |
|
|
> [<id>, "realm_sync", <realm-gid>, <sync module>] |
| 466 |
|
|
< [<id>, 1] |
| 467 |
|
|
|
| 468 |
|
|
The C<sync module> can be either bsync or qsync. |
| 469 |
|
|
|
| 470 |
|
|
=item "realm_query" - query the database |
| 471 |
|
|
|
| 472 |
|
|
This request executes a database query with filtering, much like the |
| 473 |
|
|
device and switch views work in the user interface. |
| 474 |
|
|
|
| 475 |
|
|
> [<id>, "realm_query", <realm-gid>, <type> |
| 476 |
|
|
[<column-name>...], [<raw-column-name]>...], |
| 477 |
|
|
{<column-name> : <filter-expression>...}, |
| 478 |
root |
1.5 |
<history-mask>, |
| 479 |
|
|
<port-unused-period>, |
| 480 |
|
|
<first-row>, <row-count>, |
| 481 |
|
|
<time-limit>, |
| 482 |
root |
1.1 |
] |
| 483 |
|
|
< [<id>, 1, [ [<result-data>]... ]] |
| 484 |
|
|
|
| 485 |
|
|
The C<realm-gid> is the GID of the realm to query, as returned by |
| 486 |
|
|
C<real_info>. The C<type> is the string C<device>, C<switch> or |
| 487 |
|
|
C<switch_detail>, which corresponds to the device view, switch view or |
| 488 |
|
|
switch detail view. |
| 489 |
|
|
|
| 490 |
|
|
The first array of C<column-name>s specifies which columns should be |
| 491 |
|
|
returned. The second array of C<raw-column-name>s works likewise, but |
| 492 |
|
|
the values returned will be the "raw" (possibly octet-encoded) database |
| 493 |
|
|
contents. Specifying the same column name in both array causes undefined |
| 494 |
|
|
behaviour. |
| 495 |
|
|
|
| 496 |
|
|
The hash of C<column-name> => C<filter-expression> pairs specifies |
| 497 |
|
|
additional filters. The syntax for the C<filter-expression> is the same as |
| 498 |
|
|
the ones used by the GUI. |
| 499 |
|
|
|
| 500 |
root |
1.5 |
The C<history-mask> is the history selection option. Value C<0> |
| 501 |
|
|
means C<current>, value C<1> means C<All> and value C<2> means |
| 502 |
|
|
C<All+Changes>. Default value is C<0>. |
| 503 |
|
|
|
| 504 |
|
|
The C<port-unused-period> is the the port unused period in seconds, or |
| 505 |
|
|
C<0>, meaning no port unused period is used. |
| 506 |
|
|
|
| 507 |
|
|
C<first-row> and C<row-count> specify how many rows to skip (C<first-row>) |
| 508 |
|
|
and how many rows of data to return at most (C<row-count>). If |
| 509 |
|
|
C<row-count> is zero, then all rows will be returned. |
| 510 |
|
|
|
| 511 |
|
|
C<time-limit> is the time limit put on the query, in seconds. The default |
| 512 |
|
|
is C<30>. Long-running queries can keep the database from applying |
| 513 |
|
|
updates, causing discoveries or polls to be skipped. |
| 514 |
root |
1.1 |
|
| 515 |
|
|
The reply contains an array of result rows. Each row consists of data |
| 516 |
|
|
values using the same ordering as in the requested column-name arrays, raw |
| 517 |
|
|
columns last. |
| 518 |
|
|
|
| 519 |
|
|
The (JSON) type of each column depends on the column itself, and can vary |
| 520 |
root |
1.5 |
between rows (e.g. one row might use a number format, another a string |
| 521 |
|
|
format). |
| 522 |
root |
1.1 |
|
| 523 |
|
|
=over 4 |
| 524 |
|
|
|
| 525 |
root |
1.5 |
=item valid columns for "device" query: |
| 526 |
root |
1.1 |
|
| 527 |
root |
1.5 |
vlanname, port_pktcount, linkduplex, port_mac, device_log_end, |
| 528 |
|
|
port_errorcount, vtpdomain, switch_ip, device_log_start, |
| 529 |
|
|
linkstatus, linkspeed, device_mac, history_device, linkadminduplex, |
| 530 |
|
|
ifname, device_comment, device_notes, vlannames, vlanset, device_dnsname, |
| 531 |
|
|
ifalias, switch_uid, ifdescr, linkadminstatus, |
| 532 |
|
|
port_error_percentage, device_ipset. |
| 533 |
|
|
|
| 534 |
|
|
=item valid columns for "switch" query: |
| 535 |
|
|
|
| 536 |
|
|
number_ports, switch_action, switch_syslocation, |
| 537 |
|
|
free_ports_percentage, switch_sysservices, switch_dnsname, |
| 538 |
|
|
history_switch, switch_log_end, switch_pollduration, switch_model, |
| 539 |
|
|
available_ports_percentage, switch_comment, ports_lastchange, |
| 540 |
|
|
switch_ip, switch_sysdescr, switch_notes, available_ports, |
| 541 |
|
|
poe_ports, switch_log_start, switch_uid, switch, free_ports. |
| 542 |
|
|
|
| 543 |
|
|
=item valid columns for "switch_detail" query: |
| 544 |
|
|
|
| 545 |
|
|
port_pktcount, history_port, linkduplex, port_mac, port_comment, |
| 546 |
|
|
port_log_start, port_errorcount, port_log_end, detected_devices_current, |
| 547 |
|
|
linkstatus, linkspeed, linkadminduplex, ifname, port_action, poe_power, |
| 548 |
|
|
ifalias, switch_uid, poe_status, switch, ifdescr, linkadminstatus, |
| 549 |
|
|
port_error_percentage. |
| 550 |
root |
1.1 |
|
| 551 |
|
|
=back |
| 552 |
|
|
|
| 553 |
root |
1.5 |
Example queries: |
| 554 |
root |
1.1 |
|
| 555 |
|
|
> [1, "realm_query", "5100005442", "device", |
| 556 |
root |
1.5 |
["switch_uid", "device_ipset"], |
| 557 |
root |
1.1 |
["device_mac"], |
| 558 |
|
|
{ "switch_uid" : "switch03%" }] |
| 559 |
root |
1.5 |
< [1,1,[["switch03.ibm.de","192.168.40.11 (1)","\u00000B\u0006D^"],... |
| 560 |
root |
1.1 |
|
| 561 |
|
|
> [5, "realm_query", "5100005442", "switch_detail", |
| 562 |
|
|
["ifname"], [], |
| 563 |
|
|
{ "switch" : 27 }] |
| 564 |
|
|
< [5,1,[["Fa0/11"],["Fa0/21"], ... ,["Fa0/5"]]] |
| 565 |
|
|
|
| 566 |
root |
1.4 |
=item "report_info" - returns the available report list |
| 567 |
|
|
|
| 568 |
|
|
This request returns the report list for the logged-in user. |
| 569 |
|
|
|
| 570 |
|
|
> [<id>, "report_info"] |
| 571 |
|
|
< [<id>, 1, [ [<gid>, <name>], ...]] |
| 572 |
|
|
|
| 573 |
root |
1.5 |
The reply will contains an array for each report. Each array will have gid |
| 574 |
root |
1.4 |
and name of the report. |
| 575 |
|
|
|
| 576 |
|
|
Example: |
| 577 |
|
|
|
| 578 |
|
|
> [1, "report_info"] |
| 579 |
|
|
< [1,1,[["3865500631171148","New Report 1"]]] |
| 580 |
|
|
|
| 581 |
root |
1.1 |
=item "user_view_info" - return the available views list |
| 582 |
|
|
|
| 583 |
|
|
This request returns the report views list for the logged-in user. |
| 584 |
|
|
|
| 585 |
|
|
> [<id>, "user_view_info", [<field-list>], [<type-list>]] |
| 586 |
|
|
< [<id>, 1, [ [<fields>, ...], ...]] |
| 587 |
|
|
|
| 588 |
|
|
Valid fields are C<name> and C<gid> and valid types are C<switch>, |
| 589 |
|
|
C<port> and C<device>. The reply will contains an array for each view. |
| 590 |
|
|
|
| 591 |
|
|
Example: |
| 592 |
|
|
|
| 593 |
|
|
> [1, "user_view_info", ["gid", "name"]] |
| 594 |
|
|
< [1,1,[["107374182462","Ports:Default"], |
| 595 |
|
|
["94489280669","Ports:Multiple Devices on Port"], |
| 596 |
|
|
["107374182460","End Devices:Default"], |
| 597 |
|
|
["3865500631171226","End Devices:test"], |
| 598 |
|
|
["3865500631171236","End Devices:tns04"]]] |
| 599 |
|
|
|
| 600 |
|
|
=item "realm_view" - query database with given view in a given realm |
| 601 |
|
|
|
| 602 |
|
|
This request returns the database entries for the given view and the realm. |
| 603 |
|
|
|
| 604 |
|
|
> [<id>, "realm_view", <realm-gid>, <view-gid>] |
| 605 |
|
|
< [<id>, 1,[ [<result-data>]]] |
| 606 |
|
|
|
| 607 |
|
|
Valid view gid should be given followed by a valid realm gid. |
| 608 |
root |
1.5 |
The reply will contain the results from database query and one array per |
| 609 |
root |
1.1 |
database row. |
| 610 |
|
|
|
| 611 |
|
|
Example: |
| 612 |
|
|
|
| 613 |
|
|
> [1, "realm_view", "64424509927", "107374182461"] |
| 614 |
|
|
< [1,1,[["tnsw04.uk.internal","S","26","15","15","58","0","2009-12-08 12:17:00", |
| 615 |
|
|
"2009-12-08 12:17:00",null],["tnsw05.uk.internal","S","26","20","20" |
| 616 |
|
|
,"77","0","2009-12-08 12:17:00","2009-12-08 12:17:00",null]]] |
| 617 |
|
|
|
| 618 |
root |
1.5 |
=item "realm_seed_list" - return the seed list |
| 619 |
root |
1.1 |
|
| 620 |
|
|
This request returns the seed list for the given realm. |
| 621 |
|
|
|
| 622 |
|
|
> [<id>, "realm_seed_list", <realm-gid>] |
| 623 |
|
|
< [<id>, 1, [ [<ip>, <flags>]... ]] |
| 624 |
|
|
|
| 625 |
|
|
The reply contains an array with all configured seed devices. Each device |
| 626 |
|
|
is represented by an array with the IP address in textual form and a flags |
| 627 |
|
|
bitset. The only defined bit value (not number) is C<2>, which indicates a |
| 628 |
|
|
manually-added seed entry. |
| 629 |
|
|
|
| 630 |
|
|
Example: |
| 631 |
|
|
|
| 632 |
|
|
> [1, "realm_seed_list", "5100005442"] |
| 633 |
|
|
< [1,1,[["192.168.40.11",0],["192.168.40.1",2]]] |
| 634 |
|
|
|
| 635 |
root |
1.5 |
=item "realm_seed_list_modify" - add/remove seed list entries |
| 636 |
root |
1.1 |
|
| 637 |
|
|
This request modifies the seed list for a realm. |
| 638 |
|
|
|
| 639 |
|
|
> [<id>, "realm_seed_list_modify", <realm-gid>, [<delete-ip>...], [<add-ip>...>]] |
| 640 |
|
|
< [<id>, 1] |
| 641 |
|
|
|
| 642 |
|
|
The two arrays after the realm-gid specify the IP addresses (in textual |
| 643 |
|
|
form) of seed entries to remove, followed by a list of IP addresses to be |
| 644 |
|
|
added afterwards. Newly added IP addresses will have the manual flag set on them. |
| 645 |
|
|
|
| 646 |
|
|
Example: set the manually-added flag on 10.0.0.5, or add it if it didn't |
| 647 |
|
|
exist yet. |
| 648 |
|
|
|
| 649 |
|
|
> [1, "realm_seed_list_modify", "5100005442", ["10.0.0.5"], ["10.0.0.5"]] |
| 650 |
|
|
< [1,1] |
| 651 |
|
|
|
| 652 |
|
|
=item "realm_snmp_credential_list" - list snmp credentials |
| 653 |
|
|
|
| 654 |
|
|
This request returns the snmp credentials for the given realm. |
| 655 |
|
|
|
| 656 |
|
|
> [<id>, "realm_snmp_credential_list", <realm-gid>] |
| 657 |
|
|
< [<id>, 1, [ [<subnet>, <bits>, [ 2, [<community>...], [3, <v3 settings>] ], <flags>]... ]] |
| 658 |
|
|
|
| 659 |
|
|
The reply contains an array with all configured snmp credentials, one per |
| 660 |
|
|
subnet. Each snmp credential will contain the subnet address in textual |
| 661 |
|
|
form, the leading number of significant bits in the subnet (0..32 for |
| 662 |
|
|
IPv4, 0..128 for IPv6), an array per snmp v2 and v3 settings and a flags bitset |
| 663 |
|
|
(bit value C<1> means it is an include, otherwise it is an exclude). |
| 664 |
|
|
v2 array starts with bit value C<2> means it is version v2 and followed by an array |
| 665 |
|
|
of community strings. v3 array starts with bit value C<3> means it is version v3 and |
| 666 |
|
|
followed by v3 user name, authentication password, privacy password, authentication |
| 667 |
|
|
algorithm and privacy algorithm. |
| 668 |
|
|
|
| 669 |
|
|
Example: |
| 670 |
|
|
|
| 671 |
|
|
> [1, "realm_snmp_credential_list", "5100005442"] |
| 672 |
root |
1.4 |
< [1,1,[ ["10.1.0.0",16,[[2,["test"]], [3,"authPrivUser","authpass","privpass", null, "md5","aes"]],1] ]] |
| 673 |
root |
1.1 |
|
| 674 |
|
|
=item "realm_snmp_credential_list_modify" - modify snmp credentials |
| 675 |
|
|
|
| 676 |
|
|
Removes and/or adds snmp credential entries. |
| 677 |
|
|
|
| 678 |
|
|
> [<id>, "realm_snmp_credential_list_modify", <realm-gid>, [<remove-subnet>], [<add-subnet>...]] |
| 679 |
|
|
< [<id>, 1] |
| 680 |
|
|
|
| 681 |
|
|
The two arrays after the realm-gid specify a list of subnet addresses to |
| 682 |
|
|
remove (only exact matches wil be removed) and a list of subnet-entries to |
| 683 |
|
|
be added afterwards. Each entry in the <add-subnet> list follows the same |
| 684 |
|
|
format as returned by C<realm_snmp_credentials>. |
| 685 |
|
|
|
| 686 |
|
|
Example: |
| 687 |
|
|
> [1, "realm_snmp_credential_list_modify", "5100005442", [ ["10.0.0.0", 8], ["11.1.1.0", 24] ], |
| 688 |
root |
1.4 |
[ ["192.168.240.0", 24, [[2, ["w0rld", "peace"]], [3, "noAuthUser"]], 1] ]] |
| 689 |
root |
1.1 |
< [1, 1] |
| 690 |
|
|
|
| 691 |
root |
1.5 |
=item "realm_device_assignment_list" - list all assignable devices for a realm |
| 692 |
root |
1.1 |
|
| 693 |
|
|
This request returns all assignable devices. |
| 694 |
|
|
|
| 695 |
|
|
> [<id>, "realm_device_assignment", <realm-gid>] |
| 696 |
|
|
< [<id>, 1, [ [<ip>, <poller-gid>] ]] |
| 697 |
|
|
|
| 698 |
|
|
The reply contains an array with all assignable devices in a realm. Each |
| 699 |
|
|
device entry will contain the device IP address in textual form, and |
| 700 |
|
|
the gid of the poller it is assigned to, or C<null> if the device isn't |
| 701 |
|
|
currently assigned. |
| 702 |
|
|
|
| 703 |
|
|
Example: |
| 704 |
|
|
|
| 705 |
|
|
> [1, "realm_device_assignment_list", "64424509927"] |
| 706 |
|
|
< [1,1,[ ["192.168.71.21",null],["192.168.75.2",null],["1.1.1.1",64424509930],["5.5.5.5",64424509930]] ] |
| 707 |
|
|
|
| 708 |
|
|
=item "realm_device_assign" - assign a device to a poller |
| 709 |
|
|
|
| 710 |
|
|
Assigns or unassigns a device, or all devices. |
| 711 |
|
|
|
| 712 |
|
|
> [<id>, "realm_device_assign", <realm-gid>] |
| 713 |
|
|
< [<id>, 1] |
| 714 |
|
|
|
| 715 |
|
|
> [<id>, "realm_device_assign", <realm-gid>, [<device-ip>, <poller-gid>]] |
| 716 |
|
|
< [<id>, 1] |
| 717 |
|
|
|
| 718 |
|
|
If only a realm-gid is specified and device and poller-gid are missing, |
| 719 |
|
|
then all devices get auto-assigned to pollers, if possible. |
| 720 |
|
|
|
| 721 |
|
|
Otherwise, the specified device will be assigned to the specified |
| 722 |
|
|
C<poller-gid>, or unassigned if C<poller-gid> is C<null>. |
| 723 |
|
|
|
| 724 |
root |
1.5 |
Example: |
| 725 |
root |
1.1 |
|
| 726 |
|
|
> [1, "realm_device_assign", "64424509927"] |
| 727 |
|
|
< [1, 1] |
| 728 |
|
|
|
| 729 |
|
|
> [1, "realm_device_assign", "64424509927", ["1.1.1.1", null]] |
| 730 |
|
|
< [1, 1] |
| 731 |
|
|
|
| 732 |
|
|
> [1, "realm_device_assign", "64424509927", ["1.1.1.1", "64424509930"]] |
| 733 |
|
|
< [1, 1] |
| 734 |
|
|
|
| 735 |
|
|
=item "realm_advanced_settings" - list advanced settings of a given realm |
| 736 |
|
|
|
| 737 |
|
|
This request returns all/specific properties and their values. |
| 738 |
|
|
|
| 739 |
|
|
> [<id>, "realm_advanced_settings", <realm-gid>, [<property>,...]] |
| 740 |
|
|
< [<id>, 1, [[<property>, <value>]...]] |
| 741 |
|
|
|
| 742 |
|
|
If only the realm-gid is specified then all the properties and their values returned. |
| 743 |
|
|
|
| 744 |
|
|
valid properties are |
| 745 |
|
|
|
| 746 |
root |
1.4 |
snmp_parallel_requests, snmp_retries, |
| 747 |
|
|
snmp_timeout, skip_access_points, |
| 748 |
|
|
smtp_user, autoassign, autoassign_manual, skip_cisco_phones, skip_mitel_phones, |
| 749 |
|
|
block_port_macs, stp_enabled, cdp_enabled, lldp_enabled, ndp_enabled, bdp_enabled, |
| 750 |
|
|
edp_enabled, fdp_enabled |
| 751 |
root |
1.1 |
|
| 752 |
|
|
Example: |
| 753 |
|
|
|
| 754 |
|
|
> [1, "realm_advanced_settings", "64424509927", ["cdp_enabled"]] |
| 755 |
|
|
< [1,1,[["cdp_enabled","1"]]] |
| 756 |
|
|
|
| 757 |
|
|
=item "realm_advanced_settings_modify" - modify advanced settings of a given realm |
| 758 |
|
|
|
| 759 |
|
|
This request modifies advanced settings of a given realm-gid. |
| 760 |
|
|
|
| 761 |
|
|
> [<id>, "realm_advanced_settings_modify", <realm-gid>, [[<property>, <value>]...]] |
| 762 |
|
|
< [<id>, 1] |
| 763 |
|
|
|
| 764 |
|
|
> [<id>, "realm_advanced_settings_modify", <realm-gid>, [[<property>, [<delete-list>], [<add-list>]]]] |
| 765 |
|
|
< [<id>, 1] |
| 766 |
|
|
|
| 767 |
root |
1.5 |
realm-gid followed by a array of property and value pairs. one array for each property |
| 768 |
root |
1.1 |
and value pair. |
| 769 |
|
|
|
| 770 |
root |
1.5 |
block_port_macs property expects two arrays in place of value. First array is a list of |
| 771 |
|
|
macs needs to be deleted from port exclusion list and second array is a list of |
| 772 |
|
|
macs needs to be added into port exclusion list. MAC addresses should be in the following |
| 773 |
root |
1.1 |
format "AA:BB:CC:DD:EE:FF". |
| 774 |
|
|
When no array given for block_port_macs property all the macs from port exclusion list |
| 775 |
|
|
will get deleted. |
| 776 |
|
|
|
| 777 |
|
|
Example: |
| 778 |
|
|
|
| 779 |
|
|
> [1, "realm_advanced_settings_modify", "64424509927", [["cdp_enabled", "0"]]] |
| 780 |
|
|
< [1, 1] |
| 781 |
|
|
|
| 782 |
root |
1.5 |
> [1, "realm_advanced_settings_modify", "64424509927", [["block_port_macs", |
| 783 |
root |
1.1 |
["11:00:0a:0b:11:22"], ["0a:11:22:44:0e:0b"]]]] |
| 784 |
|
|
< [1, 1] |
| 785 |
|
|
|
| 786 |
|
|
=item "poller_info" - - information about pollers |
| 787 |
|
|
|
| 788 |
|
|
> [<id>, "poller_info", [<fields...>], [<pollers...>]] |
| 789 |
|
|
< [<id>, 1, [ [<fields...>]... ]] |
| 790 |
|
|
|
| 791 |
|
|
Example: |
| 792 |
|
|
|
| 793 |
|
|
> [1, "poller_info", ["gid", "name", "description", "hostname"]] |
| 794 |
|
|
< [1,1,[["64424509930","localhost","localhost","127.0.0.1"]]] |
| 795 |
|
|
|
| 796 |
|
|
|
| 797 |
|
|
Requests information about the given pollers (or all pollers if specified as |
| 798 |
|
|
C<null>). The following fields can be requested, and their contents will be |
| 799 |
|
|
returned in the order specified in the C<fields> array: |
| 800 |
|
|
|
| 801 |
|
|
=over 4 |
| 802 |
|
|
|
| 803 |
|
|
=item gid - the gid (id value) identifying the poller |
| 804 |
|
|
|
| 805 |
|
|
=item name - the user-specified name of the poller |
| 806 |
|
|
|
| 807 |
|
|
=item description - the user-specified description for this poller |
| 808 |
|
|
|
| 809 |
|
|
=item hostname - hostname/ip of this poller |
| 810 |
|
|
|
| 811 |
|
|
=item dns_max_outstanding - maximum number of dns queries for this poller |
| 812 |
|
|
|
| 813 |
|
|
=back |
| 814 |
|
|
|
| 815 |
|
|
=item "poller_modify" - adds and/or deletes pollers |
| 816 |
|
|
|
| 817 |
|
|
This request adds and/or deletes given pollers. |
| 818 |
|
|
|
| 819 |
root |
1.5 |
> [<id>, "poller_modify", <realm-gid>, [<delete-gid>, ...], |
| 820 |
root |
1.1 |
[[<name>, <description>, <hostname>, <secret>], ...]] |
| 821 |
|
|
< [<id>, 1] |
| 822 |
|
|
|
| 823 |
root |
1.5 |
Two arrays followed by a realm gid. First array is a list of poller gids |
| 824 |
|
|
needs to be deleted. Second array is a list of pollers needs to be added. |
| 825 |
root |
1.1 |
An array per poller should contain poller name, description, hostname and |
| 826 |
|
|
secret password. |
| 827 |
|
|
|
| 828 |
|
|
Example: |
| 829 |
|
|
|
| 830 |
root |
1.5 |
> [1, "poller_modify", "385611201213", ["98456723211"], [["test1", |
| 831 |
root |
1.1 |
"Test poller", "127.0.0.1", "test"]]] |
| 832 |
|
|
< [1, 1] |
| 833 |
|
|
|
| 834 |
|
|
=item "poller_info_modify - edits the given poller |
| 835 |
|
|
|
| 836 |
|
|
This request edits the given poller with new values. |
| 837 |
|
|
|
| 838 |
|
|
> [<id>, "poller_info_modify", <poller-gid>, {<prop>:<value>,...}] |
| 839 |
|
|
< [<id>, 1] |
| 840 |
|
|
|
| 841 |
|
|
A property hash followed by a poller gid. Keys expected in the hash |
| 842 |
|
|
are name, description, hostname, secret and dns_max_outstanding. |
| 843 |
|
|
|
| 844 |
|
|
Example: |
| 845 |
|
|
|
| 846 |
|
|
> [1, "poller_info_modify", "6789345621", {"name":"test1", |
| 847 |
|
|
"secret":"test123", "hostname":"localhost", |
| 848 |
|
|
"dns_max_outstanding":"65"}] |
| 849 |
|
|
< [1, 1] |
| 850 |
|
|
|
| 851 |
|
|
=item "poller_subnet_list" - list subnets attached to a given poller |
| 852 |
|
|
|
| 853 |
|
|
This request returns all subnets attached to a given poller. |
| 854 |
|
|
|
| 855 |
|
|
> [<id>, "poller_subnet_list", <poller-gid>] |
| 856 |
|
|
< [<id>, 1, [ [<subnet>, <bits>, <ping-limit>, <flags>]... ]] |
| 857 |
|
|
|
| 858 |
|
|
The reply contains an array with all configured subnets. Each subnet |
| 859 |
|
|
will contain the subnet address in textual form, the leading number of |
| 860 |
|
|
significant bits in the subnet (0..32 for IPv4, 0..128 for IPv6), a ping |
| 861 |
|
|
limit (in kbit/s) and a flags value (bit value C<1> indicates whether the |
| 862 |
|
|
subnet is exclided (C<0>) or included (C<1>), bit value C<2> indicates |
| 863 |
|
|
whether pings are enabled (C<2>) or not). |
| 864 |
|
|
|
| 865 |
root |
1.5 |
Example: |
| 866 |
root |
1.1 |
|
| 867 |
|
|
> [1, "poller_subnet_list", "64424509930"] |
| 868 |
|
|
< [1,1,[["1.1.1.1",32,1000,1,2],["10.1.1.1",32,1000,0,0]]] |
| 869 |
|
|
|
| 870 |
root |
1.5 |
=item "poller_subnet_list_modify" - modify subnets of a poller |
| 871 |
root |
1.1 |
|
| 872 |
|
|
Removes and/or adds subnet entries. |
| 873 |
|
|
|
| 874 |
|
|
> [<id>, "poller_subnet_list_modify", <poller-gid>, [<remove-subnet>], [<add-subnet>...]] |
| 875 |
|
|
< [<id>, 1] |
| 876 |
|
|
|
| 877 |
|
|
The two arrays after the poller-gid specify a list of subnet addresses to |
| 878 |
|
|
remove (only exact matches wil be removed) and a list of subnet-entries to |
| 879 |
|
|
be added afterwards. Each entry in the <add-subnet> list follows the same |
| 880 |
|
|
format as returned by C<poller_subnet_list>. |
| 881 |
|
|
|
| 882 |
root |
1.5 |
Example: |
| 883 |
root |
1.1 |
|
| 884 |
|
|
> [ 1, "poller_subnet_list_modify", "64424509930",[["1.1.1.1",32,1000,1,2], |
| 885 |
|
|
["10.1.1.1",32,1000,0,0]], [["192.168.0.0", 16, 1200, 1,2]] ] |
| 886 |
|
|
< [1, 1] |
| 887 |
|
|
|
| 888 |
|
|
=item "global_settings" - list global settings |
| 889 |
|
|
|
| 890 |
|
|
This request returns all global settings or specific settings. |
| 891 |
|
|
|
| 892 |
|
|
> [<id>, "global_settings"] |
| 893 |
|
|
< [<id>, 1, [ [<property>, <value>]... ]] |
| 894 |
|
|
|
| 895 |
|
|
The reply contains an array with all configured properties and values. Each property |
| 896 |
|
|
and value will be in textual form. |
| 897 |
|
|
|
| 898 |
|
|
valid properties are |
| 899 |
|
|
|
| 900 |
root |
1.4 |
session_timeout, domain, smtp_server, max_history_length, |
| 901 |
|
|
smtp_user, max_log_length |
| 902 |
root |
1.1 |
|
| 903 |
|
|
Example: |
| 904 |
|
|
|
| 905 |
|
|
> [1, "global_settings"] |
| 906 |
root |
1.4 |
< [1,1,[["domain",""],["smtp_server",""], |
| 907 |
|
|
["max_history_length","0"],["smtp_user",""]]] |
| 908 |
root |
1.1 |
|
| 909 |
root |
1.4 |
> [1, "global_settings", ["session_timeout"]] |
| 910 |
|
|
< [1,1,[["session_timeout","86400"]]] |
| 911 |
root |
1.1 |
|
| 912 |
|
|
=item "global_settings_modify" - modify global settings |
| 913 |
|
|
|
| 914 |
|
|
This request modifies global settings. Each property modified with a new value given. |
| 915 |
|
|
|
| 916 |
|
|
> [<id>, "global_settings_modify", [ [<property>, <value>]... ]] |
| 917 |
|
|
< [<id>, 1] |
| 918 |
|
|
|
| 919 |
|
|
one array for each property and value pair. Properties and values should be in |
| 920 |
root |
1.5 |
textual format. |
| 921 |
root |
1.1 |
|
| 922 |
|
|
valid properties are |
| 923 |
|
|
|
| 924 |
root |
1.4 |
session_timeout, domain, smtp_server, max_history_length, |
| 925 |
|
|
smtp_user, max_log_length |
| 926 |
root |
1.1 |
|
| 927 |
|
|
Example: |
| 928 |
|
|
|
| 929 |
|
|
> [1, "global_settings_modify", [["snmp_parallel_requests", "15"]]] |
| 930 |
|
|
< [1, 1] |
| 931 |
|
|
|
| 932 |
|
|
=item "advanced_settings" - list advanced settings |
| 933 |
|
|
|
| 934 |
|
|
This request returns all advanced settings or specific settings. |
| 935 |
|
|
|
| 936 |
|
|
> [<id>, "advanced_settings"] |
| 937 |
|
|
< [<id>, 1, [ [<property>, <value>]... ]] |
| 938 |
|
|
|
| 939 |
|
|
The reply contains an array with all configured properties and values. Each property |
| 940 |
|
|
and value will be in textual form. |
| 941 |
|
|
|
| 942 |
|
|
valid properties are |
| 943 |
|
|
|
| 944 |
root |
1.4 |
normalization_algorithm, max_parallel_jobs, max_debug_scans, debug_level |
| 945 |
root |
1.1 |
|
| 946 |
|
|
Example: |
| 947 |
|
|
|
| 948 |
|
|
> [1, "advanced_settings", ["max_parallel_jobs"]] |
| 949 |
|
|
< [1,1,[["max_parallel_jobs","1000"]]] |
| 950 |
|
|
|
| 951 |
|
|
=item "advanced_settings_modify" - modify advanced settings |
| 952 |
|
|
|
| 953 |
|
|
This request modifies advanced settings. Each property modified with a new value given. |
| 954 |
|
|
|
| 955 |
|
|
> [<id>, "advanced_settings_modify", [ [<property>, <value>]...]] |
| 956 |
|
|
< [<id>, 1] |
| 957 |
|
|
|
| 958 |
|
|
one array for each property and value pair. Properties and values should be in |
| 959 |
root |
1.5 |
textual format. |
| 960 |
root |
1.1 |
|
| 961 |
|
|
Example: |
| 962 |
|
|
|
| 963 |
|
|
> [1, "advanced_settings_modify", [ ["max_parallel_jobs", "900"]]] |
| 964 |
|
|
< [1, 1] |
| 965 |
|
|
|
| 966 |
|
|
|
| 967 |
|
|
=item "security_misc_settings" - lists misellenous security settings |
| 968 |
|
|
|
| 969 |
|
|
This request returns all misellenous settings or specific settings. |
| 970 |
|
|
|
| 971 |
|
|
> [<id>, "security_misc_settings", [<property, ... ]] |
| 972 |
|
|
< [<id>, 1, [<value>, ...] ] |
| 973 |
|
|
|
| 974 |
|
|
valid properties are |
| 975 |
|
|
|
| 976 |
|
|
login_banner enable_login_banner |
| 977 |
|
|
|
| 978 |
|
|
Example: |
| 979 |
|
|
|
| 980 |
|
|
> [1, "security_misc_settings", ["login_banner"]] |
| 981 |
|
|
< [1,1,["This system is the property of ..."]] |
| 982 |
|
|
|
| 983 |
|
|
=item "security_misc_settings_modify" - modifies given misellenous property |
| 984 |
|
|
|
| 985 |
|
|
This request modifies given property with the given new value. |
| 986 |
|
|
|
| 987 |
|
|
> [<id>, "security_misc_settings_modify", {<property> : <value>, ... }] |
| 988 |
|
|
< [<id>, 1] |
| 989 |
|
|
|
| 990 |
|
|
Example: |
| 991 |
|
|
|
| 992 |
|
|
> [1, "security_misc_settings_modify", {"login_banner" : "Its My Box."}] |
| 993 |
|
|
< [1, 1] |
| 994 |
|
|
|
| 995 |
|
|
=item "security_certificate_list" - lists available certificates |
| 996 |
|
|
|
| 997 |
|
|
This request returns all or given properties of all certificates. |
| 998 |
|
|
|
| 999 |
|
|
> [<id>, "security_certificate_list", [<property>, ...] ] |
| 1000 |
|
|
< [<id>, 1, [ [<value>, ...] , ... ] ] |
| 1001 |
|
|
|
| 1002 |
|
|
Valid properties are |
| 1003 |
|
|
|
| 1004 |
|
|
name certificate |
| 1005 |
|
|
|
| 1006 |
|
|
Example: |
| 1007 |
|
|
|
| 1008 |
|
|
> [1, "security_certificate_list"] |
| 1009 |
|
|
< [1, 1, [["System Default",""],["custom", ,"-----BEGIN RSA PRIVATE KEY..."]]] |
| 1010 |
|
|
|
| 1011 |
|
|
=item "security_certificate_list_modify" - adds/deletes given certificates |
| 1012 |
|
|
|
| 1013 |
|
|
This request deletes and adds given certificates. |
| 1014 |
|
|
|
| 1015 |
|
|
> [<id>, "security_certificate_list_modify", [<delete-list>], [[<name>, <certificate>], ...]] |
| 1016 |
|
|
< [<id>, 1] |
| 1017 |
|
|
|
| 1018 |
|
|
delete-list contains list of certificate names. |
| 1019 |
root |
1.5 |
add-list should have a name and certificate one array per certificate. |
| 1020 |
root |
1.1 |
|
| 1021 |
|
|
Example: |
| 1022 |
|
|
|
| 1023 |
|
|
> [1, "security_certificate_list_modify", ["old_custom"], [["new_custom", "-----BEGIN RSA PRIVATE KEY..."] |
| 1024 |
|
|
]] |
| 1025 |
|
|
< [1, 1] |
| 1026 |
|
|
|
| 1027 |
|
|
=item "security_certificate_assignment_list" - lists all assignable certificates |
| 1028 |
|
|
|
| 1029 |
|
|
This request returns all certificate name and their current status. |
| 1030 |
|
|
one array per certicate will be used. current status shows whether it is assigned |
| 1031 |
|
|
to C<apache> or C<api> or C<null> for not in use. |
| 1032 |
|
|
|
| 1033 |
|
|
> [<id>, "security_certificate_assignment_list"] |
| 1034 |
|
|
< [<id>, 1, [ [<name>, <status>], ... ]] |
| 1035 |
|
|
|
| 1036 |
|
|
Example: |
| 1037 |
|
|
|
| 1038 |
|
|
> [1, "security_certificate_assignment_list"] |
| 1039 |
|
|
> [1,1,[["System Default","apache"],["System Default","api"],["custome",null]]] |
| 1040 |
|
|
|
| 1041 |
|
|
=item "security_certificate_assign" - assigns given certificate to api or apache |
| 1042 |
|
|
|
| 1043 |
|
|
This request assigns given certificate to apache or api. |
| 1044 |
|
|
|
| 1045 |
|
|
> [<id>, "security_certificate_assign", [ [<name>, <assign>], ...] ] |
| 1046 |
|
|
< [<id>, 1] |
| 1047 |
|
|
|
| 1048 |
|
|
Example: |
| 1049 |
|
|
|
| 1050 |
|
|
> [1, "security_certificate_assign", [["custom", "apache"], ["custom", "api"]]] |
| 1051 |
|
|
< [1, 1] |
| 1052 |
|
|
|
| 1053 |
|
|
=item "security_authentication_method_list" - lists authentication methods and settings |
| 1054 |
|
|
|
| 1055 |
|
|
This request returns all or specified properties of all or specified authentication method. |
| 1056 |
|
|
First array contains the list of properties and the second array contains the list of gids |
| 1057 |
|
|
of methods. Result array will have one array per authentication method. |
| 1058 |
|
|
|
| 1059 |
|
|
Valid properties are |
| 1060 |
|
|
|
| 1061 |
|
|
name gid inuse settings |
| 1062 |
|
|
|
| 1063 |
|
|
> [<id>, "security_authentication_method_list", [<properties>, ...], [<method-gid>, ...]] |
| 1064 |
|
|
< [<id>, 1, [ [<value>, ...], ...]] |
| 1065 |
|
|
|
| 1066 |
|
|
Example: |
| 1067 |
|
|
|
| 1068 |
|
|
> [1, "security_authentication_method_list", ["name"], ["90194313753", "90194313603"]] |
| 1069 |
|
|
< [1,1,[["RADIUS"],["Active Directory (LDAPS)"]]] |
| 1070 |
|
|
|
| 1071 |
|
|
=item "security_authentication_modify" - modifies given authentication methods |
| 1072 |
|
|
|
| 1073 |
|
|
This request edits given authentication method. |
| 1074 |
|
|
First argument is the authentication method gid. |
| 1075 |
root |
1.5 |
All new values should be mentioned in a hash. |
| 1076 |
root |
1.1 |
|
| 1077 |
|
|
Valid properties are |
| 1078 |
|
|
|
| 1079 |
|
|
inuse server secret csecret domain ctrls certificate |
| 1080 |
|
|
|
| 1081 |
|
|
bit value C<inuse> will activate/inactivate the given authentication method. |
| 1082 |
|
|
C<server> is the RADIUS server for RADIUS authentication method. |
| 1083 |
|
|
C<secret> and C<csecret> are secret password and confirm secret password for RADIUS server. |
| 1084 |
|
|
C<domain> is the domain name for LDAP and LDAPS authentication methods. |
| 1085 |
|
|
C<ctrls> is the array of delete and add lists of domain controls. |
| 1086 |
|
|
C<certificate> is the valid certificate name for LDAPS authentication method. |
| 1087 |
|
|
C<timeout> is the value in seconds to be used when communicating with Active Directory servers. |
| 1088 |
|
|
|
| 1089 |
|
|
> [<id>, "security_authentication_modify", <method-gid>, {<property> : <value>,... }] |
| 1090 |
|
|
< [<id>, 1] |
| 1091 |
|
|
|
| 1092 |
|
|
Example: |
| 1093 |
|
|
|
| 1094 |
|
|
> [1, "security_authentication_modify", "90194313753", {"inuse" : 1, "server" : "4test"}] |
| 1095 |
|
|
< [1, 1] |
| 1096 |
|
|
|
| 1097 |
|
|
> [1, "security_authentication_modify", "90194313603", {"certificate" : "custom", "domain" : "new" |
| 1098 |
|
|
"ctrls" : [ ["10.1.50.1"], ["10.1.50.2"] ]}] |
| 1099 |
|
|
< [1, 1] |
| 1100 |
|
|
|
| 1101 |
|
|
=item "group_info" - lists group information |
| 1102 |
|
|
|
| 1103 |
|
|
This request returns all groups or specific groups. The request returns all |
| 1104 |
|
|
fields or specific fields. |
| 1105 |
|
|
|
| 1106 |
|
|
> [<id>, "group_info", [<field1>, <field2>, ...], [<group-gid>, ...]] |
| 1107 |
|
|
< [<id>, 1, [ [<value>, <value>, ...] , ...] |
| 1108 |
|
|
|
| 1109 |
|
|
The reply contains an array for each group with specified field values or all. |
| 1110 |
|
|
|
| 1111 |
|
|
Example: |
| 1112 |
|
|
|
| 1113 |
|
|
> [1, "group_info", ["name"]] |
| 1114 |
|
|
< [1,1,[["helpme"],["Network Administrator"],["Network Operator"],["Super Admin"]]] |
| 1115 |
|
|
|
| 1116 |
|
|
=item "group_modify" - adds and/or deletes groups |
| 1117 |
|
|
|
| 1118 |
|
|
This request adds and/or deletes given groups. |
| 1119 |
|
|
|
| 1120 |
|
|
> [<id>, "group_modify", [<delete-gid>, ...], [[<name>, <description>], ...]] |
| 1121 |
|
|
< [<id>, 1] |
| 1122 |
|
|
|
| 1123 |
|
|
Two arrays expected as input. First array is a list of group gids needs to be deleted. |
| 1124 |
root |
1.5 |
Second array is a list of groups needs to be added. An array per group should contain |
| 1125 |
root |
1.1 |
group name and description. |
| 1126 |
|
|
|
| 1127 |
|
|
Example: |
| 1128 |
|
|
|
| 1129 |
|
|
> [1, "group_modify", ["9845672231"], [["test1", "Test group"]]] |
| 1130 |
|
|
< [1, 1] |
| 1131 |
|
|
|
| 1132 |
|
|
=item "group_settings" - lists permissions for a given group |
| 1133 |
|
|
|
| 1134 |
|
|
> [<id>, "group_settings", <group-gid>, [<role>, <role>, ...], [<realm-gid>, ...]] |
| 1135 |
|
|
< [<id>, 1, [[[<system-role>, <permission>], ...], |
| 1136 |
|
|
[[<realm-gid>, [[<realm-role>, <permission>], ...]], ...]]] |
| 1137 |
|
|
|
| 1138 |
|
|
The input should have a valid group gid in textual format. Two arrays followed by group gid |
| 1139 |
|
|
are list of roles and list of realm gids. These two arrays are optional. |
| 1140 |
|
|
The result contains two arrays. First array is for system specific roles. One array per role. |
| 1141 |
|
|
Second array is for realm specific roles. One array per realm. First element of the array is |
| 1142 |
|
|
realm-gid in textual format followed by an array of realm specific roles and their permission. |
| 1143 |
|
|
Permission will be referred in bit value. bit value C<0> means NO Access, C<1> means |
| 1144 |
|
|
Read Access and C<2> means Read/Write Access. |
| 1145 |
|
|
|
| 1146 |
|
|
Example: |
| 1147 |
|
|
|
| 1148 |
|
|
> [1, "group_settings", "98784248728"] |
| 1149 |
|
|
< [1,1,[[["API",2],["Add Realms",2],["Advanced Settings",1],["Global Settings",2]] |
| 1150 |
|
|
,[["3865500631171652",[["Advanced Realm Settings",0],["Assign Devices",0]]]]]] |
| 1151 |
|
|
|
| 1152 |
|
|
> [1, "group_settings", "98784248728", ["Add Realms", "Assign Devices"]] |
| 1153 |
|
|
< [1,1,[[["Add Realms",2]],[["3865500631171652",[["Assign Devices",0]]], |
| 1154 |
|
|
["3865500631171517",[["Assign Devices",0]]]]]] |
| 1155 |
|
|
|
| 1156 |
|
|
|
| 1157 |
|
|
=item "group_settings_modify" - edits group properties and permissions |
| 1158 |
|
|
|
| 1159 |
|
|
> [<id>, "group_settings_modify", <group-gid> |
| 1160 |
|
|
, {"name":<group-name>, "description":<group description>} |
| 1161 |
|
|
, [[<system-role>, <permission>], ...], [[<realm-gid>, |
| 1162 |
|
|
[[<realm-role>, <permission>], ...]], ...] ] |
| 1163 |
|
|
< [<id>, 1] |
| 1164 |
|
|
|
| 1165 |
|
|
The input should have a valid group gid. A property hash followed by the group gid. |
| 1166 |
|
|
The values of keys C<name> and C<description> are new group name and description. |
| 1167 |
|
|
Two arrays followed by hash. First array is for system specific roles. Format of the |
| 1168 |
|
|
array is same as output of C<group_settings> query. Second array is for realm specific roles. |
| 1169 |
|
|
One array per realm. Format of this array is same as output of C<group_settings> query. |
| 1170 |
|
|
|
| 1171 |
|
|
valid system specific roles are |
| 1172 |
|
|
|
| 1173 |
root |
1.5 |
"API", "Add Realms", "Advanced Settings", "Global Settings", "Group Management", "License", |
| 1174 |
root |
1.1 |
"Schedule Backup", "Security Settings", "System Utilities", "User Management", "View Log" |
| 1175 |
|
|
|
| 1176 |
|
|
valid realm specific roles are |
| 1177 |
|
|
|
| 1178 |
|
|
"Advanced Realm Settings", "Assign Devices", "Discovery Realm Settings", "Views", |
| 1179 |
root |
1.5 |
"Plugins", "Poller Settings", "Schedule Discovery","Schedule Poll","Schedule Report" |
| 1180 |
root |
1.1 |
,"Schedule Sync" |
| 1181 |
|
|
|
| 1182 |
|
|
Example: |
| 1183 |
|
|
|
| 1184 |
|
|
> [1, "group_settings_modify", "98784248723", {"name":"TEST"}, |
| 1185 |
|
|
[["Add Realms",0]]], [["386550063117151",[["Poller Setting",1]]]]] |
| 1186 |
|
|
< [1, 1] |
| 1187 |
|
|
|
| 1188 |
|
|
|
| 1189 |
|
|
> [1, "group_settings_modify", "98784248723", {}, |
| 1190 |
|
|
[["Add Realms",0],["Global Settings",1]]] |
| 1191 |
|
|
< [1, 1] |
| 1192 |
|
|
|
| 1193 |
root |
1.4 |
=item "remote_backup" - runs the remote backup immediately |
| 1194 |
|
|
|
| 1195 |
|
|
> [<id>, "remote_backup", <protocol>, <host>, <user>, <password>, |
| 1196 |
|
|
<directory>, <email-recipient>] |
| 1197 |
|
|
< [<id>, 1] |
| 1198 |
|
|
|
| 1199 |
root |
1.5 |
This request can be made without any arguments. When its requested without |
| 1200 |
|
|
arguments make sure backup settings configured in GUI. The valid values for |
| 1201 |
|
|
C<protocol> are C<SCP> and C<FTP>. The C<email-recipient> and C<directory> |
| 1202 |
root |
1.4 |
arguments are optional. |
| 1203 |
|
|
|
| 1204 |
|
|
Example: |
| 1205 |
|
|
|
| 1206 |
|
|
> [1, "remote_backup"] |
| 1207 |
|
|
< [1, 1] |
| 1208 |
|
|
|
| 1209 |
|
|
> [1, "remote_backup", "SCP", "10.5.1.1", "admin", "admin", "/tmp"] |
| 1210 |
|
|
< [1, 1] |
| 1211 |
root |
1.1 |
|
| 1212 |
|
|
=back |
| 1213 |
|
|
|
| 1214 |
root |
1.5 |
=head1 AUTHORS |
| 1215 |
root |
1.1 |
|
| 1216 |
root |
1.5 |
Marc Lehmann <marc@nethype.de> (initial version), Francis Chelladurai |
| 1217 |
|
|
<fxavier@porttracker.com> (current maintainer). |
| 1218 |
root |
1.1 |
|