summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@nxc.no>2018-02-01 20:36:41 (GMT)
committer Sergey Poznyakoff <gray@nxc.no>2018-02-01 20:36:41 (GMT)
commit8bba300e4118da5737b2f015028a9ca425e83628 (patch) (unidiff)
tree7de98c55cf47c87d17f0404c44f91f879eafb898 /src
parent85f908426e444a596b979a9569bf83fadfa5ace1 (diff)
downloadvarnish-mib-8bba300e4118da5737b2f015028a9ca425e83628.tar.gz
varnish-mib-8bba300e4118da5737b2f015028a9ca425e83628.tar.bz2
Add new object IDs as per https://puszcza.gnu.org.ua/bugs/?362
* src/Makefile.am: Make sure VARNISH-MIB.txt is read from the src directory. * src/VARNISH-MIB.txt: Add new mibs. * src/varnish_mib.mib2c: Add new objects. Make sure objects marked with varnish_type NULL will never be returned.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/Makefile.am3
-rw-r--r--src/VARNISH-MIB.txt136
-rw-r--r--src/varnish_mib.mib2c33
3 files changed, 164 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a7f12a..3b5547b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,7 @@ BUILT_SOURCES = \
37varnish_mib.c varnish_mib.h: varnish_mib.mib2c VARNISH-MIB.txt 37varnish_mib.c varnish_mib.h: varnish_mib.mib2c VARNISH-MIB.txt
38 38
39.mib2c.c: 39.mib2c.c:
40 MIBDIRS=${top_srcdir}/src:${NET_SNMP_MIBDIRS} MIBS="+VARNISH-MIB" \ 40 MIBDIRS=${top_srcdir}/src:${NET_SNMP_MIBDIRS} MIBS="VARNISH-MIB:${NET_SNMP_MIBS}" \
41 mib2c -c $< -f $@ varnish 41 mib2c -c $< -f $@ varnish
42 42
43#NET_SNMP_INCLUDES = `$(NET_SNMP_CONFIG) --cflags` 43#NET_SNMP_INCLUDES = `$(NET_SNMP_CONFIG) --cflags`
@@ -45,6 +45,7 @@ varnish_mib.c varnish_mib.h: varnish_mib.mib2c VARNISH-MIB.txt
45NET_SNMP_LIBS = `$(NET_SNMP_CONFIG) --libs` 45NET_SNMP_LIBS = `$(NET_SNMP_CONFIG) --libs`
46NET_SNMP_EXLIBS = `$(NET_SNMP_CONFIG) --external-libs` 46NET_SNMP_EXLIBS = `$(NET_SNMP_CONFIG) --external-libs`
47NET_SNMP_MIBDIRS = `net-snmp-config --mibdirs` 47NET_SNMP_MIBDIRS = `net-snmp-config --mibdirs`
48NET_SNMP_MIBS = `net-snmp-config --default-mibs`
48 49
49AM_LDFLAGS = \ 50AM_LDFLAGS = \
50 -module \ 51 -module \
diff --git a/src/VARNISH-MIB.txt b/src/VARNISH-MIB.txt
index 59a9d42..8d60477 100644
--- a/src/VARNISH-MIB.txt
+++ b/src/VARNISH-MIB.txt
@@ -20,14 +20,14 @@ IMPORTS
20 FROM SNMPv2-CONF; 20 FROM SNMPv2-CONF;
21 21
22varnishMIB MODULE-IDENTITY 22varnishMIB MODULE-IDENTITY
23 LAST-UPDATED "201509250838Z" 23 LAST-UPDATED "201802012132Z"
24 ORGANIZATION "Shared Autonomous sYstems" 24 ORGANIZATION "Shared Autonomous sYstems"
25 CONTACT-INFO "Morten Hermanrud <mhe@say.no> 25 CONTACT-INFO "Morten Hermanrud <mhe@say.no>
26 Sergey Poznyakoff <gray@gnu.org> 26 Sergey Poznyakoff <gray@gnu.org>
27 " 27 "
28 DESCRIPTION 28 DESCRIPTION
29 "This MIB module defines objects for Varnish reverse web proxy." 29 "This MIB module defines objects for Varnish reverse web proxy."
30 REVISION "201509250838Z" 30 REVISION "201802012132Z"
31 DESCRIPTION 31 DESCRIPTION
32 "Second revision." 32 "Second revision."
33 ::= { varnish 0 } 33 ::= { varnish 0 }
@@ -41,6 +41,8 @@ session OBJECT IDENTIFIER ::= { varnish 5 }
41 threads OBJECT IDENTIFIER::= { varnish 6 } 41 threads OBJECT IDENTIFIER::= { varnish 6 }
42 bans OBJECT IDENTIFIER::= { varnish 7 } 42 bans OBJECT IDENTIFIER::= { varnish 7 }
43 agent OBJECT IDENTIFIER::= { varnish 8 } 43 agent OBJECT IDENTIFIER::= { varnish 8 }
44objects OBJECT IDENTIFIER ::= { varnish 9 }
45vcl OBJECT IDENTIFIER ::= { varnish 10 }
44 46
45clientAcceptedConnections OBJECT-TYPE 47clientAcceptedConnections OBJECT-TYPE
46 SYNTAX Counter64 48 SYNTAX Counter64
@@ -783,6 +785,136 @@ banExpression OBJECT-TYPE
783 "VCL expression of the ban." 785 "VCL expression of the ban."
784 ::= { varnishBanEntry 4 } 786 ::= { varnishBanEntry 4 }
785 787
788objectsCount OBJECT-TYPE
789 SYNTAX Counter64
790 MAX-ACCESS read-only
791 STATUS current
792 DESCRIPTION
793 "Approximate number of HTTP objects (headers + body,
794 if present) in the cache."
795 ::= { objects 1 }
796
797objectsVampire OBJECT-TYPE
798 SYNTAX Counter64
799 MAX-ACCESS read-only
800 STATUS current
801 DESCRIPTION
802 "Number of unresurrected objects."
803 ::= { objects 2 }
804
805objectsCore OBJECT-TYPE
806 SYNTAX Counter64
807 MAX-ACCESS read-only
808 STATUS current
809 DESCRIPTION
810 "Approximate number of object metadata elements in the
811 cache. Each object needs an objectcore, extra
812 objectcores are for hit-for-miss, hit-for-pass and
813 busy objects."
814 ::= { objects 3 }
815
816objectsHead OBJECT-TYPE
817 SYNTAX Counter64
818 MAX-ACCESS read-only
819 STATUS current
820 DESCRIPTION
821 "Approximate number of different hash entries in the cache."
822 ::= { objects 4 }
823
824objectsExpired OBJECT-TYPE
825 SYNTAX Counter64
826 MAX-ACCESS read-only
827 STATUS current
828 DESCRIPTION
829 "Number of objects that expired from cache because of old age."
830 ::= { objects 5 }
831
832objectsLRUNuked OBJECT-TYPE
833 SYNTAX Counter64
834 MAX-ACCESS read-only
835 STATUS current
836 DESCRIPTION
837 "How many objects have been forcefully evicted from
838 storage to make room for a new object."
839 ::= { objects 6 }
840
841objectsLRUMoved OBJECT-TYPE
842 SYNTAX Counter64
843 MAX-ACCESS read-only
844 STATUS current
845 DESCRIPTION
846 "Number of move operations done on the LRU list."
847 ::= { objects 7 }
848
849objectsPurges OBJECT-TYPE
850 SYNTAX Counter64
851 MAX-ACCESS read-only
852 STATUS current
853 DESCRIPTION
854 "Number of purge operations executed"
855 ::= { objects 8 }
856
857objectsObjPurged OBJECT-TYPE
858 SYNTAX Counter64
859 MAX-ACCESS read-only
860 STATUS current
861 DESCRIPTION
862 "Number of purged objects."
863 ::= { objects 9 }
864
865objectsGzip OBJECT-TYPE
866 SYNTAX Counter64
867 MAX-ACCESS read-only
868 STATUS current
869 DESCRIPTION
870 "Number of gzip operations."
871 ::= { objects 10 }
872
873objectsGunzip OBJECT-TYPE
874 SYNTAX Counter64
875 MAX-ACCESS read-only
876 STATUS current
877 DESCRIPTION
878 "Number of gunzip operations."
879 ::= { objects 11 }
880
881
882--
883-- VCL statistics
884--
885
886vclTotal OBJECT-TYPE
887 SYNTAX Counter64
888 MAX-ACCESS read-only
889 STATUS current
890 DESCRIPTION
891 "Number of loaded VCLs in total."
892 ::= { vcl 1 }
893
894vclAvail OBJECT-TYPE
895 SYNTAX Counter64
896 MAX-ACCESS read-only
897 STATUS current
898 DESCRIPTION
899 "Number of VCLs available."
900 ::= { vcl 2 }
901
902vclDiscard OBJECT-TYPE
903 SYNTAX Counter64
904 MAX-ACCESS read-only
905 STATUS current
906 DESCRIPTION
907 "Number of discarded VCLs."
908 ::= { vcl 3 }
909
910vclFail OBJECT-TYPE
911 SYNTAX Counter64
912 MAX-ACCESS read-only
913 STATUS current
914 DESCRIPTION
915 "Number of VCL failures"
916 ::= { vcl 4 }
917
786-- 918--
787-- Groups and Compliance 919-- Groups and Compliance
788-- 920--
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index a458723..155df42 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -98,7 +98,23 @@ $vars{'varnish_translate_table'} = {
98 bansLurkerContention => [ 'DICT', 'MAIN.bans_lurker_contention' ], 98 bansLurkerContention => [ 'DICT', 'MAIN.bans_lurker_contention' ],
99 bansPersistedBytes => [ 'DICT', 'MAIN.bans_persisted_bytes' ], 99 bansPersistedBytes => [ 'DICT', 'MAIN.bans_persisted_bytes' ],
100 bansPersistedFragmentation => [ 'DICT', 'MAIN.bans_persisted_fragmentation' ], 100 bansPersistedFragmentation => [ 'DICT', 'MAIN.bans_persisted_fragmentation' ],
101 101
102 objectsCount => [ 'DICT', 'MAIN.n_object' ],
103 objectsVampire => [ 'DICT', 'MAIN.n_vampireobject' ],
104 objectsCore => [ 'DICT', 'MAIN.n_objectcore' ],
105 objectsHead => [ 'DICT', 'MAIN.n_objecthead' ],
106 objectsExpired => [ 'DICT', 'MAIN.n_expired' ],
107 objectsLRUNuked => [ 'DICT', 'MAIN.n_lru_nuked' ],
108 objectsLRUMoved => [ 'DICT', 'MAIN.n_lru_moved' ],
109 objectsPurges => [ 'DICT', 'MAIN.n_purges' ],
110 objectsObjPurged => [ 'DICT', 'MAIN.n_obj_purged' ],
111 objectsGzip => [ 'DICT', 'MAIN.n_gzip' ],
112 objectsGunzip => [ 'DICT', 'MAIN.n_gunzip' ],
113
114 vclTotal => [ 'DICT', 'MAIN.n_vcl' ],
115 vclAvail => [ 'DICT', 'MAIN.n_vcl_avail' ],
116 vclDiscard => [ 'DICT', 'MAIN.n_vcl_discard' ],
117 vclFail => [ 'DICT', 'MAIN.vcl_fail' ],
102}; 118};
103 119
104$vars{'varnish_translate'} = sub { 120$vars{'varnish_translate'} = sub {
@@ -237,9 +253,11 @@ varnish_get_vsm_data()
237*/ 253*/
238 254
239@foreach $i scalar@ 255@foreach $i scalar@
256/* COMMX $i */
240 @startperl@ 257 @startperl@
241 &{$vars{'varnish_translate'}}($vars{'i'}); 258 &{$vars{'varnish_translate'}}($vars{'i'});
242 @endperl@ 259 @endperl@
260@if $varnish_type ne 'NULL'@
243$varnish_if 261$varnish_if
244static int 262static int
245handle_$i(netsnmp_mib_handler *handler, 263handle_$i(netsnmp_mib_handler *handler,
@@ -302,15 +320,15 @@ handle_$i(netsnmp_mib_handler *handler,
302 snmp_set_var_typed_value(requests->requestvb, $i.type, 320 snmp_set_var_typed_value(requests->requestvb, $i.type,
303 &$varnish_member, sizeof($varnish_member)); 321 &$varnish_member, sizeof($varnish_member));
304 @end@ 322 @end@
305 @elsif $varnish_type eq 'NULL'@ 323 @elsif $varnish_type eq 'NUMBER'@
306 { 324 {
307 @if $i.type eq 'ASN_COUNTER64'@ 325 @if $i.type eq 'ASN_COUNTER64'@
308 struct counter64 ctr = { 0, 0}; 326 struct counter64 ctr = { ($varnish_member>>32)&0xffffffff, ($varnish_member)&0xffffffff };
309 snmp_set_var_typed_value(requests->requestvb, $i.type, 327 snmp_set_var_typed_value(requests->requestvb, $i.type,
310 &ctr, 328 &ctr,
311 sizeof(ctr)); 329 sizeof(ctr));
312 @else@ 330 @else@
313 uint64_t val; 331 uint64_t val = $varnish_member;
314 snmp_set_var_typed_value(requests->requestvb, $i.type, 332 snmp_set_var_typed_value(requests->requestvb, $i.type,
315 &val, 333 &val,
316 sizeof(val)); 334 sizeof(val));
@@ -388,6 +406,7 @@ handle_$i(netsnmp_mib_handler *handler,
388} 406}
389$varnish_endif 407$varnish_endif
390@end@ 408@end@
409@end@
391 410
392@foreach $i table@ 411@foreach $i table@
393 ## Determine the first/last column names 412 ## Determine the first/last column names
@@ -574,9 +593,11 @@ init_$modulename(void)
574 @startperl@ 593 @startperl@
575 &{$vars{'varnish_translate'}}($vars{'i'}); 594 &{$vars{'varnish_translate'}}($vars{'i'});
576 @endperl@ 595 @endperl@
596 @if $varnish_type ne 'NULL'@
577$varnish_if 597$varnish_if
578 const oid ${i}_oid[] = { $i.commaoid }; 598 const oid ${i}_oid[] = { $i.commaoid };
579$varnish_endif 599$varnish_endif
600 @end@
580 @end@ 601 @end@
581 602
582 DEBUGMSGTL(("$modulename", "Initializing\n")); 603 DEBUGMSGTL(("$modulename", "Initializing\n"));
@@ -601,6 +622,7 @@ $varnish_endif
601 @startperl@ 622 @startperl@
602 &{$vars{'varnish_translate'}}($vars{'i'}); 623 &{$vars{'varnish_translate'}}($vars{'i'});
603 @endperl@ 624 @endperl@
625 @if $varnish_type ne 'NULL'@
604$varnish_if 626$varnish_if
605 netsnmp_register_scalar( 627 netsnmp_register_scalar(
606 netsnmp_create_handler_registration("$i", handle_$i, 628 netsnmp_create_handler_registration("$i", handle_$i,
@@ -612,7 +634,8 @@ $varnish_if
612 HANDLER_CAN_RWRITE 634 HANDLER_CAN_RWRITE
613 @end@ 635 @end@
614 )); 636 ));
615$varnish_endif 637$varnish_endif
638 @end@
616 @end@ 639 @end@
617 @foreach $i table@ 640 @foreach $i table@
618 initialize_table_$i(); 641 initialize_table_$i();

Return to:

Send suggestions and report system problems to the System administrator.