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

Automap: The required graphviz binary "dot" could not be found #206

Open
johnny-b2 opened this issue Aug 1, 2019 · 10 comments · May be fixed by #388
Open

Automap: The required graphviz binary "dot" could not be found #206

johnny-b2 opened this issue Aug 1, 2019 · 10 comments · May be fixed by #388

Comments

@johnny-b2
Copy link

Hi,
I installed latest stable version of NagVis on CentOS.
After fixing SELinux problem all is working well except automap function.
I have installed graphviz. All required binaries are in /usr/bin/ folder.

But I always get Error:
The required graphviz binary "dot" could not be found in the paths: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/bin/".

I tried specify graphvizpath variable in General/Automap Configuration to value "/usr/bin/".
I tried make symlink to /usr/local/bin/.
I found function "automap_check_graphviz" to check if binaries exists in file: share/server/core/sources/automap_pos.php.
I copy this function to new php file. I tried to search for binaries with this function and it is working. The function find all bineries with exitCode 0.
The SELinux is in permisive mode now.
I'm out of ideas where to look.
In apache/php log files is no error.

NagVis version 1.9.13
Distribution CenOS 7.6
Apache version 2.4
PHP version 7.1 php-fpm
Are there error messages in webservers error log? No
Browser used (Equal behaviour in other browsers?) Firefox, Chromium, Midori
Are there JavaScript errors in the browser? No

Thanks in advance for any help.

@math1eu
Copy link

math1eu commented Oct 16, 2019

Hello,

I have exactly the same issue. Did you solve it ?

Regards.

@johnny-b2
Copy link
Author

Unfortunately no. Still the same. Can't figure out where is the problem.
Need help from devs. Please help us with this "bug?".
I'm not programmer so can't do more debugging.
If someone tell me what to try, I can test it.
If can be found at least some workaround will be appreciated.
Automap is required function for our deployment.

@p4k8
Copy link

p4k8 commented Dec 8, 2019

dot is one of the programs installed with graphviz package.
Maybe your distribution package didn't place it's binary file in correct place or is outdated.
I suggest building graphviz from source and testing that. https://graphviz.gitlab.io/_pages/Download/Download_source.html

@johnny-b2
Copy link
Author

johnny-b2 commented Dec 9, 2019

Thanks for tip. But still nothing. Still same.
From CentOS distribution there is graphviz version 2.30.1-21.
From source I downloaded graphviz stable version 2.40.1.
Distribution graphviz binaries are placed in /usr/bin folder.
Binaries from graphviz source install are placed in /usr/local/bin folder.
Both locations are standard binary locations and both are (or should be) searched by NagVis as specified in Error message.
Setting specific graphviz binaries path (which is added at the end of standard path list) in NagVis configuration don't helped too.
Other things tried:

  • tried update NagVis from 1.9.13 to latest stable 1.9.17.
  • tried update OS to CentOS 7.7
  • tried update PHP-FPM from 7.1 to 7.2

When upgraded NagVis - noticed that installer found all graphviz binaries.
Again: When I try PHP function "automap_check_graphviz" to check if binaries exists (from file share/server/core/sources/automap_pos.php), the function find all bineries with exitCode 0.

@ekrichbaum
Copy link
Contributor

Agreed. On Fedora the same. In share/server/core/sources/automap_pos.php the function automap_check_graphviz($binary) can just bypass the !$bFound to return true and it will function as expected. I didn't debug the exec to see what was happening there for the return.

@johnny-b2
Copy link
Author

Thanks for test and confirmation.
I tried to set default value for $bFound = true; and now the automap function is working as expected.
I used it now as workaround and can live with that for now.

There has to be some bug in automap_check_graphviz($binary) function. Function alone in separate new file is working with exitCode == 0. For test I have to substitue cfg('automap','graphvizpath') with '/usr/bin/'. When I substitue it with '/usr/bin' (without ending slash), then the function will concate the path and binary to wrong final file path '/usr/bindot' insted of '/usr/bin/dot' and the code will fail with exitCode == 1.
If this is the problem, then I don't get that if I set graphvizpath variable in General/Automap Configuration to value "/usr/bin/", it should work. But it don't. Maybe it is not used to search for binaries.

@R00T88
Copy link

R00T88 commented Aug 12, 2020

Hi,
issue still present and i set $bFound = true; to fix it

@NicolasGoeddel
Copy link

I've got the same issue here on CentOS 8 with nagvis in version 1.9.29 with dot installed in /bin and graphvizpath="/bin/".
Even the error message shows the /bin/ path.

@NicolasGoeddel
Copy link

After wrapping the exec call into a var_dump I see this:

string(30) "which: no /bin/dot in ((null))"

So it seems that which has no environment in which it could potentially find the 'dot' binary.
The same happens if you unset the PATH variable in command line:

user@home:~$ unset PATH
user@home:~ /usr/bin/which dot
/usr/bin/which: no dot in ((null))

By the way: It would be much cleaner to use escapeshellarg() because without this is a security risk if someones writes certain things into nagvis.ini.php

My fix would be this for now:

exec('PATH='.escapeshellarg($_SERVER['PATH']).' which '.escapeshellarg($path).' 2>&1', $arrReturn, $exitCode);

@CTFSE
Copy link

CTFSE commented Jun 17, 2024

I just installed the latest as of today (1.9.41) and unfortunately I am having the same issue. 'dot' was installed with the graphviz package on Rocky 9.4. I can log in to NagVis but cannot do anything within the application because of this error. Any resolution on the horizon apart from stuffing that variable?

obscurerichard added a commit to obscureorganization/nagvis that referenced this issue Dec 30, 2024
This fixes the message:

    The required graphviz binary "dot" could not be found

This appears on Centos 7.x and higher systems with recent versions of
Nagvis installed.

Resolves NagVis#206

NagVis#206

Thank you @NiclasGoeddel for the fix!
@obscurerichard obscurerichard linked a pull request Dec 30, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

7 participants