Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration for timestamp of passive check #46

Open
PeterSpiegler opened this issue Aug 24, 2019 · 1 comment
Open

Configuration for timestamp of passive check #46

PeterSpiegler opened this issue Aug 24, 2019 · 1 comment

Comments

@PeterSpiegler
Copy link

I want import historical performance data with passive checks, example:
echo "[1566572900] PROCESS_SERVICE_CHECK_RESULT;host1;weather;0;OK|rainintensity=5.000mm/h">/opt/omd/sites/test/tmp/run/naemon.cmd
for time 23.08.2019 - 17:08:20

But in the nagflux database the entry has the actual time.
I assume the reason is the macro $TIMET$ in nagios_nagflux.cfg

etc/nagflux/nagios_nagflux.cfg: service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$

the resulting data is

var/pnp4nagios/service-perfdata: DATATYPE::SERVICEPERFDATA TIMET::1566639139 HOSTNAME::host1 SERVICEDESC::weather SERVICEPERFDATA::rainintensity=5.000mm/h SERVICECHECKCOMMAND::check_dummy HOSTSTATE::UP HOSTSTATETYPE::HARD SERVICESTATE::OK SERVICESTATETYPE::HARD
1566639139 was the actual time: 24.08.2019 - 11:32:19

How can the service_perfdata_file_template changed to use the provided timestamp of the passive service check?

I use the OMD-Labs 3.1.

@PeterSpiegler
Copy link
Author

In the https://www.naemon.org/documentation/usersguide/macrolist.html I found

$LASTSERVICECHECK$: This is a timestamp in time_t format (seconds since the UNIX epoch) indicating the time at which a check of the service was last performed.

/opt/omd/sites/test/etc/nagflux/nagios_nagflux.cfg I changed to:

service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$LASTSERVICECHECK$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
and now is service-perfdata correct and also the chart:

~$ echo "[1566573100] PROCESS_SERVICE_CHECK_RESULT;host1;weather;0;OK|temp=10degC">/opt/omd/sites/test/tmp/run/naemon.cmd
~$ cat var/pnp4nagios/service-perfdata
DATATYPE::SERVICEPERFDATA       TIMET::1566573100       HOSTNAME::host1 SERVICEDESC::weather    SERVICEPERFDATA::temp=10degC    SERVICECHECKCOMMAND::check_dummy        HOSTSTATE::UP   HOSTSTATETYPE::HARD     SERVICESTATE::OK        SERVICESTATETYPE::HARD

Is this modification secure without unexpected side effects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant