not getting any values from NTP script

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

not getting any values from NTP script

Post by nuzzy »

Hi all,

I've downloaded and imported the ntp script from the templates section. However I am getting the following output from the ntp.pl script:

Code: Select all

peer:U address:U stratum:U type:U when:U poll:U reach:U delay:U offset:U jitter:U
Any ideas how to fix this?

EDIT: I had an ignore value set in my ntp.conf. I removed it and it works now. However, I'm getting NaN values in my graphs. Testing the command from a cmd line gives me the values however.
Cacti 0.8.8a on CentOS
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Re: not getting any values from NTP script

Post by nuzzy »

bumping this up to hopefully get some help :)
Cacti 0.8.8a on CentOS
Edwin
Posts: 7
Joined: Fri Oct 31, 2003 3:33 pm
Location: Orlando, FL

Re: not getting any values from NTP script

Post by Edwin »

Did you try to run "ntpq -p"? Also check if the ntpd service is running "ps -edf".
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Re: not getting any values from NTP script

Post by nuzzy »

yes and I get values returned and the process is also running. Just nothing in my graphs.
Cacti 0.8.8a on CentOS
User avatar
iNeo
Posts: 35
Joined: Thu Nov 03, 2005 7:29 am

Re: not getting any values from NTP script

Post by iNeo »

Hi,

I have the same problem with the script. No output when running perl ntp.pl <hostname>.
When I run /usr/bin/ntpq -4 -p $host it does show output.

ntp.pl output:

Code: Select all

peer:U address:U stratum:U type:U when:U poll:U reach:U delay:U offset:U jitter:U
/usr/bin/ntpq -4 -p $host output: (ip addresses removed)

Code: Select all

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ------.-----.- .BCST.          16 u    -   64    0    0.000    0.000   0.000
 ------.-----.- .BCST.          16 u    -   64    0    0.000    0.000   0.000
 ------.-----.- .BCST.          16 u    -   64    0    0.000    0.000   0.000
 85.12.35.12     193.67.79.202   2 u  27h 1024    0   20.520  -10.931   0.000
The new script on the docs.cacti.net site isn't available, download link isn't working, so I couldn't try that one.
The perl version that is installed on my system is:

This is perl 5, version 18, subversion 1 (v5.18.1)

Somebody an idea how to solve this?

Grtz
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: not getting any values from NTP script

Post by phalek »

Can someone post/attach the ntp perl script to check ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
iNeo
Posts: 35
Joined: Thu Nov 03, 2005 7:29 am

Re: not getting any values from NTP script

Post by iNeo »

phalek wrote:Can someone post/attach the ntp perl script to check ?
The script I use has one small change and that is the -4 to force ipv4 communication.
Here is a link to the file ntp.pl.gz

Thanks for your response.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: not getting any values from NTP script

Post by phalek »

hm, could you provide an example output of the command as well ?

Code: Select all

/usr/bin/ntpq -4 -p <host> 
Edit: forget that, i just did see your earlier post ...
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: not getting any values from NTP script

Post by phalek »

I guess the regex is not working any more/in your case.

Change the line:

Code: Select all

if ( m/^\*(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+/ ) {
to

Code: Select all

if ( m/^(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)$/ ) {
and try again.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
iNeo
Posts: 35
Joined: Thu Nov 03, 2005 7:29 am

Re: not getting any values from NTP script

Post by iNeo »

Thanks for testing and checking, I'll have a look at the new code.

Have a great 2014
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: not getting any values from NTP script

Post by phalek »

Same to you !

I'm just not sure of how many parts the ntpq command returns, as I didn't have the full output of it.

In case it doesn't work, you can send me a sample output ( with ip's exchange, but not changing the overal syntax/output format) to support@nmid-plugins.de or via PM
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest