Useful commands for Zenoss 4.x (codename Avalon) are located here: useful_commands_zenoss4
mysql -u zenoss -p mysql -uroot
mtop mysqladmin processlist | grep -v Sleep show full processlist\G;
SHOW DATABASES; USE events; SHOW tables; DESCRIBE status; SHOW table status;
mysql events -e "show table status" mysql -uroot information_schema -e "select TABLE_NAME, TABLE_ROWS from TABLES where TABLE_SCHEMA = 'events'"
OPTIMIZE table status, history, alert_state, detail, LOG, heartbeat; ANALYZE table status, history, alert_state, detail, LOG, heartbeat;
DELETE h,j,d FROM history h LEFT JOIN j ON h.evid=j.evid LEFT JOIN detail d ON h.evid=d.evid WHERE statechange < DATE_SUB(NOW(), INTERVAL 33 DAY);
CREATE INDEX stateChange_idx ON history(stateChange);
# As root service zenoss stop service mysqld stop cd /var/lib mv mysql oldmysql mkdir mysql chown mysql:mysql mysql service mysqld start # As zenoss user zeneventbuild localhost root '' events 3306 mysql -uroot -e "grant all privileges on events.* to zenoss@localhost identified by 'zenoss'" start up zenoss CHECK tables through mysql prompt CHECK UI events console
mysqldump -uroot --routines events > events.sql mysql -uroot -p # mysql> CREATE DATABASE events; mysql> \. events.sql mysql> GRANT ALL ON events.* TO zenoss@IPADDRESS IDENTIFIED BY 'zenoss'; mysql> FLUSH PRIVILEGES;
chkconfig --list chkconfig mysqld on
SELECT severity, COUNT(severity) FROM history WHERE lastTime>(UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 MINUTE))) GROUP BY severity UNION ALL SELECT severity, COUNT(severity) FROM status WHERE lastTime>(UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 5 MINUTE))) GROUP BY severity;
zenmodeler run -v10 -d applianceincloset.zenoss.loc --collect=zenoss.snmp.HRSWRunMap
snmpwalk -v1 -c public applianceincloset.zenoss.loc .1.3.6.1.2.1.25
wmic -d99 -U "DOMAIN\Username%Password" //IP "select * from win32_process"
select * from win32_process
# prowalker.sh #!/bin/sh # # Update the SNMP version, community string and IP address in the command below. while [ 1 ]; do STAMP=`date %Y%m%d%H%M` echo "$STAMP: Walking process table.." snmpwalk -v2c -c public 127.0.0.1 .1.3.6.1.2.1.25.4 \ > procwalk.$STAMP sleep 60 done ll procwalk.* | wc -l grep -lr "string of process in files" . | wc -l
dmd.ZenUsers.manage_addUser('zenoss-support', 'zen0ss', ['Manager',]) commit()
zendmd from Products.ZenWidgets.ZenossPortlets.ZenossPortlets import portlets portlets
dmd.ZenUsers.manage_deleteUsers(["test"]) commit()
dmd.version
httpd = dmd.getObjByPath("/zport/dmd/Processes/Apache/osProcessClasses/httpd") for i in httpd.instances(): try: tmp = i.getDeviceLink("deviceOsDetail") print "found %s" % i.id except: print "/nDELETING %s/n" % i.id #comment this in after first run httpd.instances._remove(i)
for ec in dmd.Events.getSubOrganizers(): if ec.transform: print "=== %s ===" % ec.getOrganizerName() print ec.transform print for i in ec.instances(): if i.transform: print "=== %s/%s ===" % (ec.getOrganizerName(), i.id) print i.transform print
for device in dmd.Devices.Network.Switch.getSubDevices(): print device for interface in device.os.interfaces(): print " %s" % (interface) interface.monitor = False
The zeo database server is separate from the zope web server and needs to be on a different port, usually 8100 by default. Make sure that your zeo is on the proper port (in server/etc/zeo.conf I think) and that your zope instances are configured to access that port (in client1/etc/zope.conf I think).
The FileSystem database, an object database store for zope (ZODB)
fstest [-v[v]] Data.fs
fsrefs [-v] Data.fs
log.debug("message here")
zenhub debug
for pack in /opt/zenoss/packs/*.egg; do zenpack --install $pack; done
wget -O /dev/null http://admin:zenoss@localhost:8080/zport/dmd/Devices/Server/Linux/devices/build.zenoss.loc/deleteDevice
curl http://admin:zenoss@train4.zenoss.loc:8080/zport/dmd/Devices/Server/Linux/devices/build.zenoss.loc/deleteDevice
zenperfsnmp run -v10 -d <device_name_inserted_here> -c --showdeviceresults zenwebtx run -v10 -d <device_name_inserted_here>
zenwinperf run -c -v10 -d <device_name_inserted_here>
snmpwalk -v1 -c public applianceincloset.loc <oid_inserted_here_if_known>
dscl . -delete /Users/zenoss ; dscl . -delete /Groups/zenoss