openserMIBNotifications.c

Go to the documentation of this file.
00001 /*
00002  * $Id: openserMIBNotifications.c 4518 2008-07-28 15:39:28Z henningw $
00003  *
00004  * SNMPStats Module 
00005  * Copyright (C) 2006 SOMA Networks, INC.
00006  * Written by: Jeffrey Magder (jmagder@somanetworks.com)
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify it
00011  * under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * Kamailio is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023  * USA
00024  *
00025  * History:
00026  * --------
00027  * 2006-11-23 initial version (jmagder)
00028  * 2007-02-16 Moved all OID registrations from the experimental branch to 
00029  *            OpenSER's IANA assigned enterprise branch. (jmagder)
00030  * 
00031  * Note: this file originally auto-generated by mib2c using
00032  *        : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
00033  *
00034  * This file contains functions for sending all traps supported by the SNMPStats
00035  * module.  
00036  */
00037 
00038 #include <net-snmp/net-snmp-config.h>
00039 #include <net-snmp/net-snmp-includes.h>
00040 #include <net-snmp/agent/net-snmp-agent-includes.h>
00041 
00042 #include "openserMIBNotifications.h"
00043 #include "../../dprint.h"
00044 #include "../../config.h"
00045 
00046 static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
00047 
00048 /* 
00049  * Sends off an openserMsgQueueDepthMinorEvent trap to the master agent,
00050  * assigning the following variable bindings:
00051  *
00052  *  - openserMsgQueueDepth          = msgQueueDepth
00053  *  - openserMsgQueueMinorThreshold = minorThreshold
00054  *
00055  */
00056 int send_openserMsgQueueDepthMinorEvent_trap(int msgQueueDepth, 
00057       int minorThreshold)
00058 {
00059    netsnmp_variable_list  *var_list = NULL;
00060    
00061    oid openserMsgQueueDepthMinorEvent_oid[] = { 
00062       OPENSER_OID,3,1,3,2,0,1 };
00063 
00064    oid openserMsgQueueDepth_oid[]       = { 
00065       OPENSER_OID,3,1,3,1,2,3,1,0 };
00066 
00067    oid openserMsgQueueMinorThreshold_oid[]  = { 
00068       OPENSER_OID,3,1,3,1,2,3,2,0 };
00069 
00070    snmp_varlist_add_variable(&var_list,
00071          snmptrap_oid, 
00072          OID_LENGTH(snmptrap_oid),
00073          ASN_OBJECT_ID,
00074          (u_char *)openserMsgQueueDepthMinorEvent_oid, 
00075          (int)sizeof(openserMsgQueueDepthMinorEvent_oid));
00076    
00077    snmp_varlist_add_variable(&var_list,
00078          openserMsgQueueDepth_oid, 
00079          OID_LENGTH(openserMsgQueueDepth_oid),
00080          ASN_GAUGE,
00081          (u_char *)&msgQueueDepth, 
00082          sizeof(msgQueueDepth));
00083 
00084    snmp_varlist_add_variable(&var_list,
00085          openserMsgQueueMinorThreshold_oid, 
00086          OID_LENGTH(openserMsgQueueMinorThreshold_oid),
00087          ASN_INTEGER,
00088          (u_char *)&minorThreshold,
00089          sizeof(minorThreshold));
00090 
00091    send_v2trap( var_list );
00092    snmp_free_varbind( var_list );
00093 
00094    return SNMP_ERR_NOERROR;
00095 }
00096 
00097 /*
00098  * Sends off an openserMsgQueueDepthMajorEvent trap to the master agent,
00099  * assigning the following variable bindings:
00100  *
00101  *  - openserMsgQueueDepth          = msgQueueDepth
00102  *  - openserMsgQueueMajorThreshold = majorThreshold
00103  *
00104  */
00105 int send_openserMsgQueueDepthMajorEvent_trap(int msgQueueDepth, 
00106       int majorThreshold)
00107 {
00108    netsnmp_variable_list  *var_list = NULL;
00109 
00110    oid openserMsgQueueDepthMajorEvent_oid[] = { 
00111       OPENSER_OID,3,1,3,2,0,2 };
00112 
00113    oid openserMsgQueueDepth_oid[]       = {
00114       OPENSER_OID,3,1,3,1,2,3,1,0 };
00115 
00116    oid openserMsgQueueMajorThreshold_oid[]  = { 
00117       OPENSER_OID,3,1,3,1,2,3,3,0 };
00118 
00119    snmp_varlist_add_variable(&var_list, 
00120       snmptrap_oid,
00121       OID_LENGTH(snmptrap_oid), 
00122       ASN_OBJECT_ID,
00123       (u_char *)openserMsgQueueDepthMajorEvent_oid,
00124       (int)sizeof(openserMsgQueueDepthMajorEvent_oid));
00125    
00126    snmp_varlist_add_variable(&var_list, 
00127          openserMsgQueueDepth_oid,
00128          OID_LENGTH(openserMsgQueueDepth_oid),
00129          ASN_GAUGE,
00130          (u_char *)&msgQueueDepth, 
00131          sizeof(msgQueueDepth));
00132 
00133    snmp_varlist_add_variable(&var_list,
00134          openserMsgQueueMajorThreshold_oid,
00135          OID_LENGTH(openserMsgQueueMajorThreshold_oid),
00136          ASN_INTEGER,
00137          (u_char *)&majorThreshold,
00138          sizeof(majorThreshold));
00139 
00140    send_v2trap( var_list );
00141    snmp_free_varbind( var_list );
00142 
00143    return SNMP_ERR_NOERROR;
00144 }
00145 
00146 
00147 /*
00148  * Sends off an openserDialogLimitMinorEvent trap to the master agent,
00149  * assigning the following variable bindings:
00150  *
00151  *  - openserCurNumDialogs             = numDialogs
00152  *  - openserDialogLimitMinorThreshold = threshold
00153  *
00154  */
00155 int send_openserDialogLimitMinorEvent_trap(int numDialogs, int threshold)
00156 {
00157    netsnmp_variable_list  *var_list = NULL;
00158 
00159    oid openserDialogLimitMinorEvent_oid[]    = { 
00160       OPENSER_OID,3,1,3,2,0,3 };
00161    
00162    oid openserCurNumDialogs_oid[]            = { 
00163       OPENSER_OID,3,1,3,1,3,2,1, 0 };
00164    
00165    oid openserDialogLimitMinorThreshold_oid[] = { 
00166       OPENSER_OID,3,1,3,1,3,2,5, 0 };
00167 
00168    snmp_varlist_add_variable(&var_list,
00169       snmptrap_oid,
00170       OID_LENGTH(snmptrap_oid), 
00171       ASN_OBJECT_ID,
00172       (u_char *)openserDialogLimitMinorEvent_oid,
00173       (int)sizeof(openserDialogLimitMinorEvent_oid));
00174    
00175    snmp_varlist_add_variable(&var_list,
00176       openserCurNumDialogs_oid, 
00177       OID_LENGTH(openserCurNumDialogs_oid),
00178       ASN_GAUGE,
00179       (u_char *)&numDialogs,
00180       sizeof(numDialogs));
00181 
00182    snmp_varlist_add_variable(&var_list,
00183       openserDialogLimitMinorThreshold_oid, 
00184       OID_LENGTH(openserDialogLimitMinorThreshold_oid),
00185       ASN_INTEGER,
00186       (u_char *)&threshold,
00187       sizeof(threshold));
00188 
00189    send_v2trap( var_list );
00190    snmp_free_varbind( var_list );
00191 
00192    return SNMP_ERR_NOERROR;
00193 }
00194 
00195 
00196 /*
00197  * Sends off an openserDialogLimitMinorEvent trap to the master agent,
00198  * assigning the following variable bindings:
00199  *
00200  *  - openserCurNumDialogs             = numDialogs
00201  *  - openserDialogLimitMinorThreshold = threshold
00202  *
00203  */
00204 int send_openserDialogLimitMajorEvent_trap(int numDialogs, int threshold)
00205 {
00206    netsnmp_variable_list  *var_list = NULL;
00207 
00208    oid openserDialogLimitMajorEvent_oid[]     = { 
00209       OPENSER_OID,3,1,3,2,0,4 };
00210 
00211    oid openserCurNumDialogs_oid[]             = { 
00212       OPENSER_OID,3,1,3,1,3,2,1, 0 };
00213 
00214    oid openserDialogLimitMajorThreshold_oid[] = { 
00215       OPENSER_OID,3,1,3,1,3,2,6, 0 };
00216 
00217    snmp_varlist_add_variable(&var_list,
00218       snmptrap_oid, 
00219       OID_LENGTH(snmptrap_oid),
00220       ASN_OBJECT_ID,
00221       (u_char *)openserDialogLimitMajorEvent_oid, 
00222       (int)sizeof(openserDialogLimitMajorEvent_oid));
00223    
00224    snmp_varlist_add_variable(&var_list,
00225       openserCurNumDialogs_oid, 
00226       OID_LENGTH(openserCurNumDialogs_oid),
00227       ASN_GAUGE,
00228       (u_char *)&numDialogs,
00229       sizeof(numDialogs));
00230 
00231    snmp_varlist_add_variable(&var_list,
00232       openserDialogLimitMajorThreshold_oid, 
00233       OID_LENGTH(openserDialogLimitMajorThreshold_oid),
00234       ASN_INTEGER,
00235       (u_char *)&threshold,
00236       sizeof(threshold));
00237 
00238    send_v2trap( var_list );
00239    snmp_free_varbind( var_list );
00240 
00241    return SNMP_ERR_NOERROR;
00242 }

Generated on Wed May 23 20:00:28 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6