示例#1
0
def puppet_running():
    """Checks if puppet is running"""

    dataDict = {}
    (output,
     exitCode) = COM.runCommand(["/etc/sensu/plugins/check_puppet_agent"])
    dataDict['check'] = 'puppet_running'
    dataDict['value'] = output.strip()
    return COM.generateOutput(dataDict, exitCode)
示例#2
0
def puppet_ssl_expiry_autofix():
    """Copy of the puppet_ssl_expiry definition"""

    dataDict = {}
    (output, exitCode) = COM.runCommand([
        "/etc/sensu/plugins/check-ssl-cert.rb", "-c", "89", "-w", "90", "-P",
        "/etc/puppetlabs/puppet/ssl/certs/tukp-sensuserver-2.papt.to.pem"
    ])
    dataDict['check'] = 'puppet_ssl_expiry_autofix'
    dataDict['value'] = output.strip()
    return COM.generateOutput(dataDict, exitCode)
示例#3
0
def puppet_ssl_expiry():
    """Checks if the puppet cert is expiring within the next 80 days"""

    dataDict = {}
    (output, exitCode) = COM.runCommand([
        "/etc/sensu/plugins/check-ssl-cert.rb", "-c", "30", "-w", "80", "-P",
        "/etc/puppetlabs/puppet/ssl/certs/tukp-sensuserver-2.papt.to.pem"
    ])
    dataDict['check'] = 'puppet_ssl_expiry'
    dataDict['value'] = output.strip()
    return COM.generateOutput(dataDict, exitCode)
示例#4
0
def FunctionName():
    datadict = {}
    (output, exitCode) = COM.runCommand([
        "<command>", "<param 1>", "<param 2>"
    ])  # <--- Notice how each parameter is a comma separated string
    datadict["check"] = "FunctionName"
    datadict["label_name1"] = output.strip()
    datadict["label_name2"] = "Thing to record"
    # Secondary command example
    (output2,
     exitCode2) = COM.runCommand(["<supp. Command>", "<param3>", "<param4>"])
    datadict["label_name3"] = output2.strip()
    return COM.generateOutput(datadict, exitCode)
示例#5
0
'''
# ==================================================================
# Constraints
# ==================================================================
for i in V:
	m.addConstr(quicksum(decvarx[k] for k in Ko[i]) - quicksum(decvarx[k] for k in Kt[i]) == b[i], "Constr.1.%d" % (i))
	# =================================================================
	g.append(1)
	# =================================================================

'''
places an upper bound on decvarx[k], or labeled already within the decision variable definition
for k in range(1, n+1):
	m.addConstr(decvarx[k] <= u[k], "Constr.2.%d" %(k))
	# =================================================================
	g.append(2)
	# =================================================================
'''



# m.optimize()		<---  We won't need to actually solve these problems



# =================================================================
# Call our package to generate our required information:
m.update()
common.generateOutput(m, g, dprime, n, args["folder"], args["label"], bool(args["displayImages"]))
# =================================================================
示例#6
0
def Whoami():
    datadict = {}
    (output, exitCode) = COM.runCommand(["whoami"])
    datadict["check"] = "Whoami"
    datadict["user"] = output.strip()
    return COM.generateOutput(datadict, exitCode)
示例#7
0
def Tree():
    datadict = {}
    (output, exitCode) = COM.runCommand(["tree", "./", "--charset=ascii"])
    datadict["check"] = "Tree"
    datadict["data"] = output.strip()
    return COM.generateOutput(datadict, exitCode)
示例#8
0
def Pwd():
    datadict = {}
    (output, exitCode) = COM.runCommand(["pwd"])
    datadict["check"] = "Pwd"
    datadict["pwd"] = output.strip()
    return COM.generateOutput(datadict, exitCode)