Put the above code in the nagios class instead