To define a new metric to monitor below is a an example
This metric could read and monitor the number of users currently logged in to the system and display the graph in ganglia front end.
Path for gmetric command:
Soaris: /usr/local/bin/gmetric
Aix: /opt/freeware/bin/gmetric
Linux: /usr/bin/gmetric
Below is the command to monitoring number of users and display corresponding graph in Ganglia front end
/usr/local/bin/gmetric --name Current_Users --value `who |wc -l` --type int32 –unit current_users
Here:
/usr/local/bin/gmetric -> is the ganglia client command
--name Current_Users -> this will be the name of graph
--value `who |wc -l` -> this is the value(this command should return a single number)
--type int32 -> type of value(since it’s a number its int32)
Now you can either crontab this command or just loop it as below.
#while true; do /usr/local/bin/gmetric --name Current_Users --value `who |wc -l` --type int32 --unit current_users; sleep 10; done
Now this graph is visible on ganglia portal.
No comments:
Post a Comment