Showing posts with label zenoss. Show all posts
Showing posts with label zenoss. Show all posts

Wednesday, 28 May 2014

Zenoss: CLI discovery and remodel

Become zenoss user 1st

su - zenoss 

Remodel a bunch

for i in server1 server2 server3;do zenmodeler run --now -d $i;done

Discover a bunch

for i in server1 server2 server3;do zendisc run --deviceclass=/Server/Linux --device=$i;done

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

Thursday, 18 July 2013

Zenoss: remodel all Linux servers at once



  1. su - zenoss
  2. zenmodeler run --path=/Server/Linux 

Tuesday, 25 June 2013

Zenoss: multi-graph report


Note: used version 3.x, other version nav my vary slightly
  1. Make a group
    1. create a new group under Infrastructure
    2. name it group001
    3. drag-and-drop a bunch of related servers into it
  2. Reports -> Multi-Graph Reports, left-nav
    1. Add Multi-Graph Report, bottom left-nav '+' sign
      1. name it report001
      2. Collections
        1. Add Collection
          1. def: a collection is just a previously defined set of devices
            1. like your group001
          2. name it collection001
            1. Group, in drop-down
            2. click on group001
            3. Add to Collection
        2. nav in 3.x sucks, click back on report name
          1. upper middle-nav "breadcrumb"
      3. Graph Definitions
        1. Add Graph
          1. name it graph001
          2. Graph Points
            1. Add DataPoint
              1. laLoadInt15_laLoadInt15
                1. hard to go wrong with this data point
                2. later, you can explore others
                3. naming can be very, very ugly
                  1. e.g. os/interfaces/eth0/ifOutOctets_ifOutOctets
          3. nav sucks, click back on report name in breadcrumb
      4. Graph Groups
        1. Add Graph Group
          1. name it graphgroup001
          2. select
            1. collection: collection001
            2. graph definition: graph001
            3. method: All devices on single graph
            4. save
        2. nav sucks, click back on report name in breadcrumb
    2. View Report, upper, upper left-nav
      1. should see some points plotted on a graph for all servers in your "group
      2. one can always go back to reports main screen to view report

Thursday, 6 June 2013

Zenoss: Linux SSH commands


  1. On CLI
    1. su - zenoss
    2. zenpack --list
    3. wget http://community.zenoss.org/servlet/JiveServlet/download/3435-6-2917/ZenPacks.zenoss.LinuxMonitor-1.1.5-py2.6.egg.zip
      1. unzip
      2. zenpack --install ZenPacks.zenoss.LinuxMonitor-1.1.5-py2.6.egg
    4. wget http://community.zenoss.org/servlet/JiveServlet/download/3493-6-3219/ZenPacks.community.LinuxMonitorAddOn-1.0-py2.6.egg.zip
      1. unzip 
      2. zenpack --install ZenPacks.community.LinuxMonitorAddOn-1.0-py2.6.egg
    5. Restart zenoss so all stuff is picked up
      1. shouldn't be necessary, but Monitoring Templates were missing/erroring for me without
  2. Via web interface
    1. Drag-and-drop server from Device list into Interface -> Device classes -> Server -> SSH -> Linux
    2. Set that servers Configuration Properties
      1. zCommandUsername
      2. zCommandPassword
      3. This requires that you have at least one user that can SSH in via a password

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...