show metrics from file on Nagios and Nagios Grapher

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
kucharst
Posts: 1
Joined: Tue Apr 28, 2015 8:25 am

show metrics from file on Nagios and Nagios Grapher

Post by kucharst »

Hello,
I have a very simple process to be done.
We have plenty of Centos servers that are currently monitored by Nagios. Need to monitor one more metric.
Each of them has a script that creates the TXT file like bellow:
20190731 16:17: 15241 , OK: AD XXX user available
20190731 20:17: 14912 , OK: AD XXX user available
20190801 00:17: 14842 , OK: AD XXX user available
20190801 04:17: 14701 , OK: AD XXX user available
20190801 08:17: 14631 , OK: AD XXX user available
20190801 12:17: 14575 , OK: AD XXX user available

I need to take the date/time and those numbers marked red, show it in Nagios and put to the nagios grapher to show how it floats/peaks.
I already have check_log on each server but no idea how to use it and if its suitable for my needs.
Would be also nice to set some treashold.
Can i ask you for some hint?
More detailed more appreciated :)

Thanks in Advance
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: show metrics from file on Nagios and Nagios Grapher

Post by ssax »

Are you just trying to graph the last value every time it's polled?

Like this:

20190731 16:17: 15241 , OK: AD XXX user available
20190731 20:17: 14912 , OK: AD XXX user available
20190801 00:17: 14842 , OK: AD XXX user available
20190801 04:17: 14701 , OK: AD XXX user available
20190801 08:17: 14631 , OK: AD XXX user available
20190801 12:17: 14575 , OK: AD XXX user available

If not, please explain in further detail.

Code: Select all

tail -n1 FILE | awk '{print $3}'

Code: Select all

[root@xid ~]# echo '20190801 12:17: 14575 , OK: AD XXX user available' | awk '{print $3}'
14575
Locked