Skip to content

Instantly share code, notes, and snippets.

@jstanley23
Last active August 29, 2015 14:05
Show Gist options
  • Save jstanley23/78f62f2cef722abb8905 to your computer and use it in GitHub Desktop.
Save jstanley23/78f62f2cef722abb8905 to your computer and use it in GitHub Desktop.
ZenModeler HTML Results Collector Builder
#!/usr/bin/env python
import datetime
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
dmd = ZenScriptBase(connect=True).dmd
zenoss_url = "https://REPLACEURL.COM"
collector_file = "/opt/zenmodel/index.html"
f = open(collector_file, "w")
collectors = dmd.Monitors.getPerformanceMonitorNames()
html_body = """
<style type="text/css">
<!--
.tab { margin-left: 40px; }
-->
</style>
<body size=11><font face="calibri">
<h1>Zenoss Collectors</h1>
"""
f.write(html_body)
for c in collectors:
col_link = ' <li><a href="%s/zenmodel/%s.html">%s</a></li>\n' % (zenoss_url, c, c)
f.write(col_link)
f.write("<br><br>\n")
last_update = (datetime.datetime.today()).strftime("Last Updated on %a, %b %d %Y %H:%M:%S %Z\n")
f.write(last_update)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment