-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add HDFS check using snakebite #551
Conversation
@@ -0,0 +1,46 @@ | |||
from checks import AgentCheck | |||
|
|||
import snakebite.client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this import within the check method so it won't crash if the module is missing ?
Something like
try:
import snakebite.client
except ImportError:
raise Exception("Snake bite module is not installed. Please install it using easy install")
@remh updated pull request per your feedback. |
self.gauge('hdfs.used', stats['used']) | ||
self.gauge('hdfs.free', stats['remaining']) | ||
self.gauge('hdfs.capacity', stats['capacity']) | ||
self.gauge('hdfs.in_use', float(stats['used']) / float(stats['capacity'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be surrounded by a try except to catch a possible ZeroDivisionError or the capacity will never be 0 ? (I don't really know hdfs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that if you like. It's very unlikely for the capacity (in bytes) to be 0 -- that would probably only happen if the hadoop cluster were seriously broken.
snakebite is a direct client of the HDFS NameNode -- https://github.com/spotify/snakebite. Apache 2.0 License.