示例#1
0
 def test_ok(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Ok
     from checkpkgaudit.checkpkgaudit import AuditSummary
     results = Results()
     ok_r1 = Result(Ok, '', nagiosplugin.Metric('met1', 0))
     ok_r2 = Result(Ok, '', nagiosplugin.Metric('met1', 0))
     results.add(ok_r1)
     results.add(ok_r2)
     summary = AuditSummary()
     sum_ok = summary.ok(results)
     self.assertEqual(sum_ok, '0 vulnerabilities found !')
 def test_ok(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Ok
     from checkpkgaudit.checkpkgaudit import AuditSummary
     results = Results()
     ok_r1 = Result(Ok, '', nagiosplugin.Metric('met1', 0))
     ok_r2 = Result(Ok, '', nagiosplugin.Metric('met1', 0))
     results.add(ok_r1)
     results.add(ok_r2)
     summary = AuditSummary()
     sum_ok = summary.ok(results)
     self.assertEqual(sum_ok, '0 vulnerabilities found !')
示例#3
0
 def test_problem_crit(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Critical
     from checkpkgaudit.checkpkgaudit import AuditSummary
     message = "found 2 vulnerable(s) pkg(s) in : ns1, ns2"
     results = Results()
     r1 = Result(Critical, '', nagiosplugin.Metric('ns1', 1))
     r2 = Result(Critical, '', nagiosplugin.Metric('ns2', 1))
     results.add(r1)
     results.add(r2)
     summary = AuditSummary()
     sum_crit = summary.problem(results)
     self.assertEqual(sum_crit, message)
示例#4
0
 def test_problem_unknown(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Critical, Unknown
     from checkpkgaudit.checkpkgaudit import AuditSummary
     hint = 'masterdns pkg: jail_attach(masterdns): Operation not permitted'
     results = Results()
     r1 = Result(Critical, '', nagiosplugin.Metric('met1', 1))
     r2 = Result(Unknown, hint, nagiosplugin.Metric('met1', 0))
     results.add(r1)
     results.add(r2)
     summary = AuditSummary()
     sum_unknown = summary.problem(results)
     self.assertEqual(sum_unknown, hint)
 def test_problem_crit(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Critical
     from checkpkgaudit.checkpkgaudit import AuditSummary
     message = "found 2 vulnerable(s) pkg(s) in : ns1, ns2"
     results = Results()
     r1 = Result(Critical, '', nagiosplugin.Metric('ns1', 1))
     r2 = Result(Critical, '', nagiosplugin.Metric('ns2', 1))
     results.add(r1)
     results.add(r2)
     summary = AuditSummary()
     sum_crit = summary.problem(results)
     self.assertEqual(sum_crit, message)
 def test_problem_unknown(self):
     from nagiosplugin.result import Result, Results
     from nagiosplugin.state import Critical, Unknown
     from checkpkgaudit.checkpkgaudit import AuditSummary
     hint = 'masterdns pkg: jail_attach(masterdns): Operation not permitted'
     results = Results()
     r1 = Result(Critical, '', nagiosplugin.Metric('met1', 1))
     r2 = Result(Unknown, hint, nagiosplugin.Metric('met1', 0))
     results.add(r1)
     results.add(r2)
     summary = AuditSummary()
     sum_unknown = summary.problem(results)
     self.assertEqual(sum_unknown, hint)