Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pysnmp.entity.rfc3413.oneliner import cmdgen
- cmdGen = cmdgen.CommandGenerator()
- #9201 Cartridge Free ColorQube Black Ink
- errorIndication, errorStatus, errorIndex, var9201K = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.131', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.1'
- )
- #9201 Cartridge Free ColorQube Cyan Ink
- errorIndication, errorStatus, errorIndex, var9201C = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.131', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.2'
- )
- #9201 Cartridge Free ColorQube Magenta Ink
- errorIndication, errorStatus, errorIndex, var9201M = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.131', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.3'
- )
- #9201 Cartridge Free ColorQube Yellow Ink
- errorIndication, errorStatus, errorIndex, var9201Y = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.131', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.4'
- )
- #7242 Black Toner
- errorIndication, errorStatus, errorIndex, var7242K = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.128', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.1'
- )
- #7242 Cyan Toner
- errorIndication, errorStatus, errorIndex, var7242C = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.128', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.4'
- )
- #7242 Magenta Toner
- errorIndication, errorStatus, errorIndex, var7242M = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.128', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.3'
- )
- #7242 Yellow Toner
- errorIndication, errorStatus, errorIndex, var7242Y = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.128', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.2'
- )
- val7242Kcap = int(4030)
- val7242CMYcap = int(1370)
- #M24 Black Toner
- errorIndication, errorStatus, errorIndex, varM24K = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.130', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.1'
- )
- #M24 Cyan Toner
- errorIndication, errorStatus, errorIndex, varM24C = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.130', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.4'
- )
- #M24 Magenta Toner
- errorIndication, errorStatus, errorIndex, varM24M = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.130', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.3'
- )
- #M24 Yellow Toner
- errorIndication, errorStatus, errorIndex, varM24Y = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.130', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.2'
- )
- valM24Kcap = int(26000)
- valM24CYcap = int(16000)
- valM24Mcap = int(15000)
- #8700X Cartridge Free ColorQube Black Ink
- errorIndication, errorStatus, errorIndex, var8700XK = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.132', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.1'
- )
- #8700X Cartridge Free ColorQube Cyan Ink
- errorIndication, errorStatus, errorIndex, var8700XC = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.132', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.2'
- )
- #8700X Cartridge Free ColorQube Magenta Ink
- errorIndication, errorStatus, errorIndex, var8700XM = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.132', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.3'
- )
- #8700X Cartridge Free ColorQube Yellow Ink
- errorIndication, errorStatus, errorIndex, var8700XY = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.132', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.4'
- )
- #C35 Black Toner
- errorIndication, errorStatus, errorIndex, varC35K = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.133', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.4'
- )
- #C35 Cyan Toner
- errorIndication, errorStatus, errorIndex, varC35C = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.133', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.1'
- )
- #C35 Magenta Toner
- errorIndication, errorStatus, errorIndex, varC35M = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.133', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.2'
- )
- #C35 Yellow Toner
- errorIndication, errorStatus, errorIndex, varC35Y = cmdGen.getCmd(
- cmdgen.CommunityData('public'),
- cmdgen.UdpTransportTarget(('10.187.48.133', 161)),
- '.1.3.6.1.2.1.43.11.1.1.9.1.3'
- )
- valC35Kcap = int(6000)
- valC35CMYcap = int(6000)
- colours = ["Cyan", "Magenta", "Yellow", "Black"]
- warnHalf = 50
- warnQuart = 25
- warnLow = 10
- var9201Cvalue = var9201C[0][1]
- var9201Mvalue = var9201M[0][1]
- var9201Yvalue = var9201Y[0][1]
- var9201Kvalue = var9201K[0][1]
- var7242Cvalue = int(var7242C[0][1]) / val7242CMYcap * 100
- var7242Mvalue = int(var7242M[0][1]) / val7242CMYcap * 100
- var7242Yvalue = int(var7242Y[0][1]) / val7242CMYcap * 100
- var7242Kvalue = int(var7242K[0][1]) / val7242Kcap * 100
- varM24Cvalue = int(varM24C[0][1]) / valM24CYcap * 100
- varM24Mvalue = int(varM24M[0][1]) / valM24Mcap * 100
- varM24Yvalue = int(varM24Y[0][1]) / valM24CYcap * 100
- varM24Kvalue = int(varM24K[0][1]) / valM24Kcap * 100
- var8700XCvalue = var8700XC[0][1]
- var8700XMvalue = var8700XM[0][1]
- var8700XYvalue = var8700XY[0][1]
- var8700XKvalue = var8700XK[0][1]
- varC35Cvalue = int(varC35C[0][1]) / valC35CMYcap * 100
- varC35Mvalue = int(varC35M[0][1]) / valC35CMYcap * 100
- varC35Yvalue = int(varC35Y[0][1]) / valC35CMYcap * 100
- varC35Kvalue = int(varC35K[0][1]) / valC35Kcap * 100
- x9201list = [var9201Cvalue, var9201Mvalue, var9201Yvalue, var9201Kvalue]
- x7242list = [var7242Cvalue, var7242Mvalue, var7242Yvalue, var7242Kvalue]
- xM24list = [varM24Cvalue, varM24Mvalue, varM24Yvalue, varM24Kvalue]
- x8700Xlist = [var8700XCvalue, var8700XMvalue, var8700XYvalue, var8700XKvalue]
- C35list = [varC35Cvalue, varC35Mvalue, varC35Yvalue, varC35Kvalue]
- print("Xerox ColorQube 9201")
- for index, value in enumerate(x9201list):
- if value < warnLow:
- print('%s %s' % (colours[index], "is low - Check your stock!"))
- elif value < warnQuart:
- print('%s %s' % (colours[index], "is below 25%"))
- elif value < warnHalf:
- print('%s %s' % (colours[index], "is below 50%"))
- else:
- print('%s %s' % (colours[index], "is OK!"))
- print("\nXerox WorkCentre 7242")
- for index, value in enumerate(x7242list):
- if value < warnLow:
- print('%s %s' % (colours[index], "is low - Check your stock!"))
- elif value < warnQuart:
- print('%s %s' % (colours[index], "is below 25%"))
- elif value < warnHalf:
- print('%s %s' % (colours[index], "is below 50%"))
- else:
- print('%s %s' % (colours[index], "is OK!"))
- print("\nXerox WorkCentre M24")
- for index, value in enumerate(xM24list):
- if value < warnLow:
- print('%s %s' % (colours[index], "is low - Check your stock!"))
- elif value < warnQuart:
- print('%s %s' % (colours[index], "is below 25%"))
- elif value < warnHalf:
- print('%s %s' % (colours[index], "is below 50%"))
- else:
- print('%s %s' % (colours[index], "is OK!"))
- print("\nXerox ColorQube 8700X")
- for index, value in enumerate(x8700Xlist):
- if value < warnLow:
- print('%s %s' % (colours[index], "is low - Check your stock!"))
- elif value < warnQuart:
- print('%s %s' % (colours[index], "is below 25%"))
- elif value < warnHalf:
- print('%s %s' % (colours[index], "is below 50%"))
- else:
- print('%s %s' % (colours[index], "is OK!"))
- print("\nKonica Mita C35")
- for index, value in enumerate(C35list):
- if value < warnLow:
- print('%s %s' % (colours[index], "is low - Check your stock!"))
- elif value < warnQuart:
- print('%s %s' % (colours[index], "is below 25%"))
- elif value < warnHalf:
- print('%s %s' % (colours[index], "is below 50%"))
- else:
- print('%s %s' % (colours[index], "is OK!"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement