Munin output in json, not in graphs

I want to use munin to collect system statistics and store them in a database. But I could not find a way to get the raw statistics that Munin collects. Is there any way to get this raw data collected by munin and with which it creates a graph?

+4
source share
3 answers

Another possibility is to access historical data using the rrdtool , for example. using something like rrdtool fetch /var/munin/{domain}/{something}.rrd AVERAGE (this is the path to the data files on FreeBSD systems, on Linux it can be / var / lib / munin or so).

+1
source

You can export munin data (or rather, the underlying rrdtool) in xml format using

 rrdtool xport \ --start now-1h --end now \ DEF:xx=host-inout.lo.rrd:output:AVERAGE \ DEF:yy=host-inout.lo.rrd:input:AVERAGE \ CDEF:aa=xx,yy,+,8,* \ XPORT:xx:"out bytes" \ XPORT:aa:"in and out bits" 

The resulting metadata section (values ​​will depend on the characteristics of the RRD):

 <meta> <start>1020611700</start> <step>300</step> <end>1020615600</end> <rows>14</rows> <columns>2</columns> <legend> <entry>out bytes</entry> <entry>in and out bits</entry> </legend> 

The resulting data section:

 <data> <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row> <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row> <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row> <row><t>1020615600</t><v>NaN</v><v>NaN</v></row> 

I use xml export to create charts using JavaScript for my home temperature control at http://pi.tafkas.net/temperatures/

0
source

Munin relies on its plugins to collect statistics. Although plugins can be written in almost any language, most of them are scripts of some kind (shells, Perl, Python, etc.). Take a look at each plugin (which you want to use) to see how the data is collected. You should be able to write your own and cron (as munin does) so that it grabs the metric every 5 minutes (or whatever you want).

You probably need to write additional scripts to aggregate the data when you draw some of the larger data sets (for example, a graph of data for the whole year). This and / or scripts to get rid of data after a certain period of time.

-1
source

Source: https://habr.com/ru/post/1486958/


All Articles