Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- ##----------------------------------------------------------------------
- ## OS.Linux.get_config
- ##----------------------------------------------------------------------
- ## Copyright (C) 2007-2015 The NOC Project
- ## See LICENSE for details
- ##----------------------------------------------------------------------
- ## Python modules
- import noc.sa.script
- ## NOC modules
- from noc.sa.interfaces import IGetConfig
- class Script(noc.sa.script.Script):
- name = "OS.FreeBSD.get_config"
- implements = [IGetConfig]
- def execute(self):
- config = ''
- config += "==[ hostname ]=="
- config += "\n"
- config += self.cli("hostname")
- config += "\n"
- config += "==[ uname -r -m ]=="
- config += "\n"
- config += self.cli("uname -r -m")
- config += "\n"
- config += "==[ ifconfig -v ]=="
- config += "\n"
- config += self.cli("ifconfig -v")
- config += "\n"
- config += "==[ netstat -nr ]=="
- config += "\n"
- config += self.cli("netstat -nr")
- config += "\n"
- config += "==[ /bin/cat /etc/crontab | grep -v '^#' ]=="
- config += "\n"
- config += self.cli("/bin/cat /etc/crontab | grep -v '^#'")
- config += "\n"
- config += "==[ /bin/cat /etc/rc.conf | grep -v '^#' | grep \"YES\" ]=="
- config += "\n"
- config += self.cli("/bin/cat /etc/rc.conf | grep -v '^#' | grep \"YES\"")
- config += "\n"
- if not config:
- raise Exception("Not implemented")
- config = self.cleaned_config(config)
- if self.encoding:
- config = unicode(config, self.encoding).encode("utf8", "ignore")
- return config
Add Comment
Please, Sign In to add comment