Hi Sean,

That's not a good solution. The idea is that opsview.conf is used as the main configuration data.

What is the last value of opsview.conf? If it is 0 or "", then the reading will fail. 

I've updated http://docs.opsview.org/doku.php?id=opsview-community:opsviewconfigfiles with some troubleshooting and verification steps.

I've also updated db_mysql in trunk so that it stops processing if opsview.sh fails.

Ton

On 18 Mar 2010, at 22:13, Sean Staats wrote:

Fixed.  The solution was to keep the opsview.sh script from executing any perl and hard-coding the variables like so:
----
# Check here because slaves do not have opsview.conf
#if [ ! -f $etcdir/opsview.defaults ] ; then
#    # return information for use on slaves
#    perl -e '
#        use lib "'$etcdir'";
#        do "instance.cfg";
#        print <<"EOF"
#ARCHIVE_RETENTION_DAYS="$archive_retention_days"
#NMIS_MAXTHREADS="$nmis_maxthreads"
#EOF
#'
#    exit $?
#fi

#perl -e '
#       use lib "'$libdir'";
#       use Opsview::Config;
#       print qq{ROOT_DIR="}.Opsview::Config->root_dir.qq{"}.$/;
#       print <<"EOF"
echo "DB=\"opsview\""
echo "DBUSER=\"user\""
echo "DBPASSWD=\"password\""
echo "DBHOST=\"dbhost\""
echo "BACKUP_DIR=\"/usr/local/nagios/var/backups\""
echo "BACKUP_RETENTION_DAYS=\"30\""
echo "DAILY_BACKUP=\"1\""
echo "ARCHIVE_RETENTION_DAYS=\"180\""
echo "SNMPTRAPEXCEPTION_RETENTION_DAYS=\"60\""
echo "ODW_DB=\"odw\""
echo "ODW_DBUSER=\"user\""
echo "ODW_DBPASSWD=\"password\""
echo "ODW_DBHOST=\"dbhost\""
echo "RUNTIME_DB=\"runtime\""
echo "RUNTIME_DBUSER=\"user\""
echo "RUNTIME_DBPASSWD=\"password\""
echo "RUNTIME_DBHOST=\"dbhost\""
echo "USE_PREFORK=\"0\""
echo "USE_LIGHTTPD=\"0\""
echo "LIGHTTPD_DAEMONS=\"16\""
echo "LIGHTTPD_SOCKET=\"/usr/local/nagios/var/opsview_web_socket\""
echo "USE_HTTPS=\"0\""
echo "REPORTS_DB=\"reports\""
echo "REPORTS_DBUSER=\"user\""
echo "REPORTS_DBPASSWD=\"password\""
echo "REPORTS_DBHOST=\"dbhost\""
echo "NMIS_MAXTHREADS=\"2\""
#EOF
#'
----

It is ugly, but got the job done!

Cheers!
Sean

On 3/18/2010 4:10 PM, Sean Staats wrote:
Thanks, Kurt.  I am actually going to be using MySQL located on a different server.  But I started mysqld on this machine just to see if that made a difference.  It did not help:
----
Cannot read /usr/local/nagios/etc/opsview.conf:  at -e line 3
Compilation failed in require at -e line 3.
BEGIN failed--compilation aborted at -e line 3.
ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Cannot run mysql
----

The problem appears to be the perl commands within this part of the opsview.sh script:
----
perl -e '
       use lib "/usr/local/nagios/bin/../bin/../lib";
       use Opsview::Config;
       print qq{ROOT_DIR="}.Opsview::Config->root_dir.qq{"}.$/;
       print <<"EOF"
DB="$Settings::db"
DBUSER="$Settings::dbuser"
DBPASSWD="$Settings::dbpasswd"
DBHOST="$Settings::dbhost"
BACKUP_DIR="$Settings::backup_dir"
BACKUP_RETENTION_DAYS="$Settings::backup_retention_days"
DAILY_BACKUP="$Settings::daily_backup"
ARCHIVE_RETENTION_DAYS="$Settings::archive_retention_days"
SNMPTRAPEXCEPTION_RETENTION_DAYS="$Settings::snmptrapexception_retention_days"
ODW_DB="$Settings::odw_db"
ODW_DBUSER="$Settings::odw_dbuser"
ODW_DBPASSWD="$Settings::odw_dbpasswd"
ODW_DBHOST="$Settings::odw_dbhost"
RUNTIME_DB="$Settings::runtime_db"
RUNTIME_DBUSER="$Settings::runtime_dbuser"
RUNTIME_DBPASSWD="$Settings::runtime_dbpasswd"
RUNTIME_DBHOST="$Settings::runtime_dbhost"
USE_PREFORK="$Settings::use_prefork"
USE_LIGHTTPD="$Settings::use_lighttpd"
LIGHTTPD_DAEMONS="$Settings::lighttpd_daemons"
LIGHTTPD_SOCKET="$Settings::lighttpd_socket"
USE_HTTPS="$Settings::use_https"
REPORTS_DB="$Settings::reports_db"
REPORTS_DBUSER="$Settings::reports_dbuser"
REPORTS_DBPASSWD="$Settings::reports_dbpasswd"
REPORTS_DBHOST="$Settings::reports_dbhost"
NMIS_MAXTHREADS="$Settings::nmis_maxthreads"
EOF
'
----

On 3/18/2010 3:00 PM, Kurt Bechstein wrote:
On Thursday 18 March 2010 3:25:42 pm Sean Staats wrote:
I am trying to install opsview on CentOS 5.4 x86_64.  I'm following the
instructions at
http://docs.opsview.org/doku.php?id=opsview3.6:rhel-installation
At step 5 of the "After the installation is complete" section, when
executing(as the nagios user): /usr/local/nagios/bin/db_mysql -u root
-p<my-password>  I get the following error:
----
Cannot read /usr/local/nagios/etc/opsview.conf:  at -e line 3
Compilation failed in require at -e line 3.
BEGIN failed--compilation aborted at -e line 3.
/usr/local/nagios/bin/db_mysql[68]: eval[1]: executing: not found [No
such file or directory]
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)
Cannot run mysql
----

The opsview.conf file is readable/writable by the nagios user:
ls -l /usr/local/nagios/etc/opsview.conf
-rw-r--r-- 1 nagios nagios 982 Mar 12 17:20
/usr/local/nagios/etc/opsview.conf

Perl is working:
perl --version
This is perl, v5.8.8 built for x86_64-linux-thread-multi

Running the db_mysql script in debug mode produces:
----
++ dirname /usr/local/nagios/bin/../bin/opsview.sh
+ bindir=/usr/local/nagios/bin/../bin
+ etcdir=/usr/local/nagios/bin/../bin/../etc
+ libdir=/usr/local/nagios/bin/../bin/../lib
+ '[' '!' -f /usr/local/nagios/bin/../bin/../etc/opsview.defaults ']'
+ perl -e '
         use lib "/usr/local/nagios/bin/../bin/../lib";
         use Opsview::Config;
         print qq{ROOT_DIR="}.Opsview::Config->root_dir.qq{"}.$/;
         print<<"EOF"
DB="$Settings::db"
DBUSER="$Settings::dbuser"
DBPASSWD="$Settings::dbpasswd"
DBHOST="$Settings::dbhost"
BACKUP_DIR="$Settings::backup_dir"
BACKUP_RETENTION_DAYS="$Settings::backup_retention_days"
DAILY_BACKUP="$Settings::daily_backup"
ARCHIVE_RETENTION_DAYS="$Settings::archive_retention_days"
SNMPTRAPEXCEPTION_RETENTION_DAYS="$Settings::snmptrapexception_retention_da
ys"

ODW_DB="$Settings::odw_db"
ODW_DBUSER="$Settings::odw_dbuser"
ODW_DBPASSWD="$Settings::odw_dbpasswd"
ODW_DBHOST="$Settings::odw_dbhost"
RUNTIME_DB="$Settings::runtime_db"
RUNTIME_DBUSER="$Settings::runtime_dbuser"
RUNTIME_DBPASSWD="$Settings::runtime_dbpasswd"
RUNTIME_DBHOST="$Settings::runtime_dbhost"
USE_PREFORK="$Settings::use_prefork"
USE_LIGHTTPD="$Settings::use_lighttpd"
LIGHTTPD_DAEMONS="$Settings::lighttpd_daemons"
LIGHTTPD_SOCKET="$Settings::lighttpd_socket"
USE_HTTPS="$Settings::use_https"
REPORTS_DB="$Settings::reports_db"
REPORTS_DBUSER="$Settings::reports_dbuser"
REPORTS_DBPASSWD="$Settings::reports_dbpasswd"
REPORTS_DBHOST="$Settings::reports_dbhost"
NMIS_MAXTHREADS="$Settings::nmis_maxthreads"
EOF
'
Cannot read /usr/local/nagios/etc/opsview.conf:  at -e line 3
Compilation failed in require at -e line 3.
BEGIN failed--compilation aborted at -e line 3.
/usr/local/nagios/bin/db_mysql[68]: eval[1]: executing: not found [No
such file or directory]
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)
Cannot run mysql
----

I'd appreciate it if somebody could help me solve this problem so I can
get opsview running.

Cheers!
Sean


Sounds you need to actually start up mysql first.  Probably need to do:
service mysqld start
chkconfig mysqld on

Run those commands above and then try and your install again.

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users


--
Sean Staats
Senior Systems Administrator
Family Tree DNA <http://www.familytreedna.com/>

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

Ton Voon
Product Architect



Opsera Limited | Unit 69 Suttons Business Park
Reading | Berkshire | RG6 1AZ | UK

Phone:   
+44 (0) 845 057 7887
Mobile
:   +44 (0) 7931 365796
Skype:   tonvoon     Email:   [email protected]

www.opsera.com
This e-mail is confidential, intended only for the named recipient(s) above and may contain information that is privileged and confidential. If you receive this message in error, or are not the named recipient(s), please notify the sender at the phone number above, do not copy this message, do not disclose its contents to anyone, and delete this e-mail message from your computer. Although Opsera routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Opsera makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Opsera Limited is registered in the UK under Company Number 5396532. Our registered office is Gorse View, Horsell Rise, Woking, Surrey, GU21 4RB.

_______________________________________________
Opsview-users mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-users

Reply via email to