From: Stephen Soltesz Date: Fri, 24 Apr 2009 23:21:32 +0000 (+0000) Subject: remove zabbix from spec file. X-Git-Tag: Monitor-2.0-11~8 X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=commitdiff_plain;h=6dfabcd2ef4d6a9a4cf91e71fc5edfe8a005a417 remove zabbix from spec file. add better exceptions to pcucontrol models add extra delete statements for findbad tables in plccache --- diff --git a/Monitor.spec b/Monitor.spec index 9b244af..62a33f9 100644 --- a/Monitor.spec +++ b/Monitor.spec @@ -53,8 +53,8 @@ Summary: Monitor hooks for the PLC server. Group: Applications/System Requires: python -Requires: python-sqlalchemy -Requires: python-elixir +#Requires: python-sqlalchemy +#Requires: python-elixir Requires: openssh-clients Requires: perl-libwww-perl @@ -65,9 +65,9 @@ Requires: nmap Requires: PLCWWW >= 4.2 Requires: bootcd-planetlab-i386 >= 4.2 -Requires: zabbix-client -Requires: zabbix-gui -Requires: zabbix-server +#Requires: zabbix-client +#Requires: zabbix-gui +#Requires: zabbix-server %description server The server side include all python modules and scripts needed to fully @@ -204,10 +204,10 @@ rm -rf $RPM_BUILD_ROOT # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now). # NOTE: generate the python defines from zabbix include files. -php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py +#php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py # apply patches to zabbix -patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff +#patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff #chkconfig --add monitor-server #chkconfig monitor-server on diff --git a/monitor-server.init b/monitor-server.init index b627c17..da59127 100644 --- a/monitor-server.init +++ b/monitor-server.init @@ -364,8 +364,8 @@ case "$1" in check_monitor_conf check_monitor_schema_and_data - check_pg_hba $ZABBIX_DB_NAME $ZABBIX_DB_USER - check_user_and_db $ZABBIX_DB_NAME $ZABBIX_DB_USER + #check_pg_hba $ZABBIX_DB_NAME $ZABBIX_DB_USER + #check_user_and_db $ZABBIX_DB_NAME $ZABBIX_DB_USER if [ -n "$WROTE_PG_CONFIG" ] ; then # NOTE: restart db to enable access by users granted above. @@ -375,8 +375,8 @@ case "$1" in dialog "$MESSAGE" fi - check_zabbix_schema_and_data - check_zabbix_templates_and_import + #check_zabbix_schema_and_data + #check_zabbix_templates_and_import # create /etc/httpd/conf.d/monitorweb.conf @@ -390,9 +390,9 @@ case "$1" in start_tg_server # START zabbix services. SETUP default config files. - check_zab_server - check_zab_agentd - check_zab_webconfig + #check_zab_server + #check_zab_agentd + #check_zab_webconfig result "$MESSAGE" ;; @@ -428,8 +428,8 @@ case "$1" in MESSAGE=$"Deleting databases..." dialog "$MESSAGE" - dropdb -U postgres $ZABBIX_DB_NAME - dropuser -U postgres $ZABBIX_DB_USER + #dropdb -U postgres $ZABBIX_DB_NAME + #dropuser -U postgres $ZABBIX_DB_USER dropdb -U postgres $MONITOR_DB_NAME dropuser -U postgres $MONITOR_DB_USER @@ -442,8 +442,8 @@ case "$1" in dialog "$MESSAGE" stop_tg_server - service zabbix_server stop - service zabbix_agentd stop + #service zabbix_server stop + #service zabbix_agentd stop # TODO: is there anything to stop? result "$MESSAGE" ;; diff --git a/monitor/wrapper/plccache.py b/monitor/wrapper/plccache.py index 75ca49b..dc62d0d 100755 --- a/monitor/wrapper/plccache.py +++ b/monitor/wrapper/plccache.py @@ -159,6 +159,7 @@ def sync(): dbpcu.plc_pcu_stats = pcu deleteExtra(l_pcus, PlcPCU, 'pcu_id', 'pcu_id') deleteExtra(l_pcus, HistoryPCURecord, 'plc_pcuid', 'pcu_id') + deleteExtra(l_pcus, FindbadPCURecord, 'plc_pcuid', 'pcu_id') session.flush() print "sync nodes" @@ -169,6 +170,7 @@ def sync(): dbnode.plc_node_stats = node deleteExtra(l_nodes, PlcNode, 'hostname', 'hostname') deleteExtra(l_nodes, HistoryNodeRecord, 'hostname', 'hostname') + deleteExtra(l_nodes, FindbadNodeRecord, 'hostname', 'hostname') session.flush() init() @@ -176,6 +178,6 @@ def sync(): return if __name__ == '__main__': - profile.run('sync()') + sync() else: init() diff --git a/nodeconfig.py b/nodeconfig.py index 3fe9a84..6a23fb7 100755 --- a/nodeconfig.py +++ b/nodeconfig.py @@ -7,7 +7,6 @@ api = plc.getAuthAPI() from monitor import parser as parsermodule from sets import Set -from monitor.common import * from monitor.database.info.model import FindbadNodeRecord def network_config_to_str(net): @@ -46,7 +45,8 @@ def main(): node_keys = ['boot_state', 'key', 'last_updated', 'last_contact'] for k in node_keys: if 'last' in k: - print "%15s == %s" % (k, diff_time(n[k])) + #print "%15s == %s" % (k, diff_time(n[k])) + print "%15s == %s" % (k, n[k]) else: print "%15s == %s" % (k, n[k]) @@ -55,8 +55,9 @@ def main(): #for k in net.keys(): # print k, "==" , net[k] except: + #from monitor.common import email_exception print "Error with %s" % node - email_exception() + #email_exception() import traceback; print traceback.print_exc() pass diff --git a/pcucontrol/models/BayTech.py b/pcucontrol/models/BayTech.py index 065cc28..5883c4b 100644 --- a/pcucontrol/models/BayTech.py +++ b/pcucontrol/models/BayTech.py @@ -123,8 +123,13 @@ class BayTechCtrlC(PCUControl): ssh_options="-o StrictHostKeyChecking=no -o PasswordAuthentication=yes -o PubkeyAuthentication=no" s = pxssh.pxssh() - if not s.login(self.host, self.username, self.password, ssh_options): - raise ExceptionPassword("Invalid Password") + try: + if not s.login(self.host, self.username, self.password, ssh_options): + raise ExceptionPassword("Invalid Password") + except pexpect.EOF: + raise ExceptionNoTransport("No Connection Possible") + + # Otherwise, the login succeeded. # Send a ctrl-c to the remote process. diff --git a/pcucontrol/models/IPAL.py b/pcucontrol/models/IPAL.py index a2ea026..641326f 100644 --- a/pcucontrol/models/IPAL.py +++ b/pcucontrol/models/IPAL.py @@ -21,7 +21,10 @@ class IPAL(PCUControl): ret = s.recv(count, socket.MSG_DONTWAIT) except socket.error, e: if e[0] == errno.EAGAIN: - raise Exception(e[1]) + #raise Exception(e[1]) + raise ExceptionNotFound(e[1]) + elif e[0] == errno.ETIMEDOUT: + raise ExceptionTimeout(e[1]) else: # TODO: not other exceptions. raise Exception(e) diff --git a/web/MonitorWeb/monitorweb/controllers.py b/web/MonitorWeb/monitorweb/controllers.py index 7cbaf4f..baf4901 100644 --- a/web/MonitorWeb/monitorweb/controllers.py +++ b/web/MonitorWeb/monitorweb/controllers.py @@ -180,7 +180,8 @@ class Root(controllers.RootController, MonitorXmlrpcServer): # NOTE: reformat some fields. prep_node_for_display(node) - node.history.status + #node.history.status + print node.hostname if node.history.status in ['down', 'offline']: if node.plc_node_stats and node.plc_node_stats['last_contact'] != None: