1

Is there any way to check for how long the NAGIOS TOOL runs? I mean when the tool started running and the time up till now.

Nagios is running in a remote machine, in which I have access (through ssh). I have both credentials for accessing the machine and credentials just to see the Stats from Nagios on this machine

I tried System->Process Info, but I do not have privileges to view such information.

Is there any other way, through terminal?

Mary T.
  • 11
  • 2

2 Answers2

2

You can use nagiostats to check the uptime of a Nagios instance. See: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/nagiostats.html

[nagios@lanman ~]# /usr/local/nagios/bin/nagiostats -c /usr/local/nagios/etc/nagios.cfg

Nagios Stats 3.0prealpha-05202006
Copyright (c) 2003-2007 Ethan Galstad (www.nagios.org)
Last Modified: 05-20-2006
License: GPL
CURRENT STATUS DATA
------------------------------------------------------
Status File:                            /usr/local/nagios/var/status.dat
Status File Age:                        0d 0h 0m 9s
Status File Version:                    3.0prealpha-05202006
Program Running Time:                   0d 5h 20m 39s      <------------
Nagios PID:                             10119
Used/High/Total Command Buffers:        0 / 0 / 64
Used/High/Total Check Result Buffers:   0 / 7 / 512
...
didymus
  • 250
  • 2
  • 9
0

Find the nagios.log file, it's likely in the var directory under the Nagios installation. Then..

grep "Nagios.*starting" nagios.log | tail -1

Grab the epoch time (first field), and convert it to local.

date -d @1580045430

Sun Jan 26 07:30:30 CST 2020

All in one, assuming the nagios.log is in the current directory.

date -d @$(grep "Nagios.*starting" nagios.log | tail -1 | awk '{print $1}' | sed 's/\[//;' | sed 's/\]//;')

Sun Jan 26 07:30:30 CST 2020

Adam vonNieda
  • 1,635
  • 2
  • 14
  • 22