Skip to content

Instantly share code, notes, and snippets.

@JosefJezek
Last active March 26, 2019 17:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JosefJezek/9049819 to your computer and use it in GitHub Desktop.
Save JosefJezek/9049819 to your computer and use it in GitHub Desktop.
Create Wiki for Zenoss with MDwiki

Wiki for Zenoss Home

Create Wiki for Zenoss with MDwiki

zLinks

Add this link to zLinks of Devices Class

<a href="http://wiki.example.com/#!devices/${here/id}.md" target="_">Wiki</a>

Generate Device List and MD Files

#!/usr/bin/env zendmd

# Generate Device List and MD Files for mdwiki.info
# Author: [Josef Jezek](http://about.me/josefjezek)
# Donate: [Gittip](https://www.gittip.com/josefjezek)
# Link: [Gist](https://gist.github.com/9049819)
# Usage: generate-mdwiki.zendmd > devices

dic = {}

base_url_zenoss = 'http://zenoss.example.com'
base_url_glpi = 'http://glpi.example.com/glpi/front/search.php?globalsearch='

content = \
'''# [%s](%s) - [GLPI](%s)

## Owner

## Description

## Applications

## Backup

'''

for d in dmd.Devices.getSubDevicesGen():
    dic[d.id] = d.getPrimaryUrlPath()

for d in sorted(dic):
    print '- [%s](devices/%s.md) - TODO' % (d, d)
    f = open('%s.md' % d, 'w')
    url_zenoss = base_url_zenoss + dic[d]
    url_glpi = base_url_glpi + d.split('.', 1)[0]
    f.write(content % (d, url_zenoss, url_glpi))
    f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment