Bug 192618 - [stage] net-mgmt/cacti add stage support
[stage] net-mgmt/cacti add stage support
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: --- Affects Many People
Assigned To: Kurt Jaeger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-12 17:04 UTC by Dennis Glatting
Modified: 2014-08-16 07:09 UTC (History)
3 users (show)

See Also:


Attachments
net-mgmt/cacti port shar (37.55 KB, application/x-shellscript)
2014-08-12 17:04 UTC, Dennis Glatting
no flags Details
patch to commit (30.81 KB, patch)
2014-08-15 10:04 UTC, Kurt Jaeger
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Glatting 2014-08-12 17:04:35 UTC
Created attachment 145722 [details]
net-mgmt/cacti port shar

net-mgmt/cacti was scheduled for deletion because it DID NOT conform to StageDir. 

Included in this PR is an updated shar of the Cacti port tree. There are many changes, including additional diffs, making a port diff a bit much.

These changes have been tested (built from scratch) in one of my virtual instances. There are minor additions to pkg-message too.
Comment 1 John Marino freebsd_committer 2014-08-12 17:40:44 UTC
Hi Dennis, I've seen the ports@ mail topic, and I hate to do this to you, but I ask everyone with staging PRs that don't provide "proof" for the following:



Do you have any verification available?  In order of preference, examples of what I'm looking for are:

1) "poudriere testport" or "poudriere bulk -t" logs
2) Redports or tinderbox logs
3) "make check-plist" followed by "make stage-qa" output  (https://www.freebsd.org/doc/en/books/porters-handbook/porting-testing.html)

Also, please run "portlint" and paste the output.



If somebody helped you with this, I'd imagine they might have used these tools already to help stage the port.
Comment 2 Dennis Glatting 2014-08-12 18:48:11 UTC
I ran most of the tests documented here. Output follows. I did not try
to make a package as a user as my installation (virtual instance) is root in /usr/ports and there are no non-root accounts.

http://www.freebsd.org/doc/en/books/porters-handbook/porting-testing.html


I have never used poudriere or Redports.


root@Junker# make stage
/!\ WARNING /!\
DEFAULT_PHP_VER is defined, consider using DEFAULT_VERSIONS=php=55
instead

===>  License GPLv2 accepted by the user
===>   cacti-0.8.8b_3 depends on file: /usr/local/sbin/pkg - found
cd /usr/ports/distfiles/;
_PATCH_SITES_DEFAULT="http://www.cacti.net/downloads/patches/0.8.8b/" ;
for _file in security.patch; do  file=`echo $_file | /usr/bin/sed -E -e
's/:[^-:][^:]*$//'` ;  select=`echo ${_file#${file}} | /usr/bin/sed -e
's/^://' -e 's/,/ /g'` ;  file=`echo $file | /usr/bin/sed -E -e
's/:-[^:]+$//'` ;  force_fetch=false;  filebasename=${file##*/};  for
afile in ; do  afile=${afile##*/};  if [ "x$afile" = "x$filebasename" ];
then  force_fetch=true;  fi;  done;  if [ ! -f $file -a ! -f
$filebasename -o "$force_fetch" = "true" ]; then  if [ -L $file -o -L
${file##*/} ]; then  echo "=> /usr/ports/distfiles//$file is a broken
symlink.";  echo "=> Perhaps a filesystem (most likely a CD) isn't
mounted?";  echo "=> Please correct this problem and try again.";  exit
1;  fi;  echo "=> $file doesn't seem to exist
in /usr/ports/distfiles/.";  if [ ! -z "$select" ] ; then
__PATCH_SITES_TMP= ;  for group in $select; do  if [ ! -z \
${_PATCH_SITES_${group}} ] ; then  eval ___PATCH_SITES_TMP="\
${_PATCH_SITES_${group}}" ;  __PATCH_SITES_TMP="${__PATCH_SITES_TMP}
${___PATCH_SITES_TMP}" ;  fi;  done;  ___PATCH_SITES_TMP= ;
SORTED_PATCH_SITES_CMD_TMP="echo  `echo ${__PATCH_SITES_TMP}
| /usr/bin/awk 'BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl =
"://[^/]*/"; } /:\\/\\/[^\\/]*\\// { good["://[^/]*/"] =
good["://[^/]*/"] " " $0 ; next; } { rest = rest " " $0; } END
{ n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print
rest; }'` http://distcache.FreeBSD.org/ports-distfiles/" ;  else
SORTED_PATCH_SITES_CMD_TMP="cd /root/cacti && make
patch-sites-DEFAULT" ;  fi;  sites_remaining=0;  sites="`eval
$SORTED_PATCH_SITES_CMD_TMP`";  for site in ${sites}; do
sites_remaining=$((${sites_remaining} + 1));  done;  for site in
${sites}; do  sites_remaining=$((${sites_remaining} - 1));  echo "=>
Attempting to fetch ${site}${file}";  CKSIZE=`alg=SIZE; if [ \( -n "" -a
-n "" \) -o ! -f "/root/cacti/distinfo" ]; then exit; fi;
DIR=; /usr/bin/awk -v alg=$alg -v file=${DIR:+$DIR/}${file}      '$1 == alg
&& $2 == "(" file ")" {print $4}' /root/cacti/distinfo`;  case ${file}
in  */*)        /bin/mkdir -p ${file%/*};  args="-o ${file} ${site}${file}";;
*)              args=${site}${file};;  esac;  if /usr/bin/env SSL_NO_VERIFY_PEER=1
SSL_NO_VERIFY_HOSTNAME=1 /usr/bin/fetch -Fpr ${CKSIZE:+-S $CKSIZE}
${args} ; then  actual_size=`stat -f %z "${file}"`;  if [ -n "" ] ||
[ -z "${CKSIZE}" ] || [ ${actual_size} -eq ${CKSIZE} ]; then  continue
2;  else  echo "=> Fetched file size mismatch (expected ${CKSIZE},
actual ${actual_size})";  if [ ${sites_remaining} -gt 1 ]; then  echo
"=> Trying next site";  /bin/rm -f -f ${file};  fi;  fi;  fi;  done;
echo "=> Couldn't fetch it - please try to retrieve this"; echo "=> port
manually into /usr/ports/distfiles/ and try again.";  exit 1;  fi;  done
===> Fetching all distfiles required by cacti-0.8.8b_3 for building
===>  Extracting for cacti-0.8.8b_3
=> SHA256 Checksum OK for cacti-0.8.8b.tar.gz.
=> SHA256 Checksum OK for security.patch.
===>  Patching for cacti-0.8.8b_3
===>  Applying distribution patches for cacti-0.8.8b_3
===>  Applying FreeBSD patches for cacti-0.8.8b_3
/bin/rm -f
-r  /root/cacti/work/cacti-0.8.8b/log /root/cacti/work/cacti-0.8.8b/rra
===>   cacti-0.8.8b_3 depends on shared library: libmysqlclient.so.18 -
found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>  Configuring for cacti-0.8.8b_3
===>  Staging for cacti-0.8.8b_3
===>   cacti-0.8.8b_3 depends on executable: rrdtool - found
===>   cacti-0.8.8b_3 depends on file: /usr/local/include/php/main/php.h
- found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/mysql.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/session.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/sockets.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/snmp.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/xml.so - found
===>   Generating temporary packing list
===> Creating users and/or groups.
=======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database, a cacti user, and initialize:
   a) CREATE DATABASE cacti;
   b) Create a mysql user/password for cacti:
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
      FLUSH PRIVILEGES;
   c) Add GRANTS:
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
      FLUSH PRIVILEGES;
   d) Import the default cacti database:
      mysql --database=cacti -ucacti -p
< /usr/local/share/cacti/cacti.sql

 NOTE:
   * Cacti does not LOCK TABLES.

2. Edit /usr/local/share/cacti/include/config.php from the template
   config.php.orig.

   PHP requires the time zone to be explicitly set rather that rely on
   the system time zone, otherwise poller complains. I added the
   following line to my config.php:

   date_default_timezone_set('America/Los_Angeles');

3. Add the following line to cron for cacti:
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php
> /dev/null 2>&1

4. Example Apache 2.4 configuration:

   LoadModule php5_module  libexec/apache22/libphp5.so

   <FilesMatch "\.php$">
       SetHandler application/x-httpd-php
   </FilesMatch>
   <FilesMatch "\.phps$">
       SetHandler application/x-httpd-php-source
   </FilesMatch>

   DirectoryIndex index.php

   DocumentRoot "/usr/local/share/cacti"
 
   Alias /cacti "/usr/local/share/cacti/"
   Alias /Cacti "/usr/local/share/cacti/"

   <Directory "/usr/local/share/cacti">
      Require all granted
      AllowOverride None
      Order Allow,deny
      Allow from all
   </Directory>

5. Open a Cacti login page in your web browser and login with
   admin/admin.

If you update cacti, open a login page and an updating process will
start automatically.

NOTEs as of 10Aug2014:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

2) The PERL paths in the Cacti PERL scripts have been updated to
   /usr/local/bin.

=======================================================================
====> Compressing man pages (compress-man)
root@Junker# 




root@Junker# make check-orphans
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for directories owned by MTREEs
===> Checking for directories handled by dependencies
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)
root@Junker# 




root@Junker# make package
===>  Building package for cacti-0.8.8b_3
root@Junker# 




root@Junker# make install
===>  Installing for cacti-0.8.8b_3
===>   cacti-0.8.8b_3 depends on executable: rrdtool - found
===>   cacti-0.8.8b_3 depends on file: /usr/local/include/php/main/php.h
- found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/mysql.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/session.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/sockets.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/snmp.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/xml.so - found
===>   cacti-0.8.8b_3 depends on shared library: libmysqlclient.so.18 -
found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>   Registering installation for cacti-0.8.8b_3
===> Creating users and/or groups.
Using existing group 'cacti'.
Using existing user 'cacti'.
=======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database, a cacti user, and initialize:
   a) CREATE DATABASE cacti;
   b) Create a mysql user/password for cacti:
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
      FLUSH PRIVILEGES;
   c) Add GRANTS:
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
      FLUSH PRIVILEGES;
   d) Import the default cacti database:
      mysql --database=cacti -ucacti -p
< /usr/local/share/cacti/cacti.sql

 NOTE:
   * Cacti does not LOCK TABLES.

2. Edit /usr/local/share/cacti/include/config.php from the template
   config.php.orig.

   PHP requires the time zone to be explicitly set rather that rely on
   the system time zone, otherwise poller complains. I added the
   following line to my config.php:

   date_default_timezone_set('America/Los_Angeles');

3. Add the following line to cron for cacti:
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php
> /dev/null 2>&1

4. Example Apache 2.4 configuration:

   LoadModule php5_module  libexec/apache22/libphp5.so

   <FilesMatch "\.php$">
       SetHandler application/x-httpd-php
   </FilesMatch>
   <FilesMatch "\.phps$">
       SetHandler application/x-httpd-php-source
   </FilesMatch>

   DirectoryIndex index.php

   DocumentRoot "/usr/local/share/cacti"
 
   Alias /cacti "/usr/local/share/cacti/"
   Alias /Cacti "/usr/local/share/cacti/"

   <Directory "/usr/local/share/cacti">
      Require all granted
      AllowOverride None
      Order Allow,deny
      Allow from all
   </Directory>

5. Open a Cacti login page in your web browser and login with
   admin/admin.

If you update cacti, open a login page and an updating process will
start automatically.

NOTEs as of 10Aug2014:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

2) The PERL paths in the Cacti PERL scripts have been updated to
   /usr/local/bin.

=======================================================================

root@Junker# 





root@Junker# make deinstall
===>  Deinstalling for cacti
===>   Deinstalling cacti-0.8.8b_3
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0
packages in the universe):

Installed packages to be REMOVED:
        cacti-0.8.8b_3

The operation will free 5 MB
==> You should manually remove the "cacti" user. 
[1/1] Deleting cacti-0.8.8b_3: 100%
root@Junker# 





root@Junker# pkg add work/pkg/cacti-0.8.8b_3.txz 
===> Creating users and/or groups.
Using existing group 'cacti'.
Using existing user 'cacti'.
Installing cacti-0.8.8b_3: 100%
Message for cacti-0.8.8b_3:
 =======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database, a cacti user, and initialize:
   a) CREATE DATABASE cacti;
   b) Create a mysql user/password for cacti:
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
      FLUSH PRIVILEGES;
   c) Add GRANTS:
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
      FLUSH PRIVILEGES;
   d) Import the default cacti database:
      mysql --database=cacti -ucacti -p
< /usr/local/share/cacti/cacti.sql

 NOTE:
   * Cacti does not LOCK TABLES.

2. Edit /usr/local/share/cacti/include/config.php from the template
   config.php.orig.

   PHP requires the time zone to be explicitly set rather that rely on
   the system time zone, otherwise poller complains. I added the
   following line to my config.php:

   date_default_timezone_set('America/Los_Angeles');

3. Add the following line to cron for cacti:
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php
> /dev/null 2>&1

4. Example Apache 2.4 configuration:

   LoadModule php5_module  libexec/apache22/libphp5.so

   <FilesMatch "\.php$">
       SetHandler application/x-httpd-php
   </FilesMatch>
   <FilesMatch "\.phps$">
       SetHandler application/x-httpd-php-source
   </FilesMatch>

   DirectoryIndex index.php

   DocumentRoot "/usr/local/share/cacti"
 
   Alias /cacti "/usr/local/share/cacti/"
   Alias /Cacti "/usr/local/share/cacti/"

   <Directory "/usr/local/share/cacti">
      Require all granted
      AllowOverride None
      Order Allow,deny
      Allow from all
   </Directory>

5. Open a Cacti login page in your web browser and login with
   admin/admin.

If you update cacti, open a login page and an updating process will
start automatically.

NOTEs as of 10Aug2014:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

2) The PERL paths in the Cacti PERL scripts have been updated to
   /usr/local/bin.

=======================================================================
root@Junker# 





root@Junker# make check-plist
/!\ WARNING /!\
DEFAULT_PHP_VER is defined, consider using DEFAULT_VERSIONS=php=55
instead

===>  License GPLv2 accepted by the user
===>   cacti-0.8.8b_3 depends on file: /usr/local/sbin/pkg - found
cd /usr/ports/distfiles/;
_PATCH_SITES_DEFAULT="http://www.cacti.net/downloads/patches/0.8.8b/" ;
for _file in security.patch; do  file=`echo $_file | /usr/bin/sed -E -e
's/:[^-:][^:]*$//'` ;  select=`echo ${_file#${file}} | /usr/bin/sed -e
's/^://' -e 's/,/ /g'` ;  file=`echo $file | /usr/bin/sed -E -e
's/:-[^:]+$//'` ;  force_fetch=false;  filebasename=${file##*/};  for
afile in ; do  afile=${afile##*/};  if [ "x$afile" = "x$filebasename" ];
then  force_fetch=true;  fi;  done;  if [ ! -f $file -a ! -f
$filebasename -o "$force_fetch" = "true" ]; then  if [ -L $file -o -L
${file##*/} ]; then  echo "=> /usr/ports/distfiles//$file is a broken
symlink.";  echo "=> Perhaps a filesystem (most likely a CD) isn't
mounted?";  echo "=> Please correct this problem and try again.";  exit
1;  fi;  echo "=> $file doesn't seem to exist
in /usr/ports/distfiles/.";  if [ ! -z "$select" ] ; then
__PATCH_SITES_TMP= ;  for group in $select; do  if [ ! -z \
${_PATCH_SITES_${group}} ] ; then  eval ___PATCH_SITES_TMP="\
${_PATCH_SITES_${group}}" ;  __PATCH_SITES_TMP="${__PATCH_SITES_TMP}
${___PATCH_SITES_TMP}" ;  fi;  done;  ___PATCH_SITES_TMP= ;
SORTED_PATCH_SITES_CMD_TMP="echo  `echo ${__PATCH_SITES_TMP}
| /usr/bin/awk 'BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl =
"://[^/]*/"; } /:\\/\\/[^\\/]*\\// { good["://[^/]*/"] =
good["://[^/]*/"] " " $0 ; next; } { rest = rest " " $0; } END
{ n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print
rest; }'` http://distcache.FreeBSD.org/ports-distfiles/" ;  else
SORTED_PATCH_SITES_CMD_TMP="cd /root/cacti && make
patch-sites-DEFAULT" ;  fi;  sites_remaining=0;  sites="`eval
$SORTED_PATCH_SITES_CMD_TMP`";  for site in ${sites}; do
sites_remaining=$((${sites_remaining} + 1));  done;  for site in
${sites}; do  sites_remaining=$((${sites_remaining} - 1));  echo "=>
Attempting to fetch ${site}${file}";  CKSIZE=`alg=SIZE; if [ \( -n "" -a
-n "" \) -o ! -f "/root/cacti/distinfo" ]; then exit; fi;
DIR=; /usr/bin/awk -v alg=$alg -v file=${DIR:+$DIR/}${file}      '$1 == alg
&& $2 == "(" file ")" {print $4}' /root/cacti/distinfo`;  case ${file}
in  */*)        /bin/mkdir -p ${file%/*};  args="-o ${file} ${site}${file}";;
*)              args=${site}${file};;  esac;  if /usr/bin/env SSL_NO_VERIFY_PEER=1
SSL_NO_VERIFY_HOSTNAME=1 /usr/bin/fetch -Fpr ${CKSIZE:+-S $CKSIZE}
${args} ; then  actual_size=`stat -f %z "${file}"`;  if [ -n "" ] ||
[ -z "${CKSIZE}" ] || [ ${actual_size} -eq ${CKSIZE} ]; then  continue
2;  else  echo "=> Fetched file size mismatch (expected ${CKSIZE},
actual ${actual_size})";  if [ ${sites_remaining} -gt 1 ]; then  echo
"=> Trying next site";  /bin/rm -f -f ${file};  fi;  fi;  fi;  done;
echo "=> Couldn't fetch it - please try to retrieve this"; echo "=> port
manually into /usr/ports/distfiles/ and try again.";  exit 1;  fi;  done
===> Fetching all distfiles required by cacti-0.8.8b_3 for building
===>  Extracting for cacti-0.8.8b_3
=> SHA256 Checksum OK for cacti-0.8.8b.tar.gz.
=> SHA256 Checksum OK for security.patch.
===>  Patching for cacti-0.8.8b_3
===>  Applying distribution patches for cacti-0.8.8b_3
===>  Applying FreeBSD patches for cacti-0.8.8b_3
/bin/rm -f
-r  /root/cacti/work/cacti-0.8.8b/log /root/cacti/work/cacti-0.8.8b/rra
===>   cacti-0.8.8b_3 depends on shared library: libmysqlclient.so.18 -
found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>  Configuring for cacti-0.8.8b_3
===>  Staging for cacti-0.8.8b_3
===>   cacti-0.8.8b_3 depends on executable: rrdtool - found
===>   cacti-0.8.8b_3 depends on file: /usr/local/include/php/main/php.h
- found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/mysql.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/session.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/sockets.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/snmp.so - found
===>   cacti-0.8.8b_3 depends on
file: /usr/local/lib/php/20121212/xml.so - found
===>   Generating temporary packing list
===> Creating users and/or groups.
=======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database, a cacti user, and initialize:
   a) CREATE DATABASE cacti;
   b) Create a mysql user/password for cacti:
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
      FLUSH PRIVILEGES;
   c) Add GRANTS:
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
      FLUSH PRIVILEGES;
   d) Import the default cacti database:
      mysql --database=cacti -ucacti -p
< /usr/local/share/cacti/cacti.sql

 NOTE:
   * Cacti does not LOCK TABLES.

2. Edit /usr/local/share/cacti/include/config.php from the template
   config.php.orig.

   PHP requires the time zone to be explicitly set rather that rely on
   the system time zone, otherwise poller complains. I added the
   following line to my config.php:

   date_default_timezone_set('America/Los_Angeles');

3. Add the following line to cron for cacti:
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php
> /dev/null 2>&1

4. Example Apache 2.4 configuration:

   LoadModule php5_module  libexec/apache22/libphp5.so

   <FilesMatch "\.php$">
       SetHandler application/x-httpd-php
   </FilesMatch>
   <FilesMatch "\.phps$">
       SetHandler application/x-httpd-php-source
   </FilesMatch>

   DirectoryIndex index.php

   DocumentRoot "/usr/local/share/cacti"
 
   Alias /cacti "/usr/local/share/cacti/"
   Alias /Cacti "/usr/local/share/cacti/"

   <Directory "/usr/local/share/cacti">
      Require all granted
      AllowOverride None
      Order Allow,deny
      Allow from all
   </Directory>

5. Open a Cacti login page in your web browser and login with
   admin/admin.

If you update cacti, open a login page and an updating process will
start automatically.

NOTEs as of 10Aug2014:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

2) The PERL paths in the Cacti PERL scripts have been updated to
   /usr/local/bin.

=======================================================================
====> Compressing man pages (compress-man)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for directories owned by MTREEs
===> Checking for directories handled by dependencies
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)
root@Junker# 





portlint produced some minor output:

root@Junker# portlint
WARN: Makefile: [0]: possible direct use of command "file" found. use
${FILE} instead.
WARN: Makefile: DISTNAME is ${PORTNAME}-${PORTVERSION} by default, you
don't need to define DISTNAME.
0 fatal errors and 2 warnings found.

I don't know why portlint is complaining about "file."

DISTNAME was previously defined. I simply left it alone.
Comment 3 John Marino freebsd_committer 2014-08-12 18:55:31 UTC
alright.
The only thing that stands out for me is the first lines:
root@Junker# make stage
/!\ WARNING /!\
DEFAULT_PHP_VER is defined, consider using DEFAULT_VERSIONS=php=55
instead

Is there a technical reason for defining DEFAULT_PHP_VER ?
Comment 4 Dennis Glatting 2014-08-12 19:18:53 UTC
> Is there a technical reason for defining DEFAULT_PHP_VER ?
> 

Not for Cacti. It is defined in one of my /etc/make.conf files because it was necessary at one time on one platform. I simply haven't updated the appropriate file.

My make.conf defines some parameters then brings in common and local customizations. Files common across the platforms, such as make.conf and mergemaster.rc, are managed under RCS then distributed across them.

My managed make.conf looks like this:

GCC_DEFAULT_VERSION=4.9 
PYTHON_VERSION=python2.7 
PERL_VERSION=5.18.2
PHP_VER=55

DEFAULT_PHP_VER=${PHP_VER}
DEFAULT_VERSIONS="perl5=${PERL_VERSION} tcltk=8.6 php=${PHP_VER}"


.if exists(${__MAKE_CONF}.common)
.include "${__MAKE_CONF}.common"
.endif


.if exists(${__MAKE_CONF}.local)
.include "${__MAKE_CONF}.local"
.endif
Comment 5 John Marino freebsd_committer 2014-08-12 19:20:59 UTC
okay, so the warning stemmed from your make.conf, not the port itself.

Okay, sounds good.  Let's move this to patch ready and hope not using poudriere doesn't came back to bite (only poudriere can test for missing dependencies and file system violations)
Comment 6 John Marino freebsd_committer 2014-08-15 09:36:56 UTC
I'll take pity on this one. :)
Comment 7 Kurt Jaeger freebsd_committer 2014-08-15 10:02:15 UTC
I'm done with the port 8-) Can I commit it ?
Comment 8 Kurt Jaeger freebsd_committer 2014-08-15 10:04:17 UTC
Created attachment 145809 [details]
patch to commit

As described...
Comment 9 John Marino freebsd_committer 2014-08-15 10:06:04 UTC
Sure, go ahead. I've assigned it to you.
It's a good idea to grab assignment even if all you are doing is testing to avoid duplication of effort.
Comment 10 commit-hook freebsd_committer 2014-08-15 10:43:52 UTC
A commit references this bug:

Author: pi
Date: Fri Aug 15 10:43:45 UTC 2014
New revision: 364957
URL: http://svnweb.freebsd.org/changeset/ports/364957

Log:
  net-mgmt/cacti: add stage support

  PR:		192618
  Submitted by:	Dennis Glatting <freebsd@pki2.com>

Changes:
  head/net-mgmt/cacti/Makefile
  head/net-mgmt/cacti/distinfo
  head/net-mgmt/cacti/files/patch-include__global.php
  head/net-mgmt/cacti/files/patch-include__global_settings.php
  head/net-mgmt/cacti/files/patch-install__index.php
  head/net-mgmt/cacti/files/patch-lib-rrd.php
  head/net-mgmt/cacti/files/patch-lib__rrd.php
  head/net-mgmt/cacti/files/patch-scripts-diskfree.pl
  head/net-mgmt/cacti/files/patch-scripts-ping.pl
  head/net-mgmt/cacti/files/patch-scripts__3com_cable_modem.pl
  head/net-mgmt/cacti/files/patch-scripts__diskfree.pl
  head/net-mgmt/cacti/files/patch-scripts__linux_memory.pl
  head/net-mgmt/cacti/files/patch-scripts__loadavg.pl
  head/net-mgmt/cacti/files/patch-scripts__loadavg_multi.pl
  head/net-mgmt/cacti/files/patch-scripts__ping.pl
  head/net-mgmt/cacti/files/patch-scripts__query_unix_partitions.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_processes.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_tcp_connections.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_users.pl
  head/net-mgmt/cacti/files/patch-scripts__weatherbug.pl
  head/net-mgmt/cacti/files/patch-scripts__webhits.pl
  head/net-mgmt/cacti/files/pkg-install.in
  head/net-mgmt/cacti/files/pkg-message.in
  head/net-mgmt/cacti/pkg-plist
Comment 11 Kurt Jaeger freebsd_committer 2014-08-15 10:44:23 UTC
Committed, thank you very much!
Comment 12 matt 2014-08-15 16:51:42 UTC
This change seems to have broken my local cacti install. I did not see anything in UPDATING about any sort of migration, but the bug mentions that cacti is now following hier. I do not see any rrd files in /var/db/cacti, while they are still in /user/share/cacti. Do I need to migrate these files before Cacti will work again? The log file also contains no errors, and there is no log file in /var/log/cacti.
Comment 13 matt 2014-08-15 17:20:37 UTC
I copied the rrd files from /usr/local/share/cacti/rra to /var/db/cacti/rra and my graphs started generating again. However, the poller was still writing to /usr/local/share/cacti/rra. I had to go through each of the data sources in the admin interface and save them in order to get the poller to write to the correct path. It seems that <path_rra> is expanded and saved to the database, which means each record needs to be updated if that path changes.

The log file continues to write to /usr/local/share/cacti, however I see in the admin interface that the default is /var/log/cacti and if I clear the configuration field it should write to the expected place.
Comment 14 Kurt Jaeger freebsd_committer 2014-08-15 18:07:38 UTC
(In reply to matt from comment #12)
> This change seems to have broken my local cacti install. I did not see
> anything in UPDATING about any sort of migration, but the bug mentions that
> cacti is now following hier.

This change is mentioned in the message that is displayed right after
the installation:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

But you are right, the submitter and I did not think this through, some
guidance on how to handle an upgrade should have been provided.
Comment 15 commit-hook freebsd_committer 2014-08-15 18:12:23 UTC
A commit references this bug:

Author: pi
Date: Fri Aug 15 18:11:35 UTC 2014
New revision: 365015
URL: http://svnweb.freebsd.org/changeset/ports/365015

Log:
  net-mgmt/cacti: replace most perl patches with shebangfix

  PR:		192618
  Submitted by:	Lars Engels <lars.engels@0x20.net>

Changes:
  head/net-mgmt/cacti/Makefile
  head/net-mgmt/cacti/files/patch-scripts__3com_cable_modem.pl
  head/net-mgmt/cacti/files/patch-scripts__diskfree.pl
  head/net-mgmt/cacti/files/patch-scripts__linux_memory.pl
  head/net-mgmt/cacti/files/patch-scripts__loadavg.pl
  head/net-mgmt/cacti/files/patch-scripts__loadavg_multi.pl
  head/net-mgmt/cacti/files/patch-scripts__ping.pl
  head/net-mgmt/cacti/files/patch-scripts__query_unix_partitions.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_processes.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_tcp_connections.pl
  head/net-mgmt/cacti/files/patch-scripts__unix_users.pl
  head/net-mgmt/cacti/files/patch-scripts__weatherbug.pl
  head/net-mgmt/cacti/files/patch-scripts__webhits.pl
Comment 16 Dennis Glatting 2014-08-15 21:19:12 UTC
(In reply to commit-hook from comment #15)
> A commit references this bug:
> 
> Author: pi
> Date: Fri Aug 15 18:11:35 UTC 2014
> New revision: 365015
> URL: http://svnweb.freebsd.org/changeset/ports/365015
> 
> Log:
>   net-mgmt/cacti: replace most perl patches with shebangfix
> 
>   PR:		192618
>   Submitted by:	Lars Engels <lars.engels@0x20.net>
> 
> Changes:
>   head/net-mgmt/cacti/Makefile
>   head/net-mgmt/cacti/files/patch-scripts__3com_cable_modem.pl
>   head/net-mgmt/cacti/files/patch-scripts__diskfree.pl
>   head/net-mgmt/cacti/files/patch-scripts__linux_memory.pl
>   head/net-mgmt/cacti/files/patch-scripts__loadavg.pl
>   head/net-mgmt/cacti/files/patch-scripts__loadavg_multi.pl
>   head/net-mgmt/cacti/files/patch-scripts__ping.pl
>   head/net-mgmt/cacti/files/patch-scripts__query_unix_partitions.pl
>   head/net-mgmt/cacti/files/patch-scripts__unix_processes.pl
>   head/net-mgmt/cacti/files/patch-scripts__unix_tcp_connections.pl
>   head/net-mgmt/cacti/files/patch-scripts__unix_users.pl
>   head/net-mgmt/cacti/files/patch-scripts__weatherbug.pl
>   head/net-mgmt/cacti/files/patch-scripts__webhits.pl

I wasn't away of shebangfix. Thanks..
Comment 17 Dennis Glatting 2014-08-15 21:24:14 UTC
(In reply to Kurt Jaeger from comment #14)
> (In reply to matt from comment #12)
> > This change seems to have broken my local cacti install. I did not see
> > anything in UPDATING about any sort of migration, but the bug mentions that
> > cacti is now following hier.
> 
> This change is mentioned in the message that is displayed right after
> the installation:
> 
> 1) Cacti now better supports hier(7)
> 
>    a) Cacti log files are now found under /var/log/cacti where you can
>       manage them using newsyslog.
>    b) Cacti RRD files are now found under /var/db/cacti/rra.
> 
> But you are right, the submitter and I did not think this through, some
> guidance on how to handle an upgrade should have been provided.

I did not think of those settings. Sorry.

On an initial install the settings come from a PHP file but as the install/upgrade web interface proceeds they are stuffed into a SQL database.


How should I proceed to resolve this issue? Write something and/or write a SQL script?
Comment 18 Kurt Jaeger freebsd_committer 2014-08-15 21:31:20 UTC
(In reply to Dennis Glatting from comment #17)
> > But you are right, the submitter and I did not think this through, some
> > guidance on how to handle an upgrade should have been provided.
> 
> I did not think of those settings. Sorry.
> 
> On an initial install the settings come from a PHP file but as the
> install/upgrade web interface proceeds they are stuffed into a SQL database.
> 
> How should I proceed to resolve this issue? Write something and/or write a
> SQL script?

I have no running cacti install at hand to understand the complexity of that task.
If you investigate and find a simple scriptable solution, that will be punished
with you becoming the maintainer of that port 8-}

If there is no easy solution, we must warn the users in /usr/ports/UPDATING and have to live with the fact.
Comment 19 Dennis Glatting 2014-08-15 21:34:25 UTC
(In reply to Dennis Glatting from comment #17)
> (In reply to Kurt Jaeger from comment #14)
> > (In reply to matt from comment #12)
> > > This change seems to have broken my local cacti install. I did not see
> > > anything in UPDATING about any sort of migration, but the bug mentions that
> > > cacti is now following hier.
> > 
> > This change is mentioned in the message that is displayed right after
> > the installation:
> > 
> > 1) Cacti now better supports hier(7)
> > 
> >    a) Cacti log files are now found under /var/log/cacti where you can
> >       manage them using newsyslog.
> >    b) Cacti RRD files are now found under /var/db/cacti/rra.
> > 
> > But you are right, the submitter and I did not think this through, some
> > guidance on how to handle an upgrade should have been provided.
> 
> I did not think of those settings. Sorry.
> 
> On an initial install the settings come from a PHP file but as the
> install/upgrade web interface proceeds they are stuffed into a SQL database.
> 
> 
> How should I proceed to resolve this issue? Write something and/or write a
> SQL script?


I should add that I was thinking pkg-message was getting a bit much and I was wondering if there was a better way to deliver those notes.

Also, what about UPDATING? Should something go in there?
Comment 20 matt 2014-08-15 21:35:10 UTC
I think a note plus a SQL script would be fine. It was pretty easy to fix once I figured out what had happened.

Regarding the package message, had I not noticed that I would have been banging my head against the wall for much longer. However, as it wasn't in UPDATING I assumed I didn't have to do anything unless I wanted files in the new locations.

Fortunately the poller continued to write to the old location and only the graphs broke -- so it shouldn't be a huge deal for anyone who immediately jumped on the update like I did.
Comment 21 Dennis Glatting 2014-08-15 22:00:39 UTC
(In reply to Kurt Jaeger from comment #18)
> (In reply to Dennis Glatting from comment #17)
> > > But you are right, the submitter and I did not think this through, some
> > > guidance on how to handle an upgrade should have been provided.
> > 
> > I did not think of those settings. Sorry.
> > 
> > On an initial install the settings come from a PHP file but as the
> > install/upgrade web interface proceeds they are stuffed into a SQL database.
> > 
> > How should I proceed to resolve this issue? Write something and/or write a
> > SQL script?
> 
> I have no running cacti install at hand to understand the complexity of that
> task.
> If you investigate and find a simple scriptable solution, that will be
> punished
> with you becoming the maintainer of that port 8-}
> 
> If there is no easy solution, we must warn the users in /usr/ports/UPDATING
> and have to live with the fact.

The SQL database content looks similar to this from a production server.  Changing the value entries is a simple matter.
 
mysql> USE cacti;
Database changed
mysql> SELECT * FROM settings;
+-----------------------------+-----------------------------+
| name                        |  value                      |
+-----------------------------+-----------------------------+
| path_cactilog               | /var/log/cacti.log          |
| path_php_binary             | /usr/local/bin/php          |
| path_rrdtool                | /usr/local/bin/rrdtool      |        
| path_snmpbulkwalk           | /usr/local/bin/snmpbulkwalk |
| path_snmpget                | /usr/local/bin/snmpget      |
| path_snmpgetnext            | /usr/local/bin/snmpgetnext  |
| path_snmpwalk               | /usr/local/bin/snmpwalk     |
| path_spine                  | /usr/local/bin/spine        |
| path_webroot                | /usr/local/share/cacti      |
...
+-----------------------------+-----------------------------+
Comment 22 Kurt Jaeger freebsd_committer 2014-08-15 22:08:05 UTC
(In reply to Dennis Glatting from comment #21)
> The SQL database content looks similar to this from a production server. 
> Changing the value entries is a simple matter.

And what would it be ?

update ... set ... ? Can you write it down explicitly for people like me
that have no running cacti to dig into 8-) ?
Comment 23 matt 2014-08-15 22:10:31 UTC
(In reply to Dennis Glatting from comment #21)
> The SQL database content looks similar to this from a production server. 
> Changing the value entries is a simple matter.
>  
> mysql> USE cacti;
> Database changed
> mysql> SELECT * FROM settings;

The path I had to change was in poller_item:

mysql> SLECT rrd_path FROM poller_item;

After the upgrade, this still pointed to /usr/local/share/cacti/rra. After saving the data sources in the admin interface, they were changed to /var/db/cacti/rra.

So, an update of rrd_path for all poller_items to substitute /usr/local/share/cacti/rra with /var/db/cacti/rra should do it.
Comment 24 Dennis Glatting 2014-08-16 01:05:48 UTC
(In reply to Kurt Jaeger from comment #22)
> (In reply to Dennis Glatting from comment #21)
> > The SQL database content looks similar to this from a production server. 
> > Changing the value entries is a simple matter.
> 
> And what would it be ?
> 
> update ... set ... ? Can you write it down explicitly for people like me
> that have no running cacti to dig into 8-) ?

Okay. That took a little work...

Updating the log file location in the database is easy:

UPDATE settings SET value='/var/log/cacti/cacti.log' WHERE name='path_cactilog';

I do not see a location specification for the rrd path in the database. Inspection of poller.php and spine indicates they call script_server.php which includes global.php which itself includes config.php. Consequently, there's nothing to change for the path. However, the location of each rrd file is stored in the table poller_item. That's a bit more tricky. The SQL would be:

UPDATE poller_item SET rrd_path = REPLACE(rrd_path,'/usr/local/share/cacti/rra','/var/db/cacti/rra') WHERE rrd_path REGEXP '^/usr/local/share/cacti/rra';

I tried this on my test instance and it worked as expected, amazingly.
Comment 25 Dennis Glatting 2014-08-16 03:22:17 UTC
(In reply to Dennis Glatting from comment #24)
> (In reply to Kurt Jaeger from comment #22)
> > (In reply to Dennis Glatting from comment #21)
> > > The SQL database content looks similar to this from a production server. 
> > > Changing the value entries is a simple matter.
> > 
> > And what would it be ?
> > 
> > update ... set ... ? Can you write it down explicitly for people like me
> > that have no running cacti to dig into 8-) ?
> 
> Okay. That took a little work...
> 
> Updating the log file location in the database is easy:
> 
> UPDATE settings SET value='/var/log/cacti/cacti.log' WHERE
> name='path_cactilog';
> 
> I do not see a location specification for the rrd path in the database.
> Inspection of poller.php and spine indicates they call script_server.php
> which includes global.php which itself includes config.php. Consequently,
> there's nothing to change for the path. However, the location of each rrd
> file is stored in the table poller_item. That's a bit more tricky. The SQL
> would be:
> 
> UPDATE poller_item SET rrd_path =
> REPLACE(rrd_path,'/usr/local/share/cacti/rra','/var/db/cacti/rra') WHERE
> rrd_path REGEXP '^/usr/local/share/cacti/rra';
> 
> I tried this on my test instance and it worked as expected, amazingly.

Does this change suffice:

root@Junker# diff -u files/pkg-message.in.orig files/pkg-message.in
--- files/pkg-message.in.orig	2014-08-15 20:16:44.000000000 -0700
+++ files/pkg-message.in	2014-08-15 20:20:52.000000000 -0700
@@ -67,6 +67,17 @@
       manage them using newsyslog.
    b) Cacti RRD files are now found under /var/db/cacti/rra.
 
+   If you have an existing Cacti installation these paths are also
+   found in Cacti's SQL database and MUST be updated. These two SQL
+   commands should do the trick:
+
+   UPDATE settings SET value='/var/log/cacti/cacti.log' \ 
+     WHERE name='path_cactilog';
+
+   UPDATE poller_item SET rrd_path=\
+     REPLACE(rrd_path,'/usr/local/share/cacti/rra','/var/db/cacti/rra') \
+     WHERE rrd_path REGEXP '^/usr/local/share/cacti/rra';
+
 2) The PERL paths in the Cacti PERL scripts have been updated to
    /usr/local/bin.
Comment 26 commit-hook freebsd_committer 2014-08-16 07:09:04 UTC
A commit references this bug:

Author: pi
Date: Sat Aug 16 07:08:40 UTC 2014
New revision: 365066
URL: http://svnweb.freebsd.org/changeset/ports/365066

Log:
  net-mgmt/cacti: update pkg-message

  - /var/log/cacti/cacti.log -> /var/log/cacti/log
  - hint how to update database after hier(7) adaptions
  - Submitter is now maintainer

  PR:		192618
  Submitted by:	Dennis Glatting <freebsd@pki2.com>

Changes:
  head/net-mgmt/cacti/files/patch-include__global_settings.php
  head/net-mgmt/cacti/files/patch-install__index.php
  head/net-mgmt/cacti/files/pkg-message.in