mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.

Home Page:https://www.monitorix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How data for process can be get as raw?

doguz2509 opened this issue · comments

I'm using process.pm mostly
Within monitorix.conf I defined several processes of my product
But I cannot catch how to relate raw data from the rrdtool dump or fetch with real process names
Can you assist, please?

.rrd files doesn't save strings or names, they only saves values. The only way to relate these values to your defined process names in your configuration file is by position.

You first need to know the order in which the 11 values for each process name are saved in the process.rrd file:

Monitorix/lib/process.pm

Lines 264 to 279 in ff149f7

for($n = 0; $n < keys(%{$process->{list}}); $n++) {
my $n2;
for($n2 = 0; $n2 < 10; $n2++) {
push(@tmp, "DS:proc" . $n . "_cpu" . $n2 . ":GAUGE:120:0:100");
push(@tmp, "DS:proc" . $n . "_mem" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_dsk" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_net" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_nof" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_pro" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_nth" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_vcs" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_ics" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_upt" . $n2 . ":GAUGE:120:0:U");
push(@tmp, "DS:proc" . $n . "_va2" . $n2 . ":GAUGE:120:0:U");
}
}

Now you can see that they are sorted as:

cpu, mem, dsk, net, nof, pro, nth, vcs, ics, upt, va2 for the fist defined process.
cpu, mem, dsk, net, nof, pro, nth, vcs, ics, upt, va2 for the second defined process.
cpu, mem, dsk, net, nof, pro, nth, vcs, ics, upt, va2 for the third defined process.
...
cpu, mem, dsk, net, nof, pro, nth, vcs, ics, upt, va2 for the tenth defined process.

With this information you can now get some values (e.g: the last minute) from the process.rrd:

$ rrdtool fetch /var/lib/monitorix/process.rrd  AVERAGE -s -1min
                     proc0_cpu0          proc0_mem0          proc0_dsk0          proc0_net0          proc0_nof0          proc0_pro0          proc0_nth0          proc0_vcs0          proc0_ics0          proc0_upt0          proc0_va20          proc0_cpu1          proc0_mem1          proc0_dsk1          proc0_net1          proc0_nof1          proc0_pro1          proc0_nth1          proc0_vcs1          proc0_ics1          proc0_upt1          proc0_va21          proc0_cpu2          proc0_mem2          proc0_dsk2          proc0_net2          proc0_nof2          proc0_pro2          proc0_nth2          proc0_vcs2          proc0_ics2          proc0_upt2          proc0_va22          proc0_cpu3          proc0_mem3          proc0_dsk3          proc0_net3          proc0_nof3          proc0_pro3          proc0_nth3          proc0_vcs3          proc0_ics3          proc0_upt3          proc0_va23          proc0_cpu4          proc0_mem4          proc0_dsk4          proc0_net4          proc0_nof4          proc0_pro4          proc0_nth4          proc0_vcs4          proc0_ics4          proc0_upt4          proc0_va24          proc0_cpu5          proc0_mem5          proc0_dsk5          proc0_net5          proc0_nof5          proc0_pro5          proc0_nth5          proc0_vcs5          proc0_ics5          proc0_upt5          proc0_va25          proc0_cpu6          proc0_mem6          proc0_dsk6          proc0_net6          proc0_nof6          proc0_pro6          proc0_nth6          proc0_vcs6          proc0_ics6          proc0_upt6          proc0_va26          proc0_cpu7          proc0_mem7          proc0_dsk7          proc0_net7          proc0_nof7          proc0_pro7          proc0_nth7          proc0_vcs7          proc0_ics7          proc0_upt7          proc0_va27          proc0_cpu8          proc0_mem8          proc0_dsk8          proc0_net8          proc0_nof8          proc0_pro8          proc0_nth8          proc0_vcs8          proc0_ics8          proc0_upt8          proc0_va28          proc0_cpu9          proc0_mem9          proc0_dsk9          proc0_net9          proc0_nof9          proc0_pro9          proc0_nth9          proc0_vcs9          proc0_ics9          proc0_upt9          proc0_va29

1675241880: 1.6898171506e-02 1.4921728000e+07 0.0000000000e+00 0.0000000000e+00 1.4000000000e+01 1.0000000000e+00 4.0000000000e+00 0.0000000000e+00 0.0000000000e+00 2.7571890903e+06 0.0000000000e+00 9.3114399734e-04 2.3490560000e+07 0.0000000000e+00 8.9049938523e+02 3.7000000000e+01 4.0000000000e+00 0.0000000000e+00 3.7250613406e-01 0.0000000000e+00 2.7571870303e+06 0.0000000000e+00 1.1828720054e-01 8.0568320000e+06 0.0000000000e+00 1.3135506789e+03 1.5000000000e+01 1.0000000000e+00 3.0000000000e+00 4.9870402202e+00 1.6811711398e-02 2.7571637203e+06 0.0000000000e+00 0.0000000000e+00 4.7267840000e+06 0.0000000000e+00 5.4473476592e+00 1.1000000000e+01 2.0000000000e+00 0.0000000000e+00 2.0175361701e-01 0.0000000000e+00 2.7571887603e+06 0.0000000000e+00 1.8619026790e-01 3.6700160000e+07 3.9458015872e+04 0.0000000000e+00 6.0000000000e+00 1.0000000000e+00 0.0000000000e+00 2.0180780106e+00 1.7123474894e-02 2.7571862003e+06 0.0000000000e+00 3.1032973123e-03 3.4848768000e+07 0.0000000000e+00 4.1417792126e+00 6.0000000000e+00 1.0000000000e+00 0.0000000000e+00 2.4224926142e-02 0.0000000000e+00 2.3872670286e+04 0.0000000000e+00 2.0315170523e-02 2.1785395200e+08 6.8880849871e+01 1.0650493832e+00 2.0300000000e+02 1.2000000000e+01 0.0000000000e+00 1.1518649033e+00 0.0000000000e+00 1.9967051029e+05 0.0000000000e+00 0.0000000000e+00 1.6752640000e+06 0.0000000000e+00 0.0000000000e+00 8.0000000000e+00 1.0000000000e+00 0.0000000000e+00 1.7433314477e-02 0.0000000000e+00 2.7571953103e+06 0.0000000000e+00 1.0138902904e-01 1.4463385600e+08 0.0000000000e+00 4.3105949084e+02 4.2000000000e+01 2.0000000000e+00 1.8000000000e+01 1.6816583734e-02 0.0000000000e+00 2.7571886203e+06 0.0000000000e+00 3.1027814716e-04 4.1656320000e+07 4.8211727078e+02 0.0000000000e+00 6.6000000000e+01 1.1000000000e+01 0.0000000000e+00 3.5311323543e-01 0.0000000000e+00 3.2278050286e+04 0.0000000000e+00
1675241940: -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan

Since I have defined the process names in my configuration file as this:

<process>
        <list>
                0 = tuned, sshd, znc, sendmail, /usr/bin/monito, monitorix-httpd, httpd, chronyd, mysqld, tinyproxy
        </list>
</process>

then, I can see that the first 11 values are for the process name tuned: cpu, mem, dsk, net, nof, pro, nth, vcs, ics, upt and va2 respectively.

1.6898171506e-02 1.4921728000e+07 0.0000000000e+00 0.0000000000e+00 1.4000000000e+01 1.0000000000e+00 4.0000000000e+00 0.0000000000e+00 0.0000000000e+00 2.7571890903e+06 0.0000000000e+00

the second 11 values are for the process name sshd:

9.3114399734e-04 2.3490560000e+07 0.0000000000e+00 8.9049938523e+02 3.7000000000e+01 4.0000000000e+00 0.0000000000e+00 3.7250613406e-01 0.0000000000e+00 2.7571870303e+06 0.0000000000e+00

and so on ...

I hope this helped you.
Check here for more information on RRDtool fetch.

Thanks a lot!!!

Why are you reusing an closed issue for something that is completely different?

On Wed, 24 May 2023 at 8:39 Jordi Sanfeliu @.> wrote: Why are you reusing an issue that is completely different? — Reply to this email directly, view it on GitHub <#449 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASEIFPVEUXN725PBOPDPK3XHWNJFANCNFSM6AAAAAAUMOH3A4 . You are receiving this because you authored the thread.Message ID: @.>
Can you explain?-- Dmitry Oguz

Is your problem related in any way to the issue 'how data for process can be get as raw'?

Yes. Truly I’m using monitorix not in convenient wayI run it in very closed network without ability to access webI run monitirix command by external script and then download all artifact (png, rrd, html files) to some central storageDmitry OguzOn 24 May 2023, at 9:14, Jordi Sanfeliu @.> wrote: On Wed, 24 May 2023 at 8:39 Jordi Sanfeliu @.> wrote: Why are you reusing an issue that is completely different? — Reply to this email directly, view it on GitHub <#449 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASEIFPVEUXN725PBOPDPK3XHWNJFANCNFSM6AAAAAAUMOH3A4 . You are receiving this because you authored the thread.Message ID: @.> Can you explain?-- Dmitry Oguz Is your problem related in any way to the issue 'how data for process can be get as raw'? —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>

opening '/var/lib/monitorix/process.rrd': No such file or directory

Make sure the file does really exist and check file permissions in all the path: /var, lib/, monitorix/ and process.rrd.

I'm afraid I don't have enough information to help you. I don't even imagine how are you executing Monitorix, nor the contents of your configuration file, etc.

I've just executed /var/lib/monitorix/www/cgi/monitorix.cgi mode=localhost graph=all when=1day color=white and it works well here.

Please, paste here the contents of your file /var/lib/monitorix/www/cgi/monitorix.conf.path.