Changeset 286:b16158030def for uwsgi.c

Show
Ignore:
Timestamp:
03/11/10 18:24:37 (5 months ago)
Author:
roberto@…
Branch:
default
Message:

almost ready SNMP support

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • uwsgi.c

    r285 r286  
    597597                {"limit-as", required_argument, 0, LONG_ARGS_LIMIT_AS}, 
    598598                {"udp", required_argument, 0, LONG_ARGS_UDP}, 
    599                 {"snmp", no_argument, &uwsgi.snmp, 1}, 
     599                {"snmp", optional_argument, 0, LONG_ARGS_SNMP}, 
    600600                {"check-interval", required_argument, 0, LONG_ARGS_CHECK_INTERVAL}, 
    601601                {"erlang", required_argument, 0, LONG_ARGS_ERLANG}, 
     
    11671167#endif 
    11681168 
     1169#ifdef UWSGI_SNMP 
     1170        if (uwsgi.snmp) { 
     1171                snmp_init(); 
     1172        } 
     1173#endif 
    11691174 
    11701175 
     
    13171322                        } 
    13181323                } 
     1324#ifdef UWSGI_SNMP 
     1325                if (uwsgi.snmp) { 
     1326                        if (uwsgi.snmp_community) { 
     1327                                if (strlen(uwsgi.snmp_community) > 72) { 
     1328                                        fprintf(stderr, "*** warning the supplied SNMP community string will be truncated to 72 chars ***\n"); 
     1329                                        memcpy(uwsgi.shared->snmp_community, uwsgi.snmp_community, 72); 
     1330                                } 
     1331                                else { 
     1332                                        strcpy(uwsgi.shared->snmp_community, uwsgi.snmp_community); 
     1333                                } 
     1334                        } 
     1335                        fprintf(stderr, "filling SNMP table..."); 
     1336 
     1337                        uwsgi.shared->snmp_gvalue[0].type = SNMP_COUNTER64; 
     1338                        uwsgi.shared->snmp_gvalue[0].val = &uwsgi.workers[0].requests; 
     1339 
     1340                        fprintf(stderr, "done\n"); 
     1341 
     1342                } 
     1343#endif 
    13191344                for (;;) { 
    13201345                        if (ready_to_die >= uwsgi.numproc && uwsgi.to_hell) { 
     
    25102535                fprintf(stdout, "uWSGI %s\n", UWSGI_VERSION); 
    25112536                exit(0); 
     2537        case LONG_ARGS_SNMP: 
     2538                uwsgi.snmp = 1; 
     2539                if (optarg) { 
     2540                        uwsgi.snmp_community = optarg; 
     2541                } 
     2542                break; 
    25122543        case LONG_ARGS_PIDFILE: 
    25132544                uwsgi.pidfile = optarg;