Re: [Observium] poller-wrapper.py not working on FreeBSD9.1
![](https://secure.gravatar.com/avatar/e9c1095e9947c01f120b8d0d47d7f24e.jpg?s=120&d=mm&r=g)
Hello,
I 've been using Observium on FreeBSD 9.2 and now 10-BETA1
The most important difference between FreeBSD and some Linux distributions is where stuff is installed. The default installation of Observium uses /usr/bin as the path for many commands (snmp, Python, etc) and FreeBSD keeps a strict separation between the base system and the optional ports/packages.
Nothing dramatic, but they belong under /usr/local/bin instead of /usr/bin, /usr/local/lib instead of /usr/lib...
This is a list of the paths that should point to /usr/local. Note that Python and PHP are in /usr/local/bin, not /usr/bin (where the Observium files expect to find them).
./discovery.php:#!/usr/bin/env /usr/local/bin/php ./poll-billing.php:#!/usr/bin/env /usr/local/bin/php ./poller.php:#!/usr/bin/env /usr/local/bin/php ./includes/defaults.inc.php:$config['rrdtool'] = "/usr/local/bin/rrdtool"; ./includes/defaults.inc.php:$config['fping'] = "/usr/local/sbin/fping"; ./includes/defaults.inc.php:$config['fping6'] = "/usr/local/sbin/fping6"; ./includes/defaults.inc.php:$config['snmpwalk'] = "/usr/local/bin/snmpwalk"; ./includes/defaults.inc.php:$config['snmpget'] = "/usr/local/bin/snmpget"; ./includes/defaults.inc.php:$config['snmpbulkwalk'] = "/usr/local/bin/snmpbulkwalk"; ./includes/defaults.inc.php:$config['snmptranslate'] = "/usr/local/bin/snmptranslate"; ./includes/defaults.inc.php:$config['mtr'] = "/usr/local/sbin/mtr"; ./includes/defaults.inc.php:$config['nmap'] = "/usr/local/bin/nmap"; ./includes/defaults.inc.php:$config['dot'] = "/usr/local/bin/dot"; ./includes/defaults.inc.php:$config['unflatten'] = "/usr/local/bin/unflatten"; ./includes/defaults.inc.php:$config['neato'] = "/usr/local/bin/neato"; ./includes/defaults.inc.php:$config['sfdp'] = "/usr/local/bin/sfdp"; ./includes/defaults.inc.php:$config['svn'] = "/usr/local/bin/svn"; ./config.php:$config['nfsen_rrds'] = "/usr/local/nfsen/profiles-stat/live/"; ./poller-wrapper.py:#! /usr/bin/env /usr/local/bin/python
I know I shouldn't have modified includes/defaults.inc.php, but I did it before I realized I should change it in config.php.
Start by checking your paths, make sure that Observium can find Python, PHP, Net-SNMP, etc.
Borja.
![](https://secure.gravatar.com/avatar/e9c1095e9947c01f120b8d0d47d7f24e.jpg?s=120&d=mm&r=g)
On Oct 21, 2013, at 2:02 PM, Borja Marcos wrote:
Hello,
I 've been using Observium on FreeBSD 9.2 and now 10-BETA1
The most important difference between FreeBSD and some Linux distributions is where stuff is installed. The default installation of Observium uses /usr/bin as the path for many commands (snmp, Python, etc) and FreeBSD keeps a strict separation between the base system and the optional ports/packages.
Nothing dramatic, but they belong under /usr/local/bin instead of /usr/bin, /usr/local/lib instead of /usr/lib...
I forgot. The default PATH for the cron execution environment is extremely limited due to security reasons in FreeBSD. You need to make sure that you either have all your absolute paths right, *or* add a more generous PATH to the user's crontab.
---- PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
33 */6 * * * /var/www/observium/discovery.php -h all >> /dev/null 2>&1 */5 * * * * /var/www/observium/discovery.php -h new >> /dev/null 2>&1 */5 * * * * /var/www/observium/poller-wrapper.py 1 >> /dev/null 2>&1
-----
Borja.
![](https://secure.gravatar.com/avatar/e9c1095e9947c01f120b8d0d47d7f24e.jpg?s=120&d=mm&r=g)
On Oct 21, 2013, at 2:08 PM, Tom Laermans wrote:
On 21/10/2013 14:02, Borja Marcos wrote:
./discovery.php:#!/usr/bin/env /usr/local/bin/php ./poll-billing.php:#!/usr/bin/env /usr/local/bin/php ./poller.php:#!/usr/bin/env /usr/local/bin/php
This makes 0 sense.
If you add the PATH to the crontab, yes, it doesn't make sense. If you don't, FreeBSD has a minimal default PATH offered to the crontab commands, which doesn't include /usr/local/bin.
Borja.
![](https://secure.gravatar.com/avatar/21caf0a08d095be7196a1648d20942be.jpg?s=120&d=mm&r=g)
On 10/21/2013 03:41 PM, Borja Marcos wrote:
On Oct 21, 2013, at 2:08 PM, Tom Laermans wrote:
On 21/10/2013 14:02, Borja Marcos wrote:
./discovery.php:#!/usr/bin/env /usr/local/bin/php ./poll-billing.php:#!/usr/bin/env /usr/local/bin/php ./poller.php:#!/usr/bin/env /usr/local/bin/php
This makes 0 sense.
If you add the PATH to the crontab, yes, it doesn't make sense. If you don't, FreeBSD has a minimal default PATH offered to the crontab commands, which doesn't include /usr/local/bin.
I'd opt for adding the PATH indeed, makes your life a lot simpler. But if you don't, why not remove "env", it serves no purpose if you pass it a full path - that's what I meant :-)
Tom
![](https://secure.gravatar.com/avatar/e9c1095e9947c01f120b8d0d47d7f24e.jpg?s=120&d=mm&r=g)
On Oct 21, 2013, at 5:15 PM, Tom Laermans wrote:
I'd opt for adding the PATH indeed, makes your life a lot simpler. But if you don't, why not remove "env", it serves no purpose if you pass it a full path - that's what I meant :-)
You are right :)
The thing is, the original files had a "env php" (and env was also empty) and I added the /usr/local/bin to php. I was just in "make the thing work, I really want to see it dance" and at the end I never got to the tidy-it phase ;)
Borja.
participants (2)
-
Borja Marcos
-
Tom Laermans