]> granicus.if.org Git - sysstat/commitdiff
SVG: Add SVG output for ICMP network errors statistics
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 11 Jun 2016 12:11:00 +0000 (14:11 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 11 Jun 2016 12:11:00 +0000 (14:11 +0200)
These graphs correspond to the output of "sar -n EICMP6".

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
svg_stats.c
svg_stats.h

index 56f03951dd6184ad2df97998ab45bef18fd86f23..881ed3ee1ee6a1d096a6b112e19a71296d134002 100644 (file)
@@ -1011,10 +1011,11 @@ struct activity net_eicmp6_act = {
        .f_render       = render_net_eicmp6_stats,
        .f_xml_print    = xml_print_net_eicmp6_stats,
        .f_json_print   = json_print_net_eicmp6_stats,
+       .f_svg_print    = svg_print_net_eicmp6_stats,
        .hdr_line       = "ierr6/s;idtunr6/s;odtunr6/s;itmex6/s;otmex6/s;"
                          "iprmpb6/s;oprmpb6/s;iredir6/s;oredir6/s;ipck2b6/s;opck2b6/s",
        .name           = "A_NET_EICMP6",
-       .g_nr           = 0,
+       .g_nr           = 6,
 #endif
        .nr             = 1,
        .nr2            = 1,
index a6ec71480f1eb8971f589a2337acf482efed4dcc..6f2976d1b2dab1b3a4064d0d8aa590ce01769d56 100644 (file)
@@ -3065,6 +3065,110 @@ __print_funct_t svg_print_net_icmp6_stats(struct activity *a, int curr, int acti
        }
 }
 
+/*
+ ***************************************************************************
+ * Display ICMPv6 network errors statistics in SVG.
+ *
+ * IN:
+ * @a          Activity structure with statistics.
+ * @curr       Index in array for current sample statistics.
+ * @action     Action expected from current function.
+ * @svg_p      SVG specific parameters: Current graph number (.@graph_no),
+ *             flag indicating that a restart record has been previously
+ *             found (.@restart) and time used for the X axis origin
+ *             (@ust_time_ref).
+ * @itv                Interval of time in jiffies (only with F_MAIN action).
+ * @record_hdr Pointer on record header of current stats sample.
+ ***************************************************************************
+ */
+__print_funct_t svg_print_net_eicmp6_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
+                                          unsigned long long itv, struct record_header *record_hdr)
+{
+       struct stats_net_eicmp6
+               *sneic = (struct stats_net_eicmp6 *) a->buf[curr],
+               *sneip = (struct stats_net_eicmp6 *) a->buf[!curr];
+       int group[] = {1, 2, 2, 2, 2, 2};
+       char *title[] = {"ICMPv6 network errors statistics (1)", "ICMPv6 network errors statistics (2)",
+                        "ICMPv6 network errors statistics (3)", "ICMPv6 network errors statistics (4)",
+                        "ICMPv6 network errors statistics (5)", "ICMPv6 network errors statistics (6)"};
+       char *g_title[] = {"ierr6/s",
+                          "idtunr6/s", "odtunr6/s",
+                          "itmex6/s", "otmex6/s",
+                          "iprmpb6/s", "oprmpb6/s",
+                          "iredir6/s", "oredir6/s",
+                          "ipck2b6/s", "opck2b6/s"};
+       static double *spmin, *spmax;
+       static char **out;
+       static int *outsize;
+
+       if (action & F_BEGIN) {
+               /*
+                * Allocate arrays that will contain the graphs data
+                * and the min/max values.
+                */
+               out = allocate_graph_lines(11, &outsize, &spmin, &spmax);
+       }
+
+       if (action & F_MAIN) {
+               /* Check for min/max values */
+               save_extrema(0, 11, 0, (void *) a->buf[curr], (void *) a->buf[!curr],
+                            itv, spmin, spmax);
+
+               /* ierr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
+                        out, outsize, svg_p->restart);
+               /* idtunr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
+                        out + 1, outsize + 1, svg_p->restart);
+               /* odtunr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
+                        out + 2, outsize + 2, svg_p->restart);
+               /* itmex6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InTimeExcds6, sneic->InTimeExcds6, itv),
+                        out + 3, outsize + 3, svg_p->restart);
+               /* otmex6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->OutTimeExcds6, sneic->OutTimeExcds6, itv),
+                        out + 4, outsize + 4, svg_p->restart);
+               /* iprmpb6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InParmProblems6, sneic->InParmProblems6, itv),
+                        out + 5, outsize + 5, svg_p->restart);
+               /* oprmpb6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->OutParmProblems6, sneic->OutParmProblems6, itv),
+                        out + 6, outsize + 6, svg_p->restart);
+               /* iredir6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InRedirects6, sneic->InRedirects6, itv),
+                        out + 7, outsize + 7, svg_p->restart);
+               /* oredir6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->OutRedirects6, sneic->OutRedirects6, itv),
+                        out + 8, outsize + 8, svg_p->restart);
+               /* ipck2b6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->InPktTooBigs6, sneic->InPktTooBigs6, itv),
+                        out + 9, outsize + 9, svg_p->restart);
+               /* opck2b6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(sneip->OutPktTooBigs6, sneic->OutPktTooBigs6, itv),
+                        out + 10, outsize + 10, svg_p->restart);
+       }
+
+       if (action & F_END) {
+               draw_activity_graphs(a->g_nr, SVG_LINE_GRAPH, title, g_title, NULL, group,
+                                    spmin, spmax, out, outsize, svg_p, record_hdr);
+
+               /* Free remaining structures */
+               free_graphs(out, outsize, spmin, spmax);
+       }
+}
+
 /*
  ***************************************************************************
  * Display UDPv6 network statistics in SVG.
index 9b1e14f49ff80b15c283e58cadcf9c5f55df11cd..b04fd2140452f6601ff426839fb2398004fdb7ce 100644 (file)
@@ -77,6 +77,9 @@ __print_funct_t svg_print_net_eip6_stats
 __print_funct_t svg_print_net_icmp6_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);
+__print_funct_t svg_print_net_eicmp6_stats
+       (struct activity *, int, int, struct svg_parm *, unsigned long long,
+        struct record_header *);
 __print_funct_t svg_print_net_udp6_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);