pg_stat 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/ksh
  2. #==============================================================================
  3. # Script was originally created to collect stats and dump then to a log file
  4. # every five minutes. But we like this better (the log file thing is still
  5. # good if you want to track availability).
  6. #
  7. # Authors: SpEnTBoY
  8. # TheRocker
  9. #
  10. # Email: lonny@abyss.za.org
  11. # therocker@pawprints.2y.net
  12. #==============================================================================
  13. #=========================================================================================
  14. #
  15. # The best way to do this is to use Kerberos but we use rsh here because our monitoring
  16. # workstation doesn't have Kerberos installed. In order for this to work, the remote
  17. # host ($1) must have a .rhosts file that contains a line like:
  18. #
  19. # monitorhost nagiosuser
  20. #
  21. #=========================================================================================
  22. PAGING2=`rsh $1 -l root lsps -a -s | grep -v Paging | tr -s ' '| cut -d' ' -f3 | cut -d'%' -f1`
  23. if [ "$PAGING2" -gt "35" ] && [ "$PAGING2" -lt "50" ]
  24. then
  25. echo "Paging Space is over 35% ("$PAGING2")%"
  26. exit 1
  27. fi
  28. if [ "$PAGING2" -gt "49" ]
  29. then
  30. echo "WARNING! Paging Space is over 50% ("$PAGING2")%"
  31. exit 2
  32. fi
  33. if [ "$PAGING2" -lt "34" ]
  34. then
  35. echo "Paging Space is less than 34% ("$PAGING2")%"
  36. exit 0
  37. fi