Last active
August 29, 2015 14:21
-
-
Save komeda-shinji/7021c2b90c9451045cdc to your computer and use it in GitHub Desktop.
Products/DataCollector/plugins/zenoss/cmd/linux/rpm.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
__doc__ = """ | |
zenoss.cmd.linux.rpm finds various software packages installed on a device. | |
Invoke rpm command via SSH session. | |
""" | |
from Products.DataCollector.plugins.CollectorPlugin \ | |
import LinuxCommandPlugin, SoftwareCommandPlugin | |
from Products.ZenUtils.Utils import prepId | |
from Products.DataCollector.plugins.DataMaps import MultiArgs | |
def parseResults(results): | |
swdicts = [] | |
for line in results.splitlines(): | |
name = line.lstrip() | |
if name: | |
id = self.prepId(name) | |
vendor = 'Unknown' | |
sw = {'id': id, 'setProductKey': MultiArgs(name, prepId(vendor))} | |
swdicts.append(sw) | |
return swdicts | |
class rpm(LinuxCommandPlugin, SoftwareCommandPlugin): | |
maptype = "SoftwareMap" | |
modname = "Products.ZenModel.Software" | |
relname = "software" | |
compname = "os" | |
command = '[ -x /bin/rpm ] && /bin/rpm -qa' | |
def __init__(self): | |
SoftwareCommandPlugin.__init__(self, parseResults) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment