/usr/share/doc/cockpit/guide/cockpit-metrics.html is in cockpit-doc 164-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cockpit.js: Metrics</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="Cockpit Guide">
<link rel="up" href="api-base1.html" title="API: base1">
<link rel="prev" href="cockpit-spawn.html" title="cockpit.js: Spawning Processes">
<link rel="next" href="cockpit-series-data.html" title="cockpit.js: Series Data">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="cockpit-spawn.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="api-base1.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cockpit Guide</th>
<td><a accesskey="n" href="cockpit-series-data.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="cockpit-metrics"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>cockpit.js: Metrics</h2>
<p>cockpit.js: Metrics — Reading and streaming metric data</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<p>Metrics about the system can be retrieved from several sources using
<a class="link" href="cockpit-metrics.html" title="cockpit.js: Metrics"><code class="code">cockpit.metrics()</code></a> metrics channels.
The metrics are made available as series data, and can be used with the
<a class="link" href="cockpit-series-data.html#cockpit-series" title="cockpit.series()"><code class="code">cockpit.series()</code></a> and
<a class="link" href="cockpit-series-data.html#cockpit-grid" title="cockpit.grid()"><code class="code">cockpit.grid()</code></a> facilities.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-function"></a><h2>cockpit.metrics()</h2>
<pre class="programlisting">
metrics = cockpit.metrics(interval, options, cache)
</pre>
<p>Opens a new metrics channel. The data retrieved will be available in the
<a class="link" href="cockpit-metrics.html#cockpit-metrics-series" title="metrics.series"><code class="code">metrics.series</code></a> series sink, and can
be used together with <a class="link" href="cockpit-series-data.html#cockpit-grid" title="cockpit.grid()"><code class="code">cockpit.grid()</code></a> objects.</p>
<p>The <code class="code">interval</code> is in milliseconds, and is the granularity of the series data
retrieved. Any grids consuming the data must have the same interval.</p>
<p>The <code class="code">cache</code> argument is a cache identifier. If
specified, then this metrics channel will share data with other
metrics channels of the same identifier. Make sure to use a
globally unique string.</p>
<p>The <code class="code">options</code> argument is either a javascript
plain object, or an array of those. Each object can have the
following fields.</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="code">"metrics"</code></span></p></td>
<td><p>An array of full metric descriptions, as
javascript objects. The specifics of these, and how to
determine which ones to use, can unfortunately only be found
in the low-level protocol documentation. This option is
required.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">"source"</code></span></p></td>
<td><p>The source to use for real-time data. This
is used by the <code class="code">follow</code> method, see below. Set
to <code class="code">"internal"</code> to retrieve internal metrics read
by the bridge. If set to <code class="code">"direct"</code> or
<code class="code">"pmcd"</code> then data will be retrieved from <a class="ulink" href="http://pcp.io" target="_top">PCP</a>if it is available. The
default is <code class="code">"internal"</code>.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="code">"archive_source"</code></span></p></td>
<td><p>The source to use for retrieving historical
data. This is used by the <code class="code">fetch</code> method, see
below. Set to <code class="code">"pcp-archive"</code> to retrieve data
from PCP archives. The default is not to try to retrieve
historical data.</p></td>
</tr>
</tbody>
</table></div>
<p>When the <code class="code">options</code> argument is an array of
javascript objects, then the metrics channel tries to use them in
order until one succeeds. This way, you can prefer PCP as the
source but fall back to internal metrics when PCP is not
available, for example. The channel gives no indication which
of the options has been used, and <code class="code">fetch</code> and
<code class="code">follow</code> might use different entries from the
list.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-fetch"></a><h2>metrics.fetch()</h2>
<pre class="programlisting">
metrics.fetch(beg, end)
</pre>
<p>Retrieve archived metrics data between <code class="code">beg</code> and <code class="code">end</code>. The
arguments can either be numbers, in which case they are interval based offsets, or they
can be javascript Date objects.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-follow"></a><h2>metrics.follow()</h2>
<pre class="programlisting">
metrics.follow()
</pre>
<p>Start retrieving live metrics data as it become available.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-close"></a><h2>metrics.close()</h2>
<pre class="programlisting">
metrics.close()
</pre>
<p>Stop the retrieval of metrics and release resources.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-series"></a><h2>metrics.series</h2>
<p>The series sink where data retrieved data will be processed.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-meta"></a><h2>metrics.meta</h2>
<p>The metrics meta data last received.</p>
</div>
<div class="refsection">
<a name="cockpit-metrics-onchanged"></a><h2>metrics.onchanged</h2>
<pre class="programlisting">
metrics.onchanged = function() { }
</pre>
<p>An event triggered when one of the properties on this metrics object changes.</p>
</div>
</div>
<div class="footer"><hr></div>
</body>
</html>
|