Changeset 962 for trunk/Monitoring


Ignore:
Timestamp:
11/04/13 15:39:39 (10 years ago)
Author:
jripsl
Message:
  • add sample config card file.
  • add stress test option.
Location:
trunk/Monitoring/CNClient
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Monitoring/CNClient/Makefile

    r942 r962  
    1 sendAMQPMsg: 
    2         #gcc -static -I/usr/local/include -L/usr/local/lib -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 
    3         gcc -static -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 
     1#all: clean 
     2#       sendAMQPMsg 
     3 
     4sendAMQPMsg: send_AMQP_msg.c 
     5        gcc -static -I/usr/local/include -L/usr/local/lib -Wall -o sendAMQPMsg send_AMQP_msg.c -lrabbitmq 
    46 
    57install: sendAMQPMsg 
    68        sudo cp sendAMQPMsg /usr/local/bin 
     9 
     10clean: sendAMQPMsg 
     11        rm -f sendAMQPMsg 
  • trunk/Monitoring/CNClient/send_AMQP_msg.c

    r866 r962  
    234234int main(int argc, char * const *argv) { 
    235235  char const *hostname; 
     236  int msg_count=1; 
    236237  int port; 
    237238  //char const *exchange; 
     
    242243  char *buf = NULL; 
    243244  int c; 
     245  int i; 
    244246  char *filepath = NULL; 
    245247  int file_flag=0; 
     
    252254  //parsing args 
    253255  opterr = 0; 
    254   while ((c = getopt (argc, argv, "b:ef:h:p:")) != -1) 
     256  while ((c = getopt (argc, argv, "b:ef:h:n:p:u")) != -1) 
    255257    switch (c) 
    256258      { 
     
    259261        break; 
    260262      case 'e': 
    261  
    262         fprintf(stderr, "Usage: amqp_producer host port\n"); 
    263  
    264263 
    265264        // --- example without config card --- 
     
    286285        hostname = optarg; 
    287286        break; 
     287      case 'n': 
     288        msg_count = atoi(optarg); 
     289        break; 
    288290      case 'p': 
    289291        port = atoi(optarg); 
    290292        break; 
     293      case 'u': 
     294        fprintf(stderr, "Usage: amqp_producer host port -b <body>\n"); 
     295        exit(EXIT_SUCCESS); 
    291296      case '?': 
    292297        fprintf (stderr, "ERR001: incorrect argument '-%c'.\n", optopt); 
     
    374379    props.content_type = amqp_cstring_bytes("text/plain"); 
    375380    props.delivery_mode = 2; /* persistent delivery mode */ 
    376     die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes("myexchange"), amqp_cstring_bytes(""), 0, 0, &props, amqp_cstring_bytes(body)), "Publishing"); 
     381 
     382 
     383    for (i = 0; i < msg_count; i++) 
     384      die_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes("myexchange"), amqp_cstring_bytes(""), 0, 0, &props, amqp_cstring_bytes(body)), "Publishing"); 
    377385  } 
    378386 
Note: See TracChangeset for help on using the changeset viewer.