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
# 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
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
+
+ service plc start monitor
result "$MESSAGE"
;;
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'
import sys
import site
-from monitor.wrapper import plc
+from monitor.wrapper import plc, plccache
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]
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_true", dest="syncsite",
+ parser.add_option("", "--nosite", action="store_false", dest="syncsite",
help="Do not sync sites.")
parser.add_option("", "--site", dest="site",
help="Sync only given site name.")
zabbixsite.setup_global()
if opts.syncsite:
+ api = plc.getAuthAPI()
query = {'peer_id' : None}
if opts.site:
query.update({'login_base' : opts.site})