Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding initial set of Nagios-side scripts
- Loading branch information
1 parent
603c8b9
commit b036ea9
Showing
6 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Don't forget to define _SCRIPTPATH on a per-host basis. | ||
# | ||
# Example: _SCRIPTPATH /usr/local/django_nagios | ||
|
||
define command { | ||
command_name check_django_cpu_load | ||
command_line $_HOSTSCRIPTPATH$/scripts/django_check_cpu_load.py $ARG1$ | ||
} | ||
|
||
define command { | ||
command_name check_django_current_users | ||
command_line $_HOSTSCRIPTPATH$/scripts/django_check_current_users.py $ARG1$ | ||
} | ||
|
||
define command { | ||
command_name check_django_disk_usage | ||
command_line $_HOSTSCRIPTPATH$/scripts/django_check_disk_usage.py $ARG1$ | ||
} | ||
|
||
define command { | ||
command_name check_django_total_processes | ||
command_line $_HOSTSCRIPTPATH$/scripts/django_check_total_processes.py $ARG1$ | ||
} | ||
|
||
define command { | ||
command_name check_django_zombie_processes | ||
command_line $HOSTSCRIPTPATH$/scripts/django_check_zombie_processes.py $ARG1$ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import urllib2 | ||
|
||
CRITICAL_LOAD = 90 | ||
WARNING_LOAD = 75 | ||
|
||
parser = argparse.ArgumentParser(description='Checks CPU load on remote host.') | ||
|
||
parser.add_argument('url', help='URL of remote endpoint to check.') | ||
|
||
args = parser.parse_args() | ||
|
||
response = urllib2.urlopen(args.url) | ||
data = json.load(response) | ||
|
||
if 'cpu_percentage' in data: | ||
if data['cpu_percentage'] > CRITICAL_LOAD: | ||
print 'CPU LOAD CRITICAL: ' + str(data['cpu_percentage']) + '%' | ||
sys.exit(2) | ||
elif data['cpu_percentage'] > WARNING_LOAD: | ||
print 'CPU LOAD WARNING: ' + str(data['cpu_percentage']) + '%' | ||
sys.exit(1) | ||
else: | ||
print 'CPU LOAD OK: ' + str(data['cpu_percentage']) + '%' | ||
sys.exit(0) | ||
else: | ||
print 'CPU LOAD UNKNOWN: ' + args.url | ||
sys.exit(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import urllib2 | ||
|
||
CRITICAL = 5 | ||
WARNING = 2 | ||
|
||
parser = argparse.ArgumentParser(description='Checks logged in users on remote host.') | ||
|
||
parser.add_argument('url', help='URL of remote endpoint to check.') | ||
|
||
args = parser.parse_args() | ||
|
||
response = urllib2.urlopen(args.url) | ||
data = json.load(response) | ||
|
||
if 'count' in data: | ||
if data['count'] > CRITICAL: | ||
print 'USERS CRITICAL: ' + str(data['count']) | ||
sys.exit(2) | ||
elif data['count'] > WARNING: | ||
print 'USERS WARNING: ' + str(data['count']) | ||
sys.exit(1) | ||
else: | ||
print 'USERS OK: ' + str(data['count']) | ||
sys.exit(0) | ||
else: | ||
print 'USERS UNKNOWN: ' + args.url | ||
sys.exit(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import urllib2 | ||
|
||
CRITICAL = 90 | ||
WARNING = 80 | ||
|
||
parser = argparse.ArgumentParser(description='Checks disk usage on remote host.') | ||
|
||
parser.add_argument('url', help='URL of remote endpoint.') | ||
|
||
args = parser.parse_args() | ||
|
||
response = urllib2.urlopen(args.url) | ||
data = json.load(response) | ||
|
||
max_percentage = 0 | ||
max_device = None | ||
|
||
for device, percentage in data.iteritems(): | ||
if percentage > max_percentage: | ||
max_percentage = percentage | ||
max_device = device | ||
|
||
if max_device is None: | ||
print 'DISK UNKNOWN: ' + args.url | ||
sys.exit(3) | ||
elif max_percentage >= CRITICAL: | ||
print 'DISK CRITICAL: ' + max_device + ', ' + str(max_percentage) + '%' | ||
sys.exit(2) | ||
elif max_percentage >= WARNING: | ||
print 'DISK CRITICAL: ' + max_device + ', ' + str(max_percentage) + '%' | ||
sys.exit(2) | ||
else: | ||
print 'DISK OK: ' + max_device + ', ' + str(max_percentage) + '%' | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import urllib2 | ||
|
||
CRITICAL = 200 | ||
WARNING = 150 | ||
|
||
parser = argparse.ArgumentParser(description='Checks number of running processes on remote host.') | ||
|
||
parser.add_argument('url', help='URL of remote endpoint.') | ||
|
||
args = parser.parse_args() | ||
|
||
response = urllib2.urlopen(args.url) | ||
data = json.load(response) | ||
|
||
if 'count' in data: | ||
if data['count'] > CRITICAL: | ||
print 'PROCS CRITICAL: ' + str(data['count']) | ||
sys.exit(2) | ||
elif data['count'] > WARNING: | ||
print 'PROCS WARNING: ' + str(data['count']) | ||
sys.exit(1) | ||
else: | ||
print 'PROCS OK: ' + str(data['count']) | ||
sys.exit(0) | ||
else: | ||
print 'PROCS UNKNOWN: ' + args.url | ||
sys.exit(3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python | ||
|
||
import argparse | ||
import json | ||
import sys | ||
import urllib2 | ||
|
||
CRITICAL = 5 | ||
WARNING = 1 | ||
|
||
parser = argparse.ArgumentParser(description='Checks number of zombie processes on remote host.') | ||
|
||
parser.add_argument('url', help='URL of remote endpoint.') | ||
|
||
args = parser.parse_args() | ||
|
||
response = urllib2.urlopen(args.url) | ||
data = json.load(response) | ||
|
||
if 'count' in data: | ||
if data['count'] > CRITICAL: | ||
print 'PROCS CRITICAL: ' + str(data['count']) | ||
sys.exit(2) | ||
elif data['count'] > WARNING: | ||
print 'PROCS WARNING: ' + str(data['count']) | ||
sys.exit(1) | ||
else: | ||
print 'PROCS OK: ' + str(data['count']) | ||
sys.exit(0) | ||
else: | ||
print 'PROCS UNKNOWN: ' + args.url | ||
sys.exit(3) |