Graphs Only Showin -nan Values

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Author
Message
Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Graphs Only Showin -nan Values

#1 Post by Erudes1991 » Thu Feb 28, 2019 12:45 am

Hello everyone, new to the fórums, a bit scared…

I have this problem that based on the extensive search made on Google, isn't that unusual, however, causes to this problem can be a lot, which makes it harder to trouble shoot.

So I have Cacti installed on a VM through CentOS7, and I have another VM which has Windows 10 installed. I already installed everything succesfully and added both localhost and the Windows 10 machine to be monitored. Other than the fact that I had to force the poll manually in order for the rra files to appear on the proper directory, and the graphs to show, everything was normal.

But now this graphs are only showing nan values, on both local host and Windows 10 machine.

SNMP walk and firewall rules are set up correctly, the community name as well.

I checked this post and tried a few things unsuccesfully:

viewtopic.php?t=15136

I have to be honest, I'm pretty new to Linux and Cacti, so there are some of those trouble shooting steps that I was not able to complete as I could not understand them.

If you guys need me to post screenshots, or check something specifically please let me know.

Im also willing to be guided on a specific trouble shoot step that you'd want me to conduct.

Thank you so much!

PS: Just added a new Windows 10 Host to Cacti, and this is what I get after creating graphs for said host

Image

After starting the poll manually on the server, the graphs show but with nan values :cry:

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#2 Post by camerabob » Thu Feb 28, 2019 8:10 am

From the error message, it appears that the poller doesn't have permission to write in that directory. The logged in user does. Look in that folder's security and insure that the poller can write files there. I'm not sure what you installed under (user wise).
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#3 Post by Erudes1991 » Thu Feb 28, 2019 3:03 pm

As stated below the image, I should have upload another one haha. After starting the poll manually I was able to see the graphs:

By the way I have no idea how to grant permission to the poll account over the directory.

Anyway here is the graphs showing only NAN values

Image

Thanks!

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#4 Post by camerabob » Thu Feb 28, 2019 5:05 pm

If you run a poll manually again and then see numbers, then my original statement stands. Permission issue. Google "Windows directory permissions".
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

netniV
Cacti Guru User
Posts: 3018
Joined: Sun Aug 27, 2017 12:05 am

Re: Graphs Only Showin -nan Values

#5 Post by netniV » Thu Feb 28, 2019 6:16 pm

If you are running 1.2.x, use the Troubleshooting -> Data Sources option to find out if any common issues affect you (like above permission issues).

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#6 Post by Erudes1991 » Thu Feb 28, 2019 11:09 pm

I dont see numbers when I ran the poll manually, I just see NAN values.

Unfortunately I'm using an older version so I don't have that section on my web interface.

I'm using CentOS7 not Windows. Ok, so by permissions you guys mean permissions over that specific directory where those files are located, but to what user exactly? the one from cacti database? that one has no user added on the OS itself, so that confuses me a lot.

On the other hand, I had to restart the main computer and so did the virtual machine, and now I cannot access my Cacti server, it tells me that:

Forbidden

You don't have permission to access /cacti/ on this server.

This is driving me nuts be cause I'm fairly new to Linux and more to Cacti! :o

Please help :oops:

Edit: I managed to roll back the VM state so Cacti is back! not sure why that happens when reboot though...

netniV
Cacti Guru User
Posts: 3018
Joined: Sun Aug 27, 2017 12:05 am

Re: Graphs Only Showin -nan Values

#7 Post by netniV » Fri Mar 01, 2019 6:01 am

OK, for CentOS 7 both the user used in the cron (usually /etc/cron.d/cacti) and the website user which I think for C7 is apache, need read/write access to various folders. The installer gives you all that information when you step through an upgrade though if you are on an older version of Cacti, that may explain why you don't get decent information. I completely re-wrote the install for 1.2.x to be ajax based (more responsive) and provide far more checks/details on possible problems. For example, most people configure their PHP settings for Apache, but completely forget to set them for the command line (CLI).

Image

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#8 Post by Erudes1991 » Fri Mar 01, 2019 11:13 am

The user I'm using to access Cacti website is called "admin". What are the directories Apache should have write access to?

For example /var/lib/cacti/rra > Apache user has drwxrwxrwx access and also root.

Other entries I have on cron.d are:

*/5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/5 * * * * admin /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

During installation I was able to have all directories with write access by setting SELinux as permissive.

So who else should I give access to? Or what other directories you think? Or should I update my Cacti release version?

I double checked that the Linux machine that has Cacti installed is now giving me graph values except for the CPU utilization template, check below:

https://imgur.com/a/UmFT8Mu

https://imgur.com/oSz7Vik

Windows 10 PC has SNMP service configured correctly with community and also Cacti Server which detects the device, but no graphs.

Any additional thoughts?
Last edited by Erudes1991 on Fri Mar 01, 2019 11:53 am, edited 1 time in total.

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#9 Post by camerabob » Fri Mar 01, 2019 11:48 am

Who is running your poller?

server# cat /etc/cron.d/cacti

Should look something like the below:

*/5 * * * * <CentOS-web-user> php <path to cacti>/poller.php > /dev/null 2>&1

mine is:
*/1 * * * * apache /usr/share/cacti/poller.php > /dev/null 2>&1
Last edited by camerabob on Fri Mar 01, 2019 11:58 am, edited 1 time in total.
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#10 Post by Erudes1991 » Fri Mar 01, 2019 11:54 am

Hey, thanks for replying, we stepped each other lol:

This is what I have on cron.d

*/5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/5 * * * * admin /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Is it right?

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#11 Post by camerabob » Fri Mar 01, 2019 12:06 pm

First of all, you should only need one (the one that works!). I have my install set for unique directories, so when I run:

Code: Select all

ls -l /usr/share/cacti/rra/
I get:

Code: Select all

drwxr-xr-x. 2 apache apache      21 Nov 29 16:01 1
drwxr-xr-x. 2 apache apache      51 Nov 29 15:59 11
drwxr-xr-x. 2 apache apache     171 Jan 25 15:58 12
drwxr-xr-x. 2 apache apache     216 Jan 18 08:18 13
drwxr-xr-x. 2 apache apache      36 Jan 14 10:06 15
drwxr-xr-x. 2 apache apache       6 Jan 29 09:18 16
drwxr-xr-x. 2 apache apache      21 Jan 14 10:06 17
drwxr-xr-x. 2 apache apache      36 Jan 14 10:13 18
drwxr-xr-x. 2 apache apache      21 Jan 14 10:13 19
drwxr-xr-x. 2 apache apache      36 Jan 14 10:13 20
...
Apache is the user running my web server, so all is good. From the command prompt, run "ps -ef | grep httpd" without quotes. The output should resemble:

Code: Select all

# ps -ef | grep httpd
apache     826  4999  0 11:16 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache    2874  4999  0 12:01 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root      4157  2075  0 12:02 pts/0    00:00:00 grep --color=auto httpd
apache    4715  4999  0 11:21 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
root      4999     1  0 Jan18 ?        00:10:45 /usr/sbin/httpd -DFOREGROUND
apache    8551  4999  0 11:26 ?        00:00:02 /usr/sbin/httpd -DFOREGROUND
apache   12354  4999  0 11:31 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache   16148  4999  0 11:36 ?        00:00:01 /usr/sbin/httpd -DFOREGROUND
apache   18075  4999  0 10:56 ?        00:00:03 /usr/sbin/httpd -DFOREGROUND
apache   23813  4999  0 11:46 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   27601  4999  0 11:51 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   31478  4999  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
The line with

Code: Select all

root, 4999, 1,...
tells us that root (process #1) has spawned httpd (process #4999). All lines with 4999 in the third column will have the user in the first column, for me it's Apache. Do the same and compare.
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#12 Post by Erudes1991 » Fri Mar 01, 2019 1:04 pm

This is what I get when doing ls -l /usr/share/cacti/rra

Image

When you say "Apache is the user running my web server" you're not referring to the user credentials you type in when logging the Web UI right? Because this is what confuses me the most.

And this is what I get with "ps -ef | grep httpd"

Image

I really can't tell if the values are ok, they resemble to yours though

What changes should I do to crontab then?

Thanks for following up!

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#13 Post by camerabob » Fri Mar 01, 2019 1:45 pm

Those files in green are under the root user. Apache may not have the ability to write to them (though the permissions are there), so they will never get updated. In

Code: Select all

/use/share/cacti/rrd
run this command:

Code: Select all

# chown apache.apache local_*
This will change the file owners so that Apache can write to them. Let's see if polls start working after that. You should additionally run:

Code: Select all

# chmod 644 local_*
This will change the file permissions so that only Apache can write to those files. Also, you should be able to safely remove from the crontab file:

Code: Select all

*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
*/5 * * * * admin /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Erudes1991
Posts: 16
Joined: Thu Feb 28, 2019 12:37 am

Re: Graphs Only Showin -nan Values

#14 Post by Erudes1991 » Fri Mar 01, 2019 2:45 pm

Ok, I've done all of that, I don't know if I have to wait or restart services, but as soon as I ran the commands I reloaded Cacti and everything's the same.

Edit: This is what I see on the main graph screen for Linux local host

Image
Last edited by Erudes1991 on Fri Mar 01, 2019 3:42 pm, edited 1 time in total.

User avatar
camerabob
Cacti User
Posts: 296
Joined: Fri Feb 10, 2017 2:45 pm
Location: Long Island, New York, USA
Contact:

Re: Graphs Only Showin -nan Values

#15 Post by camerabob » Fri Mar 01, 2019 3:36 pm

It will take a couple of cycles before you see data. At least 10 minutes. The date stamps on the files should be updating though.

Added***
I see that the -nan- are related to the graphs that were not green. In the

Code: Select all

/usr/share/cacti/rra
folder, try the below command:

Code: Select all

# chmod +x *
This will allow the files to be executed. I see mine are while yours are not.
Last edited by camerabob on Fri Mar 01, 2019 3:49 pm, edited 1 time in total.
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Flowview @ 2.1
Mactrack @ 4.2
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.6-1.el7 @ CentOS 7-7.1908.0.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Post Reply