1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>Definition of Instrumentation Functions</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<CENTER>
<A HREF="http://www.erlang.se"><IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif"></A>
</CENTER>
<A NAME="11"><!-- Empty --></A>
<H2>11 Definition of Instrumentation Functions</H2>
<P>The section <STRONG>Definition of Instrumentation Functions</STRONG> describes
the user defined functions, which the agent calls at different times.
<A NAME="11.1"><!-- Empty --></A>
<H3>11.1 Variable Instrumentation</H3>
<P>For scalar variables, a function <CODE>f(Operation, ...)</CODE> must
be defined.
<P>The <CODE>Operation</CODE> can be <CODE>new</CODE>, <CODE>delete</CODE>,
<CODE>get</CODE>, <CODE>is_set_ok</CODE>, <CODE>set</CODE>, or <CODE>undo</CODE>.
<P>In case of an error, all instrumentation functions may return
either an SNMPv1 or an SNMPv2 error code. If it returns an SNMPv2
code, it is converted into an SNMPv1 code before it is sent to a
SNMPv1 manager. It is recommended to use the SNMPv2 error codes
for all instrumentation functions, as these provide more
details. See <A HREF="snmp_app_a.html">Appendix A</A> for a
description of error code conversions.
<A NAME="11.1.1"><!-- Empty --></A>
<H4>11.1.1 f(new [, ExtraArgs])</H4>
<P>The function <CODE>f(new [, ExtraArgs])</CODE> is called for each
variable in the MIB when the
MIB is loaded into the agent. This makes it possible to perform
necessary initialization.
<P>This function is optional. The return value is discarded.
<A NAME="11.1.2"><!-- Empty --></A>
<H4>11.1.2 f(delete [, ExtraArgs])</H4>
<P>The function <CODE>f(delete [, ExtraArgs])</CODE> is called
for each object in an MIB when the
MIB is unloaded from the agent. This makes it possible to
perform necessary clean-up.
<P>This function is optional. The return value is discarded.
<A NAME="11.1.3"><!-- Empty --></A>
<H4>11.1.3 f(get [, ExtraArgs])
</H4>
<P>The function <CODE>f(get [, ExtraArgs])</CODE> is called when a
get-request or a get-next
request refers to the variable.
<P>This function is mandatory.
<A NAME="11.1.3.1"><!-- Empty --></A>
<H5>11.1.3.1 Valid Return Values</H5>
<P>
<UL>
<LI>
<CODE>{value, Value}</CODE>. The <CODE>Value</CODE> must be of
correct type, length and within ranges, otherwise
<CODE>genErr</CODE> is returned in the response PDU. If the
object is an enumerated integer, the symbolic enum value
may be used as an atom. If the object is of type BITS, the
return value shall be an integer or a list of bits that
are set.
</LI>
<LI>
<CODE>{noValue, noSuchName}</CODE>(SNMPv1)
</LI>
<LI>
<CODE>{noValue, noSuchObject | noSuchInstance} </CODE>(SNMPv2)
</LI>
<LI>
<CODE>genErr</CODE>. Used if an error occured. Note,
this should be an internal processing error, e.g. a caused
by a programing fault somewhere. If the variable does not
exist, use <CODE>{noValue, noSuchName}</CODE> or
<CODE>{noValue, noSuchInstance}</CODE>.
</LI>
</UL>
<A NAME="11.1.4"><!-- Empty --></A>
<H4>11.1.4 f(is_set_ok, NewValue [, ExtraArgs])
</H4>
<P>The function <CODE>f(is_set_ok, NewValue [, ExtraArgs])</CODE> is
called in phase one of the set-request
processing so that the new value can be checked for
inconsistencies.
<P><CODE>NewValue</CODE> is guaranteed to be of the correct type,
length and within ranges, as specified in the MIB. If the
object is an enumerated integer or of type BITS, the integer
value is used.
<P>This function is optional.
<P>If this function is called, it will be called again, either
with <CODE>undo</CODE> or with <CODE>set</CODE> as first argument.
<A NAME="11.1.4.1"><!-- Empty --></A>
<H5>11.1.4.1 Valid return values</H5>
<P>
<UL>
<LI>
<CODE>noError</CODE>
</LI>
<LI>
<CODE>badValue | noSuchName | genErr</CODE>(SNMPv1)
</LI>
<LI>
<CODE>noAccess | noCreation | inconsistentValue |
resourceUnavailable | inconsistentName | genErr</CODE>(SNMPv2)
</LI>
</UL>
<A NAME="11.1.5"><!-- Empty --></A>
<H4>11.1.5 f(undo, NewValue [, ExtraArgs])</H4>
<P>If an error occurred, this function is called after the
<CODE>is_set_ok</CODE> function is called. If <CODE>set</CODE> is called for
this object, <CODE>undo</CODE> is not called.
<P><CODE>NewValue</CODE> is guaranteed to be of the correct type,
length and within ranges, as specified in the MIB. If the
object is an enumerated integer or of type BITS, the integer
value is used.
<P>This function is optional.
<A NAME="11.1.5.1"><!-- Empty --></A>
<H5>11.1.5.1 Valid return values</H5>
<P>
<UL>
<LI>
<CODE>noError</CODE>
</LI>
<LI>
<CODE>genErr</CODE>(SNMPv1)
</LI>
<LI>
<CODE>undoFailed | genErr</CODE>(SNMPv2)
</LI>
</UL>
<A NAME="11.1.6"><!-- Empty --></A>
<H4>11.1.6 f(set, NewValue [, ExtraArgs])
</H4>
<P>This function is called to perform the set in phase two of
the set-request processing. It is only called if the
corresponding <CODE>is_set_ok</CODE> function is present and returns
<CODE>noError</CODE>.
<P><CODE>NewValue</CODE> is guaranteed to be of the correct type,
length and within ranges, as specified in the MIB. If the
object is an enumerated integer or of type BITS, the integer
value is used.
<P>This function is mandatory.
<A NAME="11.1.6.1"><!-- Empty --></A>
<H5>11.1.6.1 Valid return values
</H5>
<P>
<UL>
<LI>
<CODE>noError</CODE>
</LI>
<LI>
<CODE>genErr</CODE>(SNMPv1)
</LI>
<LI>
<CODE>commitFailed | undoFailed | genErr</CODE>(SNMPv2)
</LI>
</UL>
<A NAME="11.2"><!-- Empty --></A>
<H3>11.2 Table Instrumentation</H3>
<P>For tables, a <CODE>f(Operation, ...)</CODE> function should be
defined (the function shown is exemplified with <CODE>f</CODE>).
<P>The <CODE>Operation</CODE> can be <CODE>new</CODE>, <CODE>delete</CODE>,
<CODE>get</CODE>, <CODE>next</CODE>, <CODE>is_set_ok</CODE>, <CODE>undo</CODE> or
<CODE>set</CODE>.
<P>In case of an error, all instrumentation functions may return
either an SNMPv1 or an SNMPv2 error code. If it returns an SNMPv2
code, it is converted into an SNMPv1 code before it is sent to a
SNMPv1 manager. It is recommended to use the SNMPv2 error codes
for all instrumentation functions, as these provide more
details. See <A HREF="snmp_app_a.html">Appendix A</A> for a
description of error code conversions.<A NAME="11.2.1"><!-- Empty --></A>
<H4>11.2.1 f(new [, ExtraArgs])</H4>
<P>The function <CODE>f(new [, ExtraArgs])</CODE> is called for each object in an MIB when the
MIB is loaded into the agent. This makes it possible to perform
the necessary initialization.
<P>This function is optional. The return value is discarded.
<A NAME="11.2.2"><!-- Empty --></A>
<H4>11.2.2 f(delete [, ExtraArgs])</H4>
<P>The function <CODE>f(delete [, ExtraArgs])</CODE> is called for each object in an MIB when the
MIB is unloaded from the agent. This makes it possible to
perform any necessary clean-up.
<P>This function is optional. The return value is discarded.
<A NAME="11.2.3"><!-- Empty --></A>
<H4>11.2.3 f(get, RowIndex, Cols [, ExtraArgs])</H4>
<P>The function <CODE>f(get, RowIndex, Cols [, ExtraArgs])</CODE> is
called when a get-request refers to a table.
<P>This function is mandatory.
<A NAME="11.2.3.1"><!-- Empty --></A>
<H5>11.2.3.1 Arguments</H5>
<P>
<UL>
<LI>
<CODE>RowIndex</CODE> is a list of integers which define the
key values for the row. The <CODE>RowIndex</CODE> is the list
representation (list of integers) which follow the
<CODE>Cols</CODE> integer in the OBJECT IDENTIFIER.
</LI>
<LI>
<CODE>Cols</CODE> is a list of integers which represent the
column numbers. The <CODE>Cols</CODE> are sorted by increasing
value and are guaranteed to be valid column numbers.
</LI>
</UL>
<A NAME="11.2.3.2"><!-- Empty --></A>
<H5>11.2.3.2 Valid Return Values</H5>
<P>
<UL>
<LI>
A list with as many elements as the <CODE>Cols</CODE> list,
where each element is the value of the corresponding
column. Each element can be:
<UL>
<LI>
<CODE>{value, Value}</CODE>. The <CODE>Value</CODE> must be of
correct type, length and within ranges, otherwise
<CODE>genErr</CODE> is returned in the response PDU. If the
object is an enumerated integer, the symbolic enum
value may be used (as an atom). If the object is of
type BITS, the return value shall be an integer or a
list of bits that are set.
</LI>
<LI>
<CODE>{noValue, noSuchName}</CODE>(SNMPv1)
</LI>
<LI>
<CODE>{noValue, noSuchObject | noSuchInstance}</CODE>(SNMPv2)
</LI>
</UL>
</LI>
<LI>
<CODE>{noValue, Error}</CODE>. If the row does not exist,
because all columns have <CODE>{noValue, Error}</CODE>), the
single tuple <CODE>{noValue, Error}</CODE> can be returned.
This is a shorthand for a list with all elements
<CODE>{noValue, Error}</CODE>.
</LI>
<LI>
<CODE>genErr</CODE>. Used if an error occured. Note that
this should be an internal processing error, e.g. a caused
by a programing fault somewhere. If some column does not
exist, use <CODE>{noValue, noSuchName}</CODE> or
<CODE>{noValue, noSuchInstance}</CODE>.
</LI>
</UL>
<A NAME="11.2.4"><!-- Empty --></A>
<H4>11.2.4 f(get_next, RowIndex, Cols [, ExtraArgs])
</H4>
<P>The fumction <CODE>f(get_next, RowIndex, Cols [, ExtraArgs])</CODE> is
called when a get-next- or a
get-bulk-request refers to the table.
<P>The <CODE>RowIndex</CODE> argument may refer to an existing row or a
non-existing row, or it may be unspecified. The <CODE>Cols</CODE> list
may refer to unaccessible columns or non-existing columns. For
each column in the <CODE>Cols</CODE> list, the corresponding next
instance is determined, and the last part of its OBJECT
IDENTIFIER and its value is returned.
<P>This function is mandatory.
<A NAME="11.2.4.1"><!-- Empty --></A>
<H5>11.2.4.1 Arguments</H5>
<P>
<UL>
<LI>
<CODE>RowIndex</CODE> is a list of integers (possibly empty)
that defines the key values for a row. The <CODE>RowIndex</CODE>
is the list representation (list of integers), which follow
the <CODE>Cols</CODE> integer in the OBJECT IDENTIFIER.
</LI>
<LI>
<CODE>Cols</CODE> is a list of integers, greater than or
equal to zero, which represents the column numbers.
</LI>
</UL>
<A NAME="11.2.4.2"><!-- Empty --></A>
<H5>11.2.4.2 Valid Return Values</H5>
<P>
<UL>
<LI>
A list with as many elements as the <CODE>Cols</CODE> list
Each element can be:
<UL>
<LI>
<CODE>{NextOid, NextValue}</CODE>, where <CODE>NextOid</CODE>
is the lexicographic next OBJECT IDENTIFIER for the
corresponding column. This should be specified as the
OBJECT IDENTIFER part following the table entry. This
means that the first integer is the column number and
the rest is a specification of the keys.
<CODE>NextValue</CODE> is the value of this element.
</LI>
<LI>
<CODE>endOfTable</CODE> if there are no accessible
elements after this one.
</LI>
</UL>
</LI>
<LI>
<CODE>{genErr, Column}</CODE> where <CODE>Column</CODE> denotes
the column that caused the error. <CODE>Column</CODE> must be
one of the columns in the <CODE>Cols</CODE> list. Note that
this should be an internal processing error, e.g. a caused
by a programing fault somewhere. If some column does not
exist, you must return the next accessible element (or
<CODE>endOfTable</CODE>).
</LI>
</UL>
<A NAME="11.2.5"><!-- Empty --></A>
<H4>11.2.5 f(is_set_ok, RowIndex, Cols [, ExtraArgs])
</H4>
<P>The fumction <CODE>f(is_set_ok, RowIndex, Cols [, ExtraArgs])</CODE>
is called in phase one of the set-request
processing so that new values can be checked for
inconsistencies.
<P>If the function is called, it will be called again with
<CODE>undo</CODE>, or with <CODE>set</CODE> as first argument.
<P>This function is optional.
<A NAME="11.2.5.1"><!-- Empty --></A>
<H5>11.2.5.1 Arguments</H5>
<P>
<UL>
<LI>
<CODE>RowIndex</CODE> is a list of integers which define the
key values for the row. The <CODE>RowIndex</CODE> is the list
representation (list of integers) which follow the
<CODE>Cols</CODE> integer in the OBJECT IDENTIFIER.
</LI>
<LI>
<CODE>Cols</CODE> is a list of <CODE>{Column, NewValue}</CODE>,
where <CODE>Column</CODE> is an integer, and <CODE>NewValue</CODE> is
guaranteed to be of the correct type, length and within
ranges, as specified in the MIB. If the object is an
enumerated integer or of type BITS, the integer value is
used. The list is sorted by <CODE>Column</CODE> (increasing) and
each <CODE>Column</CODE> is guaranteed to be a valid column
number.
</LI>
</UL>
<A NAME="11.2.5.2"><!-- Empty --></A>
<H5>11.2.5.2 Valid Return Values</H5>
<P>
<UL>
<LI>
<CODE>{noError, 0}</CODE>
</LI>
<LI>
<CODE>{Error, Column}</CODE>, where <CODE>Error</CODE> is the same
as for <CODE>is_set_ok</CODE> for variables, and <CODE>Column</CODE>
denotes the faulty column. <CODE>Column</CODE> must be one of the
columns in the <CODE>Cols</CODE> list.
</LI>
</UL>
<A NAME="11.2.6"><!-- Empty --></A>
<H4>11.2.6 f(undo, RowIndex, Cols [, ExtraArgs])
</H4>
<P>If an error occurs, The fumction
<CODE>f(undo, RowIndex, Cols [, ExtraArgs])</CODE> is called after the
<CODE>is_set_ok</CODE> function. If <CODE>set</CODE> is called for this
object, <CODE>undo</CODE> is not called.
<P>This function is optional.
<A NAME="11.2.6.1"><!-- Empty --></A>
<H5>11.2.6.1 Arguments</H5>
<P>
<UL>
<LI>
<CODE>RowIndex</CODE> is a list of integers which define the
key values for the row. The <CODE>RowIndex</CODE> is the list
representation (list of integers) which follow the
<CODE>Cols</CODE> integer in the OBJECT IDENTIFIER.
</LI>
<LI>
<CODE>Cols</CODE> is a list of <CODE>{Column, NewValue}</CODE>,
where <CODE>Column</CODE> is an integer, and <CODE>NewValue</CODE> is
guaranteed to be of the correct type, length and within
ranges, as specified in the MIB. If the object is an
enumerated integer or of type BITS, the integer value is
used. The list is sorted by <CODE>Column</CODE> (increasing) and
each <CODE>Column</CODE> is guaranteed to be a valid column
number.
</LI>
</UL>
<A NAME="11.2.6.2"><!-- Empty --></A>
<H5>11.2.6.2 Valid Return Values</H5>
<P>
<UL>
<LI>
<CODE>{noError, 0}</CODE>
</LI>
<LI>
<CODE>{Error, Column}</CODE> where <CODE>Error</CODE> is the same
as for <CODE>undo</CODE> for variables, and <CODE>Column</CODE> denotes
the faulty column. <CODE>Column</CODE> must be one of the columns
in the <CODE>Cols</CODE> list.
</LI>
</UL>
<A NAME="11.2.7"><!-- Empty --></A>
<H4>11.2.7 f(set, RowIndex, Cols [, ExtraArgs])
</H4>
<P>The fumction <CODE>f(set, RowIndex, Cols [, ExtraArgs])</CODE> is
called to perform the set in phase two of
the set-request processing. It is only called if the
corresponding <CODE>is_set_ok</CODE> function did not exist, or
returned <CODE>{noError, 0}</CODE>.
<P>This functionn is mandatory.
<A NAME="11.2.7.1"><!-- Empty --></A>
<H5>11.2.7.1 Arguments</H5>
<P>
<UL>
<LI>
<CODE>RowIndex</CODE> is a list of integers that define the
key values for the row. The <CODE>RowIndex</CODE> is the list
representation (list of integers) which follow the
<CODE>Cols</CODE> integer in the OBJECT IDENTIFIER.
</LI>
<LI>
<CODE>Cols</CODE> is a list of <CODE>{Column, NewValue}</CODE>,
where <CODE>Column</CODE> is an integer, and <CODE>NewValue</CODE> is
guaranteed to be of the correct type, length and within
ranges, as specified in the MIB. If the object is an
enumerated integer or of type BITS, the integer value is
used. The list is sorted by <CODE>Column</CODE> (increasing) and
each <CODE>Column</CODE> is guaranteed to be a valid column
number.
</LI>
</UL>
<A NAME="11.2.7.2"><!-- Empty --></A>
<H5>11.2.7.2 Valid Return Values</H5>
<P>
<UL>
<LI>
<CODE>{noError, 0}</CODE>
</LI>
<LI>
<CODE>{Error, Column}</CODE> where <CODE>Error</CODE> is the same
as <CODE>set</CODE> for variables, and <CODE>Column</CODE> denotes
the faulty column. <CODE>Column</CODE> must be one of the columns
in the <CODE>Cols</CODE> list.
</LI>
</UL>
<CENTER>
<HR>
<SMALL>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|