git://git.onelab.eu
/
monitor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
170be1f
)
general improvements
author
Stephen Soltesz
<soltesz@cs.princeton.edu>
Wed, 19 Nov 2008 01:24:00 +0000
(
01:24
+0000)
committer
Stephen Soltesz
<soltesz@cs.princeton.edu>
Wed, 19 Nov 2008 01:24:00 +0000
(
01:24
+0000)
Monitor.spec
patch
|
blob
|
history
monitor-server.init
patch
|
blob
|
history
monitor/wrapper/plccache.py
patch
|
blob
|
history
zabbix/zabbixsite.py
patch
|
blob
|
history
zabbix/zabbixsync.py
patch
|
blob
|
history
diff --git
a/Monitor.spec
b/Monitor.spec
index
335ab16
..
c48facf
100644
(file)
--- a/
Monitor.spec
+++ b/
Monitor.spec
@@
-122,8
+122,8
@@
install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
-install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
-cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
+
#
install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
+
#
cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
%clean
rm -rf $RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
@@
-156,6
+156,9
@@
rm -rf $RPM_BUILD_ROOT
# TODO: update the content of automate_pl03.sh
# TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
# TODO: update the content of automate_pl03.sh
# 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
+
#chkconfig --add monitor-server
#chkconfig monitor-server on
#chkconfig --add monitor-server
#chkconfig monitor-server on
diff --git
a/monitor-server.init
b/monitor-server.init
index
df00751
..
21671bf
100644
(file)
--- a/
monitor-server.init
+++ b/
monitor-server.init
@@
-261,7
+261,12
@@
case "$1" in
MESSAGE=$"Syncing PLC db with Zabbix DB"
dialog "$MESSAGE"
MESSAGE=$"Syncing PLC db with Zabbix DB"
dialog "$MESSAGE"
+ # turn off zabbix server, etc. before writing to the db.
+ service plc stop monitor
+
$MONITORPATH/zabbix/zabbixsync.py --setupglobal &> /var/log/monitor-server
$MONITORPATH/zabbix/zabbixsync.py --setupglobal &> /var/log/monitor-server
+
+ service plc start monitor
result "$MESSAGE"
;;
result "$MESSAGE"
;;
diff --git
a/monitor/wrapper/plccache.py
b/monitor/wrapper/plccache.py
index
f872d7a
..
978e6bb
100755
(executable)
--- a/
monitor/wrapper/plccache.py
+++ b/
monitor/wrapper/plccache.py
@@
-21,6
+21,10
@@
def dsn_from_dsln(d_sites, id2lb, l_nodes):
lb2hn = {}
dsn = {}
hn2lb = {}
lb2hn = {}
dsn = {}
hn2lb = {}
+ for id in id2lb:
+ if id2lb[id] not in lb2hn:
+ lb2hn[id2lb[id]] = []
+
for node in l_nodes:
# this won't reach sites without nodes, which I guess isn't a problem.
if node['site_id'] in id2lb.keys():
for node in l_nodes:
# this won't reach sites without nodes, which I guess isn't a problem.
if node['site_id'] in id2lb.keys():
diff --git
a/zabbix/zabbixsite.py
b/zabbix/zabbixsite.py
index
76e9ea6
..
678c756
100755
(executable)
--- a/
zabbix/zabbixsite.py
+++ b/
zabbix/zabbixsite.py
@@
-73,6
+73,7
@@
def setup_global():
print "checking for correct configuration"
mediatype = MediaType.get_by(smtp_email=config.from_email)
if not mediatype:
print "checking for correct configuration"
mediatype = MediaType.get_by(smtp_email=config.from_email)
if not mediatype:
+ mediatype = MediaType.get_by(description="Email")
# NOTE: assumes smtp server is local to this machine.
print "updating email server configuration"
mediatype.smtp_server='localhost'
# NOTE: assumes smtp server is local to this machine.
print "updating email server configuration"
mediatype.smtp_server='localhost'
diff --git
a/zabbix/zabbixsync.py
b/zabbix/zabbixsync.py
index
fd2126e
..
6ab825f
100755
(executable)
--- a/
zabbix/zabbixsync.py
+++ b/
zabbix/zabbixsync.py
@@
-2,17
+2,16
@@
import sys
import site
import sys
import site
-from monitor.wrapper import plc
+from monitor.wrapper import plc
, plccache
from monitor import database
import zabbixsite
from monitor import database
import zabbixsite
-from monitor.database.dborm import session
+from monitor.database.dborm import
zab_session as
session
-print "test"
-plcdb = database.dbLoad("l_plcsites")
-netid2ip = database.dbLoad("plcdb_netid2ip")
-lb2hn = database.dbLoad("plcdb_lb2hn")
+plcdb =
plccache.l_sites #
database.dbLoad("l_plcsites")
+netid2ip =
plccache.plcdb_netid2ip #
database.dbLoad("plcdb_netid2ip")
+lb2hn =
plccache.plcdb_lb2hn #
database.dbLoad("plcdb_lb2hn")
def get_site_iplist(loginbase):
node_list = lb2hn[loginbase]
def get_site_iplist(loginbase):
node_list = lb2hn[loginbase]
@@
-43,7
+42,7
@@
if __name__=="__main__":
parser.set_defaults( setupglobal=False, syncsite=True, site=None)
parser.add_option("", "--setupglobal", action="store_true", dest="setupglobal",
help="Setup global settings.")
parser.set_defaults( setupglobal=False, syncsite=True, site=None)
parser.add_option("", "--setupglobal", action="store_true", dest="setupglobal",
help="Setup global settings.")
- parser.add_option("", "--nosite", action="store_
tru
e", dest="syncsite",
+ parser.add_option("", "--nosite", action="store_
fals
e", dest="syncsite",
help="Do not sync sites.")
parser.add_option("", "--site", dest="site",
help="Sync only given site name.")
help="Do not sync sites.")
parser.add_option("", "--site", dest="site",
help="Sync only given site name.")
@@
-53,6
+52,7
@@
if __name__=="__main__":
zabbixsite.setup_global()
if opts.syncsite:
zabbixsite.setup_global()
if opts.syncsite:
+ api = plc.getAuthAPI()
query = {'peer_id' : None}
if opts.site:
query.update({'login_base' : opts.site})
query = {'peer_id' : None}
if opts.site:
query.update({'login_base' : opts.site})