Saturday, 2 November 2013

Zenoss on Amazon Linux

Someone saved my life tonight, Sugarbear: http://binarynature.blogspot.com/2012/11/zenoss-core-4-installation.html

Also taken: http://magazine.redhat.com/2007/12/04/hacking-rpms-with-rpmrebuild/

WARNING: USE AT OWN RISK
  1. remove non-critical, unmet dependencies in rpm
    1. get good version of rpmrebuild
      1. wget ftp://fr2.rpmfind.net/linux/opensuse/ports/update/12.3/noarch/rpmrebuild-2.9-7.4.1.noarch.rpm
      2. yum localinstall rpmrebuild-2.9-7.4.1.noarch.rpm
    2. wget http://downloads.sourceforge.net/project/zenoss/zenoss-4.2/zenoss-4.2.4/4.2.4-1897/zenoss_core-4.2.4-1897.el6.x86_64.rpm
    3. rpmrebuild -e -n -p zenoss_core-4.2.4-1897.el6.x86_64.rpm
      1. remove lines
        1. Requires:      libgcj
        2. %dir %attr(0755, root, root) "/etc/sudoers.d"
        3. # ensure that the system uses the /etc/sudoers.d directory
        4. SUDOERSD_TOKEN="#includedir /etc/sudoers.d"
        5. SUDOERSD_FOUND=`/bin/egrep "^$SUDOERSD_TOKEN" /etc/sudoers`
        6. if [ -z "$SUDOERSD_FOUND" ]; then
        7.    echo "# zenoss rpm, ensure that /etc/sudoers.d loads" >> /etc/sudoers
        8.    echo $SUDOERSD_TOKEN >> /etc/sudoers
        9. fi
      2. save file and "continue"
      3. note place resultant file is created, copy to local working directory
        1. if you can't find it where it is supposed to be
          1. yum -y install mlocate
          2. updatedb
          3. locate zenoss
  2. ntp
    1. ntpq -pn
    2. make sure ntp is installed and running
  3. java
    1. remove openjdk and install oracle java
      1. yum -y remove java jdk
      2. wget -N -O jre-6u31-linux-x64-rpm.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=59622
      3. chmod +x jre-6u31-linux-x64-rpm.bin
      4. ./jre-6u31-linux-x64-rpm.bin
    2. verify
      1. java -version
      2. echo $JAVA_HOME
    3. cover missing libgcj, not strictly necessary
      1. yum -y install ecj
      2. only for running java classes natively instead of using JVM
        1. about as obscure as it gets
  4. Add extra repos
    1. rpm --import http://dev.zenoss.org/yum/RPM-GPG-KEY-zenoss
    2. yum-config-manager --enable epel
    3. yum --nogpgcheck -y localinstall http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
  5. install some deps
    1. yum -y install memcached net-snmp
  6. start some dep services
    1. service memcached start
    2. service snmpd start
    3. chkconfig memcached on
    4. chkconfig snmpd on
  7. mysql
    1. yum -y install mysql-server
    2. service mysqld start
    3. chkconfig mysqld on
  8. install amazon linux compatible zenoss rpm you created above
    1. yum --nogpgcheck localinstall zenoss-4.2.4-1897.el6.x86_64.rpm
    2. echo > /opt/zenoss/var/zenpack_actions.txt
      1. you REALLY don't want these right now, install by-hand later
  9. start more dep services
    1. service rabbitmq-server start
    2. chkconfig rabbitmq-server on
  10. start and stop zenoss core, dbs and files are created
    1. service zenoss start;sleep 5;service zenoss stop
  11. post zenoss updates as zenoss user, then back to root user
    1. su -l zenoss
    2. wget --no-check-certificate https://raw.github.com/osu-sig/zenoss-autodeploy-4.2.3/master/secure_zenoss.sh
    3. sh secure_zenoss.sh
    4. egrep 'user|password' $ZENHOME/etc/global.conf | grep -v admin
    5. zodbpw=$(grep zodb-password $ZENHOME/etc/global.conf | awk '{print $2}')
    6. sed -i.orig "5s/zenoss/$zodbpw/" $ZENHOME/etc/zodb_db_{main,session}.conf
    7. tail -n +1 $ZENHOME/etc/zodb_db_{main,session}.conf
    8. exit
  12. set mysql password for zenoss user using password generated above
    1. mysql -u root -p
    2. SET PASSWORD FOR 'zenoss'@'localhost' = PASSWORD('18zmcTgYsA+AjczljwQd');
      1. sub your password in instead
  13. create zenoss user for rabbitmq
    1. vim set-rabbitmq-perms.sh
      1. grab code below and put in here
    2. sh set-rabbitmq-perms.sh
    3. service rabbitmq-server restart
  14. start zenoss final time
    1. service zenoss restart
    2. chkconfig zenoss on
    3. verify
      1. su -l zenoss -c 'zenoss status'
      2. rabbitmqctl -p /zenoss list_queues
  15. Add this line to the end of /etc/sudo.conf
    1. #includedir /etc/sudoers.d
    2. was removed during rpm tweak
NOTE: this is probably not perfect, but very close, please, send corrections

###################################################
## code for set-rabbitmq-perms.sh
#!/usr/bin/env bash
set -e
ZENHOME="/opt/zenoss"
VHOSTS="/zenoss"
USER="zenoss"
PASS="grep amqppassword \$ZENHOME/etc/global.conf | awk '{print \$2}'"
if [ $(id -u) -eq 0 ]
then
RABBITMQCTL=$(which rabbitmqctl)
$RABBITMQCTL stop_app
$RABBITMQCTL reset
$RABBITMQCTL start_app
$RABBITMQCTL add_user "$USER" "$(su -l zenoss -c "$PASS")"
for vhost in $VHOSTS; do
$RABBITMQCTL add_vhost "$vhost"
$RABBITMQCTL set_permissions -p "$vhost" "$USER" '.*' '.*' '.*'
done
exit 0
else
echo "Error: Run this script as the root user." >&2
exit 1

3 comments:

  1. After trying to save the file in the rpmrebuild, I get the error:
    rpm: -bb: unknown option
    /usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: package 'zenoss_core-4.2.4-1897.el5.x86_64.rpm' build failed

    ReplyDelete
  2. Let me know if this helps and I'll make it "Step #1": yum groupinstall "Development Tools"

    ReplyDelete
  3. this was truly awesome. thanks so much for this!!

    ReplyDelete

Note: only a member of this blog may post a comment.

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...