Get necessary data v.2

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
eFusion
Posts: 33
Joined: Wed Jan 29, 2014 9:52 am

Get necessary data v.2

Post by eFusion »

It's me again :D
I identified that in nagios logs contains data from one day but i need the data for such month for e.g. when we clik on link "View Trends For This Host" in Nagios UI and select period - created a graph with data of the period which we chosen.
I need exactly this data.
Where Nagios save their except in log file? How to get data for the year ir month?

Thanks in advance.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Get necessary data v.2

Post by tmcdonald »

If you know the UNIX timestamp of the range you want, you can do something like the following:

Code: Select all

http://<nagios ip>/nagios/cgi-bin/trends.cgi?t1=1391024861&t2=1391111261&host=localhost&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedservicestate=0&initialassumedhoststate=0&backtrack=4&zoom=4
where t1 is the start time and t2 is the end time.
Former Nagios employee
eFusion
Posts: 33
Joined: Wed Jan 29, 2014 9:52 am

Re: Get necessary data v.2

Post by eFusion »

I need to do this with php and run by cron on FreeBSD.
Do you have any ideas where Nagios stores data to output in Trends?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Get necessary data v.2

Post by sreinhardt »

The data for trends are taken from the active and archived log files, and are just processed in a different way from the avail.cgi. When trends is called, it the data is always pulled from these logs and filtered for what nagios needs.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
eFusion
Posts: 33
Joined: Wed Jan 29, 2014 9:52 am

Re: Get necessary data v.2

Post by eFusion »

Thanks a lot. Went to try
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Get necessary data v.2

Post by tmcdonald »

We'll stick around here in case you need help with it.
Former Nagios employee
eFusion
Posts: 33
Joined: Wed Jan 29, 2014 9:52 am

Re: Get necessary data v.2

Post by eFusion »

Can be closed.
Understood.
I use ndoutils for my task.
Thank you all!
Locked