Module: check_mk
Branch: master
Commit: 764c37a03240dd699ae171f570f499352d30579b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=764c37a03240dd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 25 11:10:20 2011 +0100
check conventions: Added some other thoughts
---
README.writing_checks | 18 +++++++++++++++++-
doc/helpers/validate_checks | 17 +++++++++++++++++
2 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/README.writing_checks b/README.writing_checks
index 3490073..2705f88 100644
--- a/README.writing_checks
+++ b/README.writing_checks
@@ -3,10 +3,24 @@ This file will help you to write *good* checks for Check_MK.
Check Naming:
*
-Code styling:
+Header notes:
+* Add lincense notes
+
+* Add author notes. At least a contact mail address.
+
+Coding styling:
+* Avoid long lines. In an optimal case your lines don't exceed 80 chars.
+ 100 chars.
+
* Use four spaces for intending your code. Just don't use tab chars.
And if you relly can't life without tabs set the tab width to 8 spaces.
+* Variable naming. Use lower case variable names where the keywords are splitted by _
signs.
+
+* Creating nagios state strings: There is a dictionary named
'nagios_state_names'.
+ You can use it to get nagios state string from nagios return codes. e.g.:
+ nagios_state_names[0] gives you 'OK'.
+
Manpages:
*
@@ -31,3 +45,5 @@ Agent based checks:
by your check. -> That makes the code more easy to understand
and help not to break something if someone changes something
in the check's parser.
+ In an optimal case you include several code examples of different
+ states.
diff --git a/doc/helpers/validate_checks b/doc/helpers/validate_checks
index 7f9ade4..8f6590a 100755
--- a/doc/helpers/validate_checks
+++ b/doc/helpers/validate_checks
@@ -90,6 +90,14 @@ def get_manpage(check):
manpage[check] = ""
return manpage[check]
+def get_checkfile(check):
+ if not check in checkfiles:
+ try:
+ checkfiles[check] = open('checks/%s' %
check.split('.')[0]).read()
+ except IOError, e:
+ checkfiles[check] = ""
+ return checkfiles[check]
+
def grep_manpage(check, match, section = None):
manpage = get_manpage(check)
if section is None:
@@ -206,6 +214,15 @@ def verify_reindent(check):
f.close()
return not r.run()
+# Toooo long lines:
+# - Are there too long lines in the check?
+
+def is_valid_linelength(check):
+ return True
+
+def verify_linelength(check):
+
+
# Manpage:
# - Does the check have a manpage?