]> git.pld-linux.org Git - packages/apinger.git/blame - apinger-status.patch
- disable parallel build
[packages/apinger.git] / apinger-status.patch
CommitLineData
55699395
MK
1diff -ur apinger-0.6.1.orig//src/apinger.c apinger-0.6.1/src/apinger.c
2--- apinger-0.6.1.orig//src/apinger.c 2012-07-26 11:10:07.608188198 +0000
212ccbd6 3+++ apinger-0.6.1/src/apinger.c 2012-07-26 11:48:46.179125555 +0000
55699395
MK
4@@ -824,26 +824,49 @@
5 return;
6 }
7 tm=time(NULL);
8- fprintf(f,"%s\n",ctime(&tm));
9+ if(!config->status_format) fprintf(f,"%s\n",ctime(&tm));
10 for(t=targets;t;t=t->next){
11- fprintf(f,"Target: %s\n",t->name);
1bbd4703 12- fprintf(f,"Source: %s\n",t->config->srcip);
55699395
MK
13- fprintf(f,"Description: %s\n",t->description);
14- fprintf(f,"Last reply received: #%i %s",t->last_received,
15- ctime(&t->last_received_tv.tv_sec));
16- fprintf(f,"Average delay: %0.3fms\n",AVG_DELAY(t));
17+ if(config->status_format){
18+ fprintf(f,"%s|%s|%s|%i|%i|%u|",t->name, t->config->srcip, t->description, t->last_sent+1,
19+ t->received, t->last_received_tv.tv_sec);
20+ fprintf(f,"%0.3fms|", AVG_DELAY(t));
21+ }
22+ else{
23+ fprintf(f,"Target: %s\n",t->name);
1bbd4703 24+ fprintf(f,"Source: %s\n",t->config->srcip);
55699395
MK
25+ fprintf(f,"Description: %s\n",t->description);
26+ fprintf(f,"Last reply received: #%i %s",t->last_received,
27+ ctime(&t->last_received_tv.tv_sec));
28+ fprintf(f,"Average delay: %0.3fms\n",AVG_DELAY(t));
29+ }
30 if (AVG_LOSS_KNOWN(t)){
31- fprintf(f,"Average packet loss: %0.1f%%\n",AVG_LOSS(t));
32+ if(config->status_format){
33+ fprintf(f,"%0.1f%%",AVG_LOSS(t));
34+ }
35+ else{
36+ fprintf(f,"Average packet loss: %0.1f%%\n",AVG_LOSS(t));
37+ }
38+ }
39+ if(config->status_format){
40+ fprintf(f, "|");
41+ }
42+ else{
212ccbd6 43+ fprintf(f,"Active alarms: ");
55699395
MK
44 }
45- fprintf(f,"Active alarms:");
46 if (t->active_alarms){
47 for(al=t->active_alarms;al;al=al->next){
48 a=al->alarm;
49- fprintf(f," \"%s\"",a->name);
50+ if(config->status_format){
51+ fprintf(f,"%s",a->name);
52+ }
53+ else{
54+ fprintf(f," \"%s\"",a->name);
55+ }
56 }
57- fprintf(f,"\n");
58+ if(!config->status_format) fprintf(f,"\n");
59 }
60- else fprintf(f," None\n");
212ccbd6 61+ else fprintf(f,"none");
55699395
MK
62+ if(!config->status_format) fprintf(f,"\n");
63
64 buf1=NEW(char,t->config->avg_loss_delay_samples+1);
65 buf2=NEW(char,t->config->avg_loss_samples+1);
66diff -ur apinger-0.6.1.orig//src/apinger.conf apinger-0.6.1/src/apinger.conf
67--- apinger-0.6.1.orig//src/apinger.conf 2012-07-26 11:24:35.000000000 +0000
68+++ apinger-0.6.1/src/apinger.conf 2012-07-26 11:30:33.352064094 +0000
69@@ -30,6 +30,10 @@
70 # ## Interval between file updates
71 # ## when 0 or not set, file is written only when SIGUSR1 is received
72 # interval 5m
73+#
74+# ## Create status file in script parseable format (on) or human
75+# ## readable format (off)
76+# scriptformat off
77 #}
78
79 ########################################
80diff -ur apinger-0.6.1.orig//src/cfgparser1.y apinger-0.6.1/src/cfgparser1.y
81--- apinger-0.6.1.orig//src/cfgparser1.y 2012-07-26 10:15:23.000000000 +0000
82+++ apinger-0.6.1/src/cfgparser1.y 2012-07-26 10:35:18.153063319 +0000
83@@ -105,6 +105,7 @@
84 %token AVG_LOSS_DELAY_SAMPLES
85
86 %token FILE_
87+%token SCRIPTFORMAT
88
89 %token ERROR
90
91@@ -283,6 +284,8 @@
92 { cur_config.status_interval=$2; }
93 | INTERVAL TIME
94 { cur_config.status_interval=$2; }
95+ | SCRIPTFORMAT boolean
96+ { cur_config.status_format=$2; }
97 | statuscfg separator statuscfg
98 ;
99
100diff -ur apinger-0.6.1.orig//src/cfgparser2.l apinger-0.6.1/src/cfgparser2.l
101--- apinger-0.6.1.orig//src/cfgparser2.l 2012-07-26 10:15:23.000000000 +0000
102+++ apinger-0.6.1/src/cfgparser2.l 2012-07-26 10:31:46.408063728 +0000
103@@ -86,6 +86,7 @@
104 down { LOC; LOCINC; return DOWN; }
105 false { LOC; LOCINC; return FALSE; }
106 file { LOC; LOCINC; return FILE_; }
107+scriptformat { LOC; LOCINC; return SCRIPTFORMAT; }
108 group { LOC; LOCINC; return GROUP; }
109 interval { LOC; LOCINC; return INTERVAL; }
110 loss { LOC; LOCINC; return LOSS; }
111diff -ur apinger-0.6.1.orig//src/conf.h apinger-0.6.1/src/conf.h
112--- apinger-0.6.1.orig//src/conf.h 2012-07-26 10:15:23.000000000 +0000
113+++ apinger-0.6.1/src/conf.h 2012-07-26 10:33:09.770251230 +0000
114@@ -98,6 +98,7 @@
115 char *pid_file;
116 char *status_file;
117 int status_interval;
118+ int status_format;
119 char *timestamp_format;
120 };
121
122diff -ur apinger-0.6.1.orig//src/main.c apinger-0.6.1/src/main.c
123--- apinger-0.6.1.orig//src/main.c 2012-07-26 10:15:23.000000000 +0000
124+++ apinger-0.6.1/src/main.c 2012-07-26 11:13:52.643188408 +0000
125@@ -89,6 +89,7 @@
126 "/var/run/apinger.pid", /* pid file */
127 NULL, /* status file */
128 0, /* status interval */
129+ 0, /* status format */
130 "%b %d %H:%M:%S" /* timestamp format */
131 };
132
This page took 0.087274 seconds and 4 git commands to generate.