From 7ce05af8af539f631d1dae6f893a3b005cc71c6f Mon Sep 17 00:00:00 2001
From: ThatOneNeji <dev.duncane@gmail.com>
Date: Thu, 16 Jul 2020 08:57:32 +0200
Subject: [PATCH] Minor updates. Added files

---
 nagios/hostgroups.cfg                |   19 
 nagios/nagios.cfg                    |    2 
 nagios/scripts/check_mem.pl          |  244 +++++++++
 nagios/NMS_Services.cfg              |  177 +++--
 nagios/servicegroups.cfg             |    4 
 nagios/objects/commands.cfg.orig     |  279 ++++++++++
 nagios/NMS_Hosts.cfg                 |   25 
 nagios/objects/commands.cfg          |  578 ++++++++++++++++-----
 nagios/scripts/check_facts_ldr_procs |  213 +++++++
 nagios/NMS_Templates.cfg             |   20 
 10 files changed, 1,309 insertions(+), 252 deletions(-)

diff --git a/nagios/NMS_Hosts.cfg b/nagios/NMS_Hosts.cfg
index da05619..ee5c987 100644
--- a/nagios/NMS_Hosts.cfg
+++ b/nagios/NMS_Hosts.cfg
@@ -1,30 +1,5 @@
 ###
 ##
-#   Host Group definitions
-##
-###
-define hostgroup{
-    hostgroup_name                     NMS Servers
-    alias                              NMS Servers
-}
-
-define hostgroup{
-    hostgroup_name                     NMS FACTS
-    alias                              NMS FACTS
-}
-
-define hostgroup{
-    hostgroup_name                     USA
-    alias                              USA
-}
-
-define hostgroup{
-    hostgroup_name                     ACC
-    alias                              ACC
-}
-
-###
-##
 #   Host definitions
 ##
 ###
diff --git a/nagios/NMS_Services.cfg b/nagios/NMS_Services.cfg
index 97f572d..56e1607 100644
--- a/nagios/NMS_Services.cfg
+++ b/nagios/NMS_Services.cfg
@@ -43,7 +43,7 @@
 ###
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                CPU Load
     check_command                      check_nrpe!check_load
     notes                              OSxxxxx
@@ -59,7 +59,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Memory Usage 
     check_command                      check_nrpe!check_ram
     notes                              OSxxxxx
@@ -67,7 +67,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Partition - Free Space - /app 
     check_command                      check_nrpe!check_app
     notes                              OSxxxxx
@@ -75,7 +75,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Partition - Free Inodes - /app
     check_command                      check_inodes!70!80!"/app"
     notes                              OSxxxxx
@@ -83,7 +83,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Partition - Free Space - /root
     check_command                      check_nrpe!check_root 
     notes                              OSxxxxx
@@ -91,7 +91,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Partition - Free Inodes - /root
     check_command                      check_inodes!70!80!"/"
     notes                              OSxxxxx
@@ -99,7 +99,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Partition - Free Space - /var
     check_command                      check_nrpe!check_var
     notes                              OSxxxxx
@@ -107,7 +107,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Check DNS 
     check_command                      check_nrpe!check_dns
     notes                              OSxxxxx
@@ -115,7 +115,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                SSH Check
     check_command                      check_ssh!10
     notes                              OSxxxxx
@@ -123,7 +123,7 @@
 
 define service{
     use                                nms-generic-service
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                SUDO Installed
     check_command                      check_nrpe!check_sudo
     notes                              OSxxxxx
@@ -224,7 +224,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Apache Service 
     check_command                      check_url!80!1.0!60.0!"Index of"!"/sm/"
     notes                              SWxxxxx
@@ -232,7 +232,7 @@
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Apache Service Running
     check_command                      check_url!80!1.0!60.0!"Apache Server Status"!"/server-status"
     notes                              SWxxxxx
@@ -244,7 +244,7 @@
 #
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                Apache Service Running. Coldfusion might be having issues
     check_command                      check_url!80!1.0!60.0!"Network Group Home"!"/"
     notes                              SWxxxxx
@@ -256,7 +256,7 @@
 #
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                FACTS - Loader Procs
     check_command                      check_nrpe!check_facts_ldr_procs
     notes                              SWxxxxx
@@ -268,42 +268,42 @@
 # services check for "jboss"
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                USA - Jboss - Log - Age
-    check_command                      check_nrpe!check_file_age -a 300 600 /app/usa3/jboss/server/latest/log/server.log
+    check_command                      check_nrpe!check_file_age -a 300 600 /app/usa3/jboss/server/mtnusa3_rel76/log/server.log
     notes                              SWxxxxx
 }
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
+    host_name                          NMSAPP.TNM.CO.MW
     service_description                USA - Jboss - Log - Java heap space
-    check_command                      check_nrpe!check_log_generic -a  /app/usa3/jboss/server/latest/log/server.log /app2/nrpe/nrpe.acc.jboss.error 'Java heap space'
+    check_command                      check_nrpe!check_log_generic -a  /app/usa3/jboss/server/mtnusa3_rel76/log/server.log /tmp/nrpe.acc.jboss.error 'Java heap space'
     notes                              SWxxxxx
 }
 
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - Web Interface - 9090 - usa_jboss
-    servicegroups                      jboss_instances
-    check_command                      check_url!9090!1.0!60.0!"USA FCAPS Manager"!"/mtnusa_web/"
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - Web Interface - 9090 - usa_jboss
+#    servicegroups                      jboss_instances
+#    check_command                      check_url!9090!1.0!60.0!"USA FCAPS Manager"!"/mtnusa_web/"
+#    notes                              SWxxxxx
+#}
 
 # services check for "http_service"
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - http_service - Log - Java heap space
-    check_command                      check_nrpe!check_log_generic -a /app/usa3/nlusa/http/log/server.log /app2/nrpe/nrpe.acc.http_service.error 'Java heap space'
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - http_service - Log - Java heap space
+#    check_command                      check_nrpe!check_log_generic -a /app/usa3/nlusa/http/log/server.log /tmp/nrpe.acc.http_service.error 'Java heap space'
+#    notes                              SWxxxxx
+#}
 
 define service{
     use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - Web Interface - 8080 - http_svc
+    host_name                          NMSAPP.TNM.CO.MW
+    service_description                USA - Web Interface - 8080 - usa_jboss
     check_command                      check_url!8080!1.0!60.0!"USA FCAPS Manager"!"/mtnusa_web/"
     notes                              SWxxxxx
 }
@@ -312,48 +312,75 @@
 #  Plugins - Common
 ##
 # services check for "vasc_subscriber"
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - VASC - vasc_subscriber - Log - Age
-    check_command                      check_nrpe!check_file_age -a 300 600 /app/vasc/subscriber-0.9.1/log/server.log
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_alarm_disc - Log - Age
+#    check_command                      check_nrpe!check_file_age -a 300 600 /app/vasc/enabled/vasc-0.8.0-alarm_disc/log/server.log
+#    notes                              SWxxxxx
+#}
 
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - VASC - vasc_subscriber - Log - Java heap space
-    check_command                      check_nrpe!check_log_generic -a /app/vasc/subscriber-0.9.1/log/server.log /app2/nrpe/nrpe.acc.vasc_subscriber.error 'Java heap space'
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_alarm_disc - Log - Java heap space
+#    check_command                      check_nrpe!check_log_generic -a /app/vasc/enabled/vasc-0.8.0-alarm_disc/log/server.log /tmp/nrpe.acc.vasc_alarm_disc.error 'Java heap space'
+#    notes                              SWxxxxx
+#}
 
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - VASC - vasc_subscriber - Plugin - Running
-    check_command                      check_nrpe!check_procs_app -a 1:2 0:2 " vasc_subscriber "    
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_alarm_disc - Plugin - Running
+#    check_command                      check_nrpe!check_procs_app -a 1:2 0:2 " vasc_alarm_disc "    
+#    notes                              SWxxxxx
+#}
 
-##
-# USA - NLUSA Cluster
-##
-# check usa web ports
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - Web Interface - 9090 - usa_jboss
-    servicegroups                      jboss_instances
-    check_command                      check_url!9090!1.0!60.0!"USA FCAPS Manager"!"/mtnusa_web/"
-    notes                              SWxxxxx
-}
 
-define service{
-    use                                nms-generic-service-crit
-    host_name                          NMSAPP.TMN.CO.ZA
-    service_description                USA - Web Interface - 8080 - http_svc
-    check_command                      check_url!8080!1.0!60.0!"USA FCAPS Manager"!"/mtnusa_web/"
-    notes                              SWxxxxx
-}
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_local - Log - Age
+#    check_command                      check_nrpe!check_file_age -a 300 600 /app/vasc/enabled/vasc-0.8.0/log/server.log
+#    notes                              SWxxxxx
+#}
 
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_local - Log - Java heap space
+#    check_command                      check_nrpe!check_log_generic -a /app/vasc/enabled/vasc-0.8.0/log/server.log /tmp/nrpe.acc.vasc_local.error 'Java heap space'
+#    notes                              SWxxxxx
+#}
+
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_local - Plugin - Running
+#    check_command                      check_nrpe!check_procs_app -a 1:2 0:2 " vasc_local "    
+#    notes                              SWxxxxx
+#}
+
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_rules_engine - Log - Age
+#    check_command                      check_nrpe!check_file_age -a 300 600 /app/vasc/enabled/vasc-0.8.0-rules_engine/log/server.log
+#    notes                              SWxxxxx
+#}
+
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_rules_engine - Log - Java heap space
+#    check_command                      check_nrpe!check_log_generic -a /app/vasc/enabled/vasc-0.8.0-rules_engine/log/server.log /tmp/nrpe.acc.vasc_rules_engine.error 'Java heap space'
+#    notes                              SWxxxxx
+#}
+
+#define service{
+#    use                                nms-generic-service-crit
+#    host_name                          NMSAPP.TNM.CO.MW
+#    service_description                USA - VASC - vasc_rules_engine - Plugin - Running
+#    check_command                      check_nrpe!check_procs_app -a 1:2 0:2 " vasc_rules_engine "    
+#    notes                              SWxxxxx
+#}
\ No newline at end of file
diff --git a/nagios/NMS_Templates.cfg b/nagios/NMS_Templates.cfg
index 4795db9..d655ffc 100644
--- a/nagios/NMS_Templates.cfg
+++ b/nagios/NMS_Templates.cfg
@@ -28,6 +28,7 @@
 ###
 define service{
     name                               nms-generic-service                               ; The 'name' of this service template
+    service_description                service
     active_checks_enabled              1                                                 ; Active service checks are enabled
     passive_checks_enabled             1                                                 ; Passive service checks are enabled/accepted
     parallelize_check                  1                                                 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
@@ -36,15 +37,15 @@
     notifications_enabled              1                                                 ; Service notifications are enabled
     event_handler_enabled              1                                                 ; Service event handler is enabled
     flap_detection_enabled             1                                                 ; Flap detection is enabled
-    failure_prediction_enabled         1                                                 ; Failure prediction is enabled
+#    failure_prediction_enabled         1                                                 ; Failure prediction is enabled
     process_perf_data                  1                                                 ; Process performance data
     retain_status_information          1                                                 ; Retain status information across program restarts
     retain_nonstatus_information       1                                                 ; Retain non-status information across program restarts
     is_volatile                        0                                                 ; The service is not volatile
     check_period                       24x7                                              ; The service can be checked at any time of the day
     max_check_attempts                 3                                                 ; Re-check the service up to 3 times in order to determine its final (hard) state
-    normal_check_interval              4                                                ; Check the service every 10 minutes under normal conditions
-    retry_check_interval               2                                                 ; Re-check the service every two minutes until a hard state can be determined
+    check_interval                     4                                                 ; Check the service every 10 minutes under normal conditions
+    retry_interval                     2                                                 ; Re-check the service every two minutes until a hard state can be determined
     contact_groups                     admins, nms_grp, nms_standby_grp                  ; Notifications get sent out to everyone in the 'admins' group
     notification_options               w,u,c,r                                           ; Send notifications about warning, unknown, critical, and recovery events
     notification_interval              60                                                ; Re-notify about service problems every hour
@@ -56,9 +57,10 @@
     use                                nms-generic-service
     name                               nms-generic-service-crit
     max_check_attempts                 3
-    normal_check_interval              2
-    retry_check_interval               1
+    check_interval                     2
+    retry_interval                     1
     notification_interval              30
+    register                           0
 }
 ###
 ##
@@ -69,10 +71,10 @@
 define host{
     name                               nms-generic-host                                  ; The name of this host template
     notifications_enabled              1                                                 ; Host notifications are enabled
-    event_handler                      NIDSERVERS_EVENT
+    event_handler                      TTWSERVERS_EVENT
     event_handler_enabled              1                                                 ; Host event handler is enabled
     flap_detection_enabled             1                                                 ; Flap detection is enabled
-    failure_prediction_enabled         1                                                 ; Failure prediction is enabled
+#    failure_prediction_enabled         1                                                 ; Failure prediction is enabled
     process_perf_data                  1                                                 ; Process performance data
     retain_status_information          1                                                 ; Retain status information across program restarts
     retain_nonstatus_information       1                                                 ; Retain non-status information across program restarts
@@ -91,7 +93,7 @@
     check_command                      check-host-alive
     max_check_attempts                 3
     check_interval                     1
-    retry_check_interval               2
+    retry_interval                     2
     notification_interval              10
     notification_options               d,u,r
     register                           0                                                 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
@@ -104,7 +106,7 @@
     check_command                      check-host-alive
     max_check_attempts                 3
     check_interval                     1
-    retry_check_interval               2
+    retry_interval                     2
     notification_interval              10
     notification_options               d,u,r
     register                           0                                                 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
diff --git a/nagios/hostgroups.cfg b/nagios/hostgroups.cfg
new file mode 100644
index 0000000..5491ce2
--- /dev/null
+++ b/nagios/hostgroups.cfg
@@ -0,0 +1,19 @@
+define hostgroup{
+    hostgroup_name                     NMS Servers
+    alias                              NMS Servers
+}
+
+define hostgroup{
+    hostgroup_name                     NMS FACTS
+    alias                              NMS FACTS
+}
+
+define hostgroup{
+    hostgroup_name                     USA
+    alias                              USA
+}
+
+define hostgroup{
+    hostgroup_name                     ACC
+    alias                              ACC
+}
\ No newline at end of file
diff --git a/nagios/nagios.cfg b/nagios/nagios.cfg
index 84e2cd1..5256cec 100644
--- a/nagios/nagios.cfg
+++ b/nagios/nagios.cfg
@@ -31,6 +31,8 @@
 cfg_file=/etc/nagios/objects/timeperiods.cfg
 cfg_file=/etc/nagios/objects/templates.cfg
 
+cfg_file=/etc/nagios/hostgroups.cfg
+cfg_file=/etc/nagios/servicegroups.cfg
 # Definitions for monitoring the local (Linux) host
 cfg_file=/etc/nagios/objects/localhost.cfg
 
diff --git a/nagios/objects/commands.cfg b/nagios/objects/commands.cfg
index e9d17e9..08ff702 100644
--- a/nagios/objects/commands.cfg
+++ b/nagios/objects/commands.cfg
@@ -1,10 +1,11 @@
 ###############################################################################
-# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.4.3
+# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 3.0
 #
+# Last Modified: 05-31-2007
 #
 # NOTES: This config file provides you with some example command definitions
 #        that you can reference in host, service, and contact definitions.
-#
+#       
 #        You don't need to keep commands in a separate file from your other
 #        object definitions.  This has been done just to make things easier to
 #        understand.
@@ -12,56 +13,27 @@
 ###############################################################################
 
 
-
 ################################################################################
 #
 # SAMPLE NOTIFICATION COMMANDS
 #
 # These are some example notification commands.  They may or may not work on
-# your system without modification.  As an example, some systems will require
+# your system without modification.  As an example, some systems will require 
 # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
 #
 ################################################################################
 
+
 # 'notify-host-by-email' command definition
 define command{
     command_name                       notify-host-by-email
-    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
-}
-
-# 'notify-host-by-sms' command definition
-define command{
-    command_name                       notify-host-by-sms
-    command_line                       /usr/bin/printf "Host: $HOSTALIAS$\nState: $HOSTSTATE$\nAdditional Info:\n$HOSTOUTPUT$\nTime: $SHORTDATETIME$\n" | /bin/mailx -s "Nagios" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
-}
-
-# 'notify-host-by-sms2' command definition
-define command{
-    command_name                       notify-host-by-sms2
-    command_line                       /app/nagios_notifications/usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  State: $HOSTSTATE$   Additional Info - $HOSTOUTPUT$ " 
+    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
 }
 
 # 'notify-service-by-email' command definition
 define command{
     command_name                       notify-service-by-email
-    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
-}
-
-# 'notify-service-by-sms' command definition
-define command{
-    command_name                       notify-service-by-sms
-    command_line                       /usr/bin/printf "\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$\nAdditional Info:\n$SERVICEOUTPUT$\nTime: $SHORTDATETIME$\n" | /bin/mailx -s "Nagios" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
-}
-	
-# 'notify-service-by-sms2' command definition
-define command{
-    command_name                       notify-service-by-sms2
-    command_line                       /app/nagios_notifications/usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  Service - $SERVICEDESC$  State - $SERVICESTATE$   Additional Info - $SERVICEOUTPUT$ " 
-}
-
-define command{
-    command_name                       notify-service-by-iws-sms
-    command_line                       /app/nagios_notifications/iws_usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  Service - $SERVICEDESC$  State - $SERVICESTATE$   Additional Info - $SERVICEOUTPUT$ " 
+    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
 }
 
 
@@ -71,15 +43,22 @@
 #
 ################################################################################
 
+
 # This command checks to see if a host is "alive" by pinging it
-# The check must result in a 100% packet loss or 5 second (5000ms) round trip
+# The check must result in a 100% packet loss or 5 second (5000ms) round trip 
 # average time to produce a critical error.
 # Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
 
-define command {
+# 'check-host-alive' command definition
+define command{
+    command_name                       check-host-alive
+    command_line                       $USER1$/check_ping -H $HOSTADDRESS$ -w 5000.0,80% -c 10000.0,90% -p 5
+}
 
-    command_name    check-host-alive
-    command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
+# 'check-host-alive2' command definition, longer timeouts
+define command{
+    command_name                       check-host-alive2
+    command_line                       $USER1$/check_ping -H $HOSTADDRESS$ -w 20000.0,80% -c 30000.0,90% -p 10 -t 60
 }
 
 
@@ -89,59 +68,53 @@
 # SAMPLE SERVICE CHECK COMMANDS
 #
 # These are some example service check commands.  They may or may not work on
-# your system, as they must be modified for your plugins.  See the HTML
+# your system, as they must be modified for your plugins.  See the HTML 
 # documentation on the plugins for examples of how to configure command definitions.
 #
 # NOTE:  The following 'check_local_...' functions are designed to monitor
 #        various metrics on the host that Nagios is running on (i.e. this one).
 ################################################################################
 
-define command {
-
-    command_name    check_local_disk
-    command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+# 'check_local_disk' command definition
+define command{
+    command_name                       check_local_disk
+    command_line                       $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
 }
 
 
-
-define command {
-
-    command_name    check_local_load
-    command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
+# 'check_local_load' command definition
+define command{
+    command_name                       check_local_load
+    command_line                       $USER1$/check_load -w $ARG1$ -c $ARG2$
 }
 
 
-
-define command {
-
-    command_name    check_local_procs
-    command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
+# 'check_local_procs' command definition
+define command{
+    command_name                       check_local_procs
+    command_line                       $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
 }
 
 
-
-define command {
-
-    command_name    check_local_users
-    command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
+# 'check_users' command definition
+define command{
+    command_name                       check_users
+    command_line                       $USER1$/check_users -w $ARG1$ -c $ARG2$
 }
 
 
-
-define command {
-
-    command_name    check_local_swap
-    command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
+# 'check_local_swap' command definition
+define command{
+    command_name                       check_local_swap
+    command_line                       $USER1$/check_swap -w $ARG1$ -c $ARG2$
 }
 
 
-
-define command {
-
-    command_name    check_local_mrtgtraf
-    command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
+# 'check_local_mrtgtraf' command definition
+define command{
+    command_name                       check_local_mrtgtraf
+    command_line                       $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
 }
-
 
 
 ################################################################################
@@ -149,109 +122,224 @@
 #        both local and remote hosts.
 ################################################################################
 
-define command {
-
-    command_name    check_ftp
-    command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
+# 'check_ftp' command definition
+define command{
+    command_name                       check_ftp
+    command_line                       $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
 }
 
 
-
-define command {
-
-    command_name    check_hpjd
-    command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
+# 'check_hpjd' command definition
+define command{
+    command_name                       check_hpjd
+    command_line                       $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
 }
 
 
+# 'check_snmp' command definition
+define command{
+    command_name                       check_snmp
+    command_line                       $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
+}
 
-define command {
+# 'check_http' command definition
+define command{
+    command_name                       check_http
+    command_line                       $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
+}
 
-    command_name    check_snmp
-    command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
+# 'check_ssh' command definition
+define command{
+    command_name                       check_ssh
+    command_line                       $USER1$/check_ssh -H $HOSTADDRESS$ -t $ARG1$
+}
+
+# 'check_inodes' command definition
+define command{
+    command_name                       check_inodes
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_inodes -a $ARG1$ $ARG2$ $ARG3$  
+}
+
+# 'check_dhcp' command definition
+define command{
+    command_name                       check_dhcp
+    command_line                       $USER1$/check_dhcp $ARG1$
 }
 
 
-
-define command {
-
-    command_name    check_http
-    command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
+# 'check_ping' command definition
+define command{
+    command_name                       check_ping
+    command_line                       $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
 }
 
 
-
-define command {
-
-    command_name    check_ssh
-    command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
+# 'check_pop' command definition
+define command{
+    command_name                       check_pop
+    command_line                       $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
 }
 
 
-
-define command {
-
-    command_name    check_dhcp
-    command_line    $USER1$/check_dhcp $ARG1$
+# 'check_imap' command definition
+define command{
+    command_name                       check_imap
+    command_line                       $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
 }
 
 
-
-define command {
-
-    command_name    check_ping
-    command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
+# 'check_smtp' command definition
+define command{
+    command_name                       check_smtp
+    command_line                       $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
 }
 
 
-
-define command {
-
-    command_name    check_pop
-    command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
+# 'check_tcp' command definition
+define command{
+    command_name                       check_tcp
+    command_line                       $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$
 }
 
-
-
-define command {
-
-    command_name    check_imap
-    command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
+# 'check_tcp_mms' command definition
+define command{
+    command_name                       check_tcp_mms
+    command_line                       $USER1$/check_tcp_mms -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$
 }
 
-
-
-define command {
-
-    command_name    check_smtp
-    command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
+# 'check_udp' command definition
+define command{
+    command_name                       check_udp
+    command_line                       $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
 }
 
-
-
-define command {
-
-    command_name    check_tcp
-    command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
+# 'check_nt' command definition
+define command{
+    command_name                       check_nt
+    command_line                       $USER1$/check_nt -H $HOSTADDRESS$ -v $ARG1$ $ARG2$
 }
 
-
-
-define command {
-
-    command_name    check_udp
-    command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
+# Always add NRPE command here
+define command{
+    command_name                       check_nrpe
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
 }
 
-
-
-define command {
-
-    command_name    check_nt
-    command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
+define command{
+    command_name                       check_nrpe600
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -t 600 -c $ARG1$
 }
 
+define command{
+    command_name                       check_nrpe60
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c $ARG1$
+}
 
+#My Commands
+define command{
+    command_name                       check_mem
+    command_line                       $USER1$/check_mem -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
+}
+
+define command{
+    command_name                       check_ram
+    command_line                       $USER1$/check_ram -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
+}
+
+define command{
+    command_name                       check_ram_rica
+    command_line                       $USER1$/check_ram_rica -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
+}
+
+# check_procs' command definition
+define command{
+    command_name                       check_procs
+    command_line                       $USER1$/check_procs -a $ARG1$
+}
+
+# 'check_local_procs' command definition
+#define command{
+#    command_name                       check_procs_nagios
+#    command_line                       $USER1$/check_procs -a $ARG1$
+#}
+
+# 'check_local_procs' command definition
+define command{
+    command_name                       check_system_pp
+    command_line                       /usr/local/nagios/libexec/check_system_pp
+}
+
+# 'check_local_users' command definition
+define command{
+    command_name                       check_local_users
+    command_line                       $USER1$/check_users -w $ARG1$ -c $ARG2$
+}
+
+# 'check_dns' command definition
+define command{
+    command_name                       check_dns
+    command_line                       /usr/local/nagios/libexec/check_dns -H $HOSTADDRESS$ -s $ARG1$  
+}
+
+# 'check_dns' command definition
+define command{
+    command_name                       check_dns2
+    command_line                       /usr/local/nagios/libexec/check_dns -H $HOSTADDRESS$ -s $HOSTADDRESS$ -t $ARG1$
+}
+
+# 'check_dns' command definition
+define command{
+    command_name                       check_dns3
+    command_line                       /usr/local/nagios/libexec/check_dns
+}
+
+# 'check_root' command definition
+define command{
+    command_name                       check_var
+    command_line                       $USER1$/check_disk
+}
+
+# 'check_log' command definition
+#define command{
+#    command_name                       check_log
+#    command_line                       $USER1$/check_log $ARG1$
+#}
+
+# 'check_disk' command definition
+define command{
+    command_name                       check_root
+    command_line                       $USER1$/check_disk
+}
+
+# 'check_disk' command definition
+define command{
+    command_name                       check_archive
+    command_line                       $USER1$/check_disk
+}
+
+# 'check_disk' command definition
+define command{
+    command_name                       check_export
+    command_line                       $USER1$/check_disk
+}
+
+#check_load
+define command{
+    command_name                       check_load
+    command_line                       /usr/local/nagios/libexec/check_load -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
+}
+
+# 'check_procs' command definition
+define command{
+    command_name                       check_processes  
+    command_line                       /usr/local/nagios/libexec/check_processes 
+}
+
+# 'check_uptime' command definition
+define command{
+    command_name                       check_uptime
+    command_line                       /usr/local/nagios/libexec/check_uptime
+}
 
 ################################################################################
 #
@@ -259,21 +347,225 @@
 #
 # These are sample performance data commands that can be used to send performance
 # data output to two text files (one for hosts, another for services).  If you
-# plan on simply writing performance data out to a file, consider using the
+# plan on simply writing performance data out to a file, consider using the 
 # host_perfdata_file and service_perfdata_file options in the main config file.
 #
 ################################################################################
 
-define command {
 
-    command_name    process-host-perfdata
-    command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/log/nagios/host-perfdata.out
+# 'process-host-perfdata' command definition
+define command{
+    command_name                       process-host-perfdata
+    command_line                       /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
 }
 
 
+# 'process-service-perfdata' command definition
+define command{
+    command_name                       process-service-perfdata
+    command_line                       /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
+}
+
+##############################################################################
+##############################################################################
+define command{
+    command_name                       host_event
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$
+}
+
+define command{
+    command_name                       NODEB_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "NODEB_EVENT"
+}
+
+define command{
+    command_name                       IM_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "IM_EVENT"
+}
+
+define command{
+    command_name                       IM_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "IM_SERVICES_EVENT"
+}
+
+define command{
+    command_name                       TTWSERVERS_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "TTWSERVERS_EVENT"
+}
+
+define command{
+    command_name                       TTWSERVERS_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "TTWSERVERS_SERVICES_EVENT"
+}
+
+define command{
+    command_name                       SI_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "SI_SERVICES_EVENT"
+}
+
+define command{
+    command_name                       IS_SERVERS_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "TTWSERVERS_EVENT"
+}
+
+define command{
+    command_name                       SDPSERVERS_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "SDPSERVERS_EVENT"
+}
+
+define command{
+    command_name                       SDPSERVERS_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "SDPSERVERS_SERVICES_EVENT"
+}
+
+define command{
+    command_name                       SDP2SERVERS_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "SDP2SERVERS_EVENT"
+}
+
+define command{
+    command_name                       SDP2SERVERS_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "SDP2SERVERS_SERVICES_EVENT"
+}
+
+define command{
+    command_name                       service_event
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$
+}
+
+define command{
+    command_name                       EXTERNAL_FACTS_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "EXTERNAL_FACTS_EVENT"
+}
+
+define command{
+    command_name                       EXTERNAL_FACTS_SERVICE_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "EXTERNAL_FACTS_SERVICE_EVENT"
+}
+
+define command{
+    command_name                       MTNSI_PSI 
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "MTNSI PSI"
+}
+
+define command{
+    command_name                       IWSSERVERS_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "MTNSI PSI"
+}
+
+define command{
+    command_name                       IWSSERVERS_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "MTNSI PSI"
+}
 
 define command {
+    command_name                       check_msmq
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c check_msmq -a $ARG1$
+}
 
-    command_name    process-service-perfdata
-    command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/log/nagios/service-perfdata.out
+define command {
+    command_name                       check_fileCount
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c check_fileCount -a $ARG1$ $ARG2$
+}
+
+define command {
+    command_name                       check_fileCount_smtp
+    command_line                       $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 30 -c check_fileCount_smtp -a $ARG1$ $ARG2$
+}
+
+
+define command{
+    command_name                       IWSSMPP_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "IWSSMPP_EVENT"
+}
+
+define command{
+    command_name                       IWSSMPP_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "IWSSMPP_SERVICES_EVENT"
+}
+
+# check_webserver definition = MTN NID
+define command{
+    command_name                       check_webserver
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$
+}
+
+# check_url_auth definition = HTTP with user authentication
+define command{
+    command_name                       check_url_auth
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$ -u $ARG5$ -a $ARG6$
+}
+
+# check_https definition = MTN NID
+define command{
+    command_name                       check_https
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -S -p $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$ -u $ARG5$
+}
+
+# check_jmx_memory definition = MTN NID
+define command{
+    command_name                       check_jmx_memory
+    command_line                       $USER1$/check_jmx_heapmemory -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+}
+
+# check_ntlm definition = MTN NID
+define command{
+    command_name                       check_ntlm
+    command_line                       $USER1$/check_ntlm.pl -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+}
+
+# check_ntlm definition = MTN NID
+define command{
+    command_name                       check_ntlm_nisweb01 
+    command_line                       $USER1$/check_ntlm.pl -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+}
+
+# check_ntlm definition = MTN NID
+define command{
+    command_name                       check_ntlm_ibs
+    command_line                       $USER1$/check_ntlm.pl -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+}
+
+# check_ntlm definition = MTN NID
+define command{
+    command_name                       check_http_accDB
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
+}
+
+define command{
+    command_name                       SAAE_EVENT
+    command_line                       $USER2$/event.pl $HOSTSTATE$ $HOSTSTATETYPE$ $HOSTATTEMPT$ "HOST PING" "$HOSTOUTPUT$" $HOSTNAME$ "SAAE_EVENT"
+}
+
+define command{
+    command_name                       CHARGING_SERVICES_EVENT
+    command_line                       $USER2$/event.pl $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $HOSTNAME$ "CHARGING_SERVICES_EVENT"
+}
+
+# 'check_esxi_hardware' command definition
+define command{
+    command_name                       check_esxi_hardware
+    command_line                       $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P file:$ARG2$ -V $ARG3$
+}
+
+define command{
+    command_name                       check_smpp_port
+    command_line                       $USER1$/check_port.pl -h $HOSTADDRESS$ -p 5016 -c $ARG1$ -w $ARG2$
+}
+
+# Check Home Directory sizes
+# check_homedirs
+define command {
+    command_name                       check_homedirs
+    command_line                       $USER1/check_homedirs.pl -w $ARG2 -c $ARG1
+}
+
+define command{
+    command_name                       check_url
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -s $ARG4$ -u $ARG5$
+}
+
+define command{
+    command_name                       check_url2
+    command_line                       $USER1$/check_http -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -u $ARG4$
 }
diff --git a/nagios/objects/commands.cfg.orig b/nagios/objects/commands.cfg.orig
new file mode 100644
index 0000000..e9d17e9
--- /dev/null
+++ b/nagios/objects/commands.cfg.orig
@@ -0,0 +1,279 @@
+###############################################################################
+# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.4.3
+#
+#
+# NOTES: This config file provides you with some example command definitions
+#        that you can reference in host, service, and contact definitions.
+#
+#        You don't need to keep commands in a separate file from your other
+#        object definitions.  This has been done just to make things easier to
+#        understand.
+#
+###############################################################################
+
+
+
+################################################################################
+#
+# SAMPLE NOTIFICATION COMMANDS
+#
+# These are some example notification commands.  They may or may not work on
+# your system without modification.  As an example, some systems will require
+# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
+#
+################################################################################
+
+# 'notify-host-by-email' command definition
+define command{
+    command_name                       notify-host-by-email
+    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
+}
+
+# 'notify-host-by-sms' command definition
+define command{
+    command_name                       notify-host-by-sms
+    command_line                       /usr/bin/printf "Host: $HOSTALIAS$\nState: $HOSTSTATE$\nAdditional Info:\n$HOSTOUTPUT$\nTime: $SHORTDATETIME$\n" | /bin/mailx -s "Nagios" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
+}
+
+# 'notify-host-by-sms2' command definition
+define command{
+    command_name                       notify-host-by-sms2
+    command_line                       /app/nagios_notifications/usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  State: $HOSTSTATE$   Additional Info - $HOSTOUTPUT$ " 
+}
+
+# 'notify-service-by-email' command definition
+define command{
+    command_name                       notify-service-by-email
+    command_line                       /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
+}
+
+# 'notify-service-by-sms' command definition
+define command{
+    command_name                       notify-service-by-sms
+    command_line                       /usr/bin/printf "\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nState: $SERVICESTATE$\nAdditional Info:\n$SERVICEOUTPUT$\nTime: $SHORTDATETIME$\n" | /bin/mailx -s "Nagios" -r nagios@sinagios01.mtn.co.za $CONTACTEMAIL$
+}
+	
+# 'notify-service-by-sms2' command definition
+define command{
+    command_name                       notify-service-by-sms2
+    command_line                       /app/nagios_notifications/usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  Service - $SERVICEDESC$  State - $SERVICESTATE$   Additional Info - $SERVICEOUTPUT$ " 
+}
+
+define command{
+    command_name                       notify-service-by-iws-sms
+    command_line                       /app/nagios_notifications/iws_usa_sms.sh $CONTACTEMAIL$ "--NAGIOS-- Date/Time - $SHORTDATETIME$  Notification Type - $NOTIFICATIONTYPE$  Host - $HOSTALIAS$  Service - $SERVICEDESC$  State - $SERVICESTATE$   Additional Info - $SERVICEOUTPUT$ " 
+}
+
+
+################################################################################
+#
+# SAMPLE HOST CHECK COMMANDS
+#
+################################################################################
+
+# This command checks to see if a host is "alive" by pinging it
+# The check must result in a 100% packet loss or 5 second (5000ms) round trip
+# average time to produce a critical error.
+# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
+
+define command {
+
+    command_name    check-host-alive
+    command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
+}
+
+
+
+################################################################################
+#
+# SAMPLE SERVICE CHECK COMMANDS
+#
+# These are some example service check commands.  They may or may not work on
+# your system, as they must be modified for your plugins.  See the HTML
+# documentation on the plugins for examples of how to configure command definitions.
+#
+# NOTE:  The following 'check_local_...' functions are designed to monitor
+#        various metrics on the host that Nagios is running on (i.e. this one).
+################################################################################
+
+define command {
+
+    command_name    check_local_disk
+    command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+}
+
+
+
+define command {
+
+    command_name    check_local_load
+    command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
+}
+
+
+
+define command {
+
+    command_name    check_local_procs
+    command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
+}
+
+
+
+define command {
+
+    command_name    check_local_users
+    command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
+}
+
+
+
+define command {
+
+    command_name    check_local_swap
+    command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
+}
+
+
+
+define command {
+
+    command_name    check_local_mrtgtraf
+    command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
+}
+
+
+
+################################################################################
+# NOTE:  The following 'check_...' commands are used to monitor services on
+#        both local and remote hosts.
+################################################################################
+
+define command {
+
+    command_name    check_ftp
+    command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_hpjd
+    command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_snmp
+    command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_http
+    command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_ssh
+    command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
+}
+
+
+
+define command {
+
+    command_name    check_dhcp
+    command_line    $USER1$/check_dhcp $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_ping
+    command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
+}
+
+
+
+define command {
+
+    command_name    check_pop
+    command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_imap
+    command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_smtp
+    command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
+}
+
+
+
+define command {
+
+    command_name    check_tcp
+    command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
+}
+
+
+
+define command {
+
+    command_name    check_udp
+    command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
+}
+
+
+
+define command {
+
+    command_name    check_nt
+    command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
+}
+
+
+
+################################################################################
+#
+# SAMPLE PERFORMANCE DATA COMMANDS
+#
+# These are sample performance data commands that can be used to send performance
+# data output to two text files (one for hosts, another for services).  If you
+# plan on simply writing performance data out to a file, consider using the
+# host_perfdata_file and service_perfdata_file options in the main config file.
+#
+################################################################################
+
+define command {
+
+    command_name    process-host-perfdata
+    command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/log/nagios/host-perfdata.out
+}
+
+
+
+define command {
+
+    command_name    process-service-perfdata
+    command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/log/nagios/service-perfdata.out
+}
diff --git a/nagios/scripts/check_facts_ldr_procs b/nagios/scripts/check_facts_ldr_procs
new file mode 100644
index 0000000..6ed8eb1
--- /dev/null
+++ b/nagios/scripts/check_facts_ldr_procs
@@ -0,0 +1,213 @@
+#!/bin/bash
+##################################################################################
+# NAME:    ./check_facts_ldr_procs
+# PURPOSE: This script is a Nagios Plugin to test FACTS Loader processes
+#          It checks Java if certain Java processes are running or not.
+# USAGE: ./check_facts_ldr_procs [ -p {proc_list} ] [ -P {pidfile_list} ]
+#       -p {proc_list}    = Comma seperated list of Process names to grep for
+#   -P {pidfile_list} = Comma seperated lsit of PID Files. PIDs in files will
+#                       be looked for.
+#
+# REVISIONS:
+# Ver     Date        Author           Description
+# ----- ----------  ----------  ------------------------------------
+# 2.0   2010-05-07  JD Loots    1. Modified the script for MTN FACTS purposes.
+#                                  Removed PORT checks.
+# 2.1   2010-06-02  JD Loots    2. There was a bug in checking PIDs in Linux.
+#                                  Bug was fixed by introducing a PS variable.
+# 2.2   2011-05-31  JD Loots    3. Added ability to specify the processes and
+#                                  PID files on command line (-p and -P) instead
+#                                  of having the processes specified inside
+#                                  script. Also removed Warning level procs tests.
+# 2.3   2011-05-09  JD Loots    4. Added exit to printUsage sub.
+##################################################################################
+
+##################################################################################
+#
+# PID Files to check
+PIDLIST=""           # Will be populated from -p argument
+# Processes to check
+PROCLIST=""          # Will be populated from -P argument
+
+PATH="/usr/bin:/usr/sbin:/bin:/sbin"
+
+if [ "`uname -s`" = "SunOS" ]
+then
+  PSAUXWWW="/usr/ucb/ps -auxwww"
+  PS=/usr/bin/ps
+elif [ "`uname -s`" = "Linux" ]
+then
+  PSAUXWWW="/bin/ps auxwww"
+  PS=/bin/ps
+else
+  PSAUXWWW="/bin/ps -auxwww"
+  PS=/bin/ps
+fi
+
+STATE_OK=0
+STATE_WARNING=1
+STATE_CRITICAL=2
+STATE_UNKNOWN=3
+STATE_DEPENDENT=4
+
+print_gpl() {
+    echo "This program is free software; you can redistribute it and/or modify"
+    echo "it under the terms of the GNU General Public License as published by"
+    echo "the Free Software Foundation; either version 2 of the License, or"
+    echo "(at your option) any later version."
+    echo ""
+    echo "This program is distributed in the hope that it will be useful,"
+    echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
+    echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the"
+    echo "GNU General Public License for more details."
+    echo ""
+    echo "You should have received a copy of the GNU General Public License"
+    echo "along with this program; if not, write to the Free Software"
+    echo "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA"
+}
+
+printUsage(){
+    echo ""
+    echo "FACTS Loader process and port check script for Nagios."
+        echo ""
+    echo "USAGE: $0  [ -p {proc_list} ] [ -P {pidfile_list} ]"
+    echo "-p {proc_list}    = Comma seperated list of Process names to grep for"
+    echo "-P {pidfile_list} = Comma seperated lsit of PID Files. PIDs in files will"
+    echo "                    be looked for."
+        echo ""
+        echo "EXAMPLE: $0 -p StatsGW,NotificationManager,DownloadManager,serviceManager,ViewManager,factsbi/cs/jboss \\"
+        echo "   -P /app/factsbi/es/tmp/es.pid,/app/factsbi/en1/tmp/en.pid"
+        print_gpl
+    exit 1
+}
+
+check_processes()
+{
+        PROCESS="0"
+        ERROR_PROCS=""
+        for PROC in `echo $PROCLIST`
+        do
+          if [ `${PSAUXWWW} | grep $PROC | grep -v grep | wc -l` -lt 1 ]
+          then
+            PROCESS=1
+            ERROR_PROCS="$ERROR_PROCS""$PROC ";
+          fi
+        done
+
+        if [ $PROCESS -eq "1" ]
+        then
+          exit_proc=$STATE_CRITICAL
+            elif [ $PROCESS -eq "0" ]
+            then
+                  exit_proc=$STATE_OK
+        fi
+}
+
+check_pids()
+{
+  PROCESS="0"
+  ERROR_PIDS=""
+  for PIDFILE in `echo $PIDLIST`
+  do
+    if [ ! -r ${PIDFILE} ]
+    then
+      PROCESS=1
+      ERROR_PIDS="${ERROR_PIDS} ${PIDFILE}"
+    else
+      PID=`cat ${PIDFILE} | head -1`
+      ${PS} -p ${PID} > /dev/null 2>&1
+      CODE=$?
+      if [ ${CODE} -gt 0 ]
+      then
+        PROCESS=1
+        ERROR_PIDS="${ERROR_PIDS} ${PIDFILE}"
+      fi
+    fi
+  done
+
+  if [ $PROCESS -eq "1" ]
+  then
+    exit_pid=$STATE_CRITICAL
+  elif [ $PROCESS -eq "0" ]
+  then
+    exit_pid=$STATE_OK
+  fi
+}
+#
+# MAIN
+#
+
+if [ "$1" = "" ]
+then
+  echo "ERROR:No argument specified." >&2
+  printUsage
+fi
+
+# Decode command-line arguments
+while [ "$1" != "" ]
+do
+  case "$1" in
+    '-p' ) PROCLIST=$2
+           shift 2
+           ;;
+    '-P' ) PIDLIST=$2
+           shift 2
+           ;;
+    '-h' ) printUsage
+           shift
+           ;;
+     *)    # In case all parameters were passed as one, decode with awk
+           if [ "$1" != "" ] && [ "$2" = "" ]
+           then
+             NF=`echo $1 | awk '{print NF}'`
+             let i=1
+             while [ $i -lt $NF ]
+             do
+               let j=i+1        # Make j 1 more than i
+               ONE=`echo $1 | awk '{print $'${i}'}'`
+               TWO=`echo $1 | awk '{print $'${j}'}'`
+               case "${ONE}" in
+                 '-p' ) PROCLIST=$TWO
+                        let i=i+2       # shift 2
+                        ;;
+                 '-P' ) PIDLIST=`echo "scale=0;$TWO * ${SCALE} / 1" |bc`
+                        let i=i+2       # shift 2
+                        ;;
+                 '-h' ) printUsage
+                        let i=i+1       # shift
+                        ;;
+                 *)     echo "Unknown argument: \"$ONE\"" >&2
+                        printUsage
+                        ;;
+               esac
+             done
+             shift
+           else
+             echo "Unknown argument: \"$1\"" >&2
+             printUsage
+           fi
+           ;;
+  esac
+done
+
+# At this stage, PROCLIST and PIDLIST are Comma Seperated Lists.
+# Replace Comma's with spaces in these values.
+PIDLIST=`echo ${PIDLIST} | sed 's/,/ /g'`
+PROCLIST=`echo ${PROCLIST} | sed 's/,/ /g'`
+
+# Do the Process checks
+check_processes
+check_pids
+
+final_exit=`expr $exit_proc + $exit_pid`
+
+if [ $final_exit -eq "0" ]
+then
+  echo "SYSTEM OK - All monitored resources OK. Processes: ${PROCLIST}. PID Files: ${PIDLIST}."
+  exitstatus=$STATE_OK
+else
+  echo "SYSTEM CRITICAL - Processes DOWN! Processes: ${ERROR_PROCS} ${ERROR_PIDS}."
+  exitstatus=$STATE_CRITICAL
+fi
+
+exit $exitstatus
diff --git a/nagios/scripts/check_mem.pl b/nagios/scripts/check_mem.pl
new file mode 100644
index 0000000..7dec91f
--- /dev/null
+++ b/nagios/scripts/check_mem.pl
@@ -0,0 +1,244 @@
+#!/usr/bin/perl -w
+# $Id: check_mem.pl 2 2002-02-28 06:42:51Z egalstad $
+
+# Original script stolen from:
+# check_mem.pl Copyright (C) 2000 Dan Larsson <dl@tyfon.net>
+# hacked by
+# Justin Ellison <justin@techadvise.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# you should have received a copy of the GNU General Public License
+# along with this program (or with Nagios);  if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA
+
+# Tell Perl what we need to use
+use strict;
+use Getopt::Std;
+
+#TODO - Convert to Nagios::Plugin
+#TODO - Use an alarm
+
+# Predefined exit codes for Nagios
+use vars qw($opt_c $opt_f $opt_u $opt_w $opt_C $opt_v %exit_codes);
+%exit_codes   = ('UNKNOWN' ,-1,
+                         'OK'      , 0,
+                 'WARNING' , 1,
+                 'CRITICAL', 2,
+                 );
+
+# Get our variables, do our checking:
+init();
+
+# Get the numbers:
+my ($free_memory_kb,$used_memory_kb,$caches_kb) = get_memory_info();
+print "$free_memory_kb Free\n$used_memory_kb Used\n$caches_kb Cache\n" if ($opt_v);
+
+if ($opt_C) { #Do we count caches as free?
+    $used_memory_kb -= $caches_kb;
+    $free_memory_kb += $caches_kb;
+}
+
+# Round to the nearest KB
+$free_memory_kb = sprintf('%d',$free_memory_kb);
+$used_memory_kb = sprintf('%d',$used_memory_kb);
+$caches_kb = sprintf('%d',$caches_kb);
+
+# Tell Nagios what we came up with
+tell_nagios($used_memory_kb,$free_memory_kb,$caches_kb);
+
+
+sub tell_nagios {
+    my ($used,$free,$caches) = @_;
+
+    # Calculate Total Memory
+    my $total = $free + $used;
+    print "$total Total\n" if ($opt_v);
+
+    my $perfdata = "|TOTAL=${total}KB;;;; USED=${used}KB;;;; FREE=${free}KB;;;; CACHES=${caches}KB;;;;";
+
+    if ($opt_f) {
+      my $percent    = sprintf "%.1f", ($free / $total * 100);
+      if ($percent <= $opt_c) {
+          finish("CRITICAL - $percent% ($free kB) free!$perfdata",$exit_codes{'CRITICAL'});
+      }
+      elsif ($percent <= $opt_w) {
+          finish("WARNING - $percent% ($free kB) free!$perfdata",$exit_codes{'WARNING'});
+      }
+      else {
+          finish("OK - $percent% ($free kB) free.$perfdata",$exit_codes{'OK'});
+      }
+    }
+    elsif ($opt_u) {
+      my $percent    = sprintf "%.1f", ($used / $total * 100);
+      if ($percent >= $opt_c) {
+          finish("CRITICAL - $percent% ($used kB) used!|$perfdata",$exit_codes{'CRITICAL'});
+      }
+      elsif ($percent >= $opt_w) {
+          finish("WARNING - $percent% ($used kB) used!|$perfdata",$exit_codes{'WARNING'});
+      }
+      else {
+          finish("OK - $percent% ($used kB) used.|$perfdata",$exit_codes{'OK'});
+      }
+    }
+}
+
+# Show usage
+sub usage() {
+  print "\ncheck_mem.pl v1.0 - Nagios Plugin\n\n";
+  print "usage:\n";
+  print " check_mem.pl -<f|u> -w <warnlevel> -c <critlevel>\n\n";
+  print "options:\n";
+  print " -f           Check FREE memory\n";
+  print " -u           Check USED memory\n";
+  print " -C           Count OS caches as FREE memory\n";
+  print " -w PERCENT   Percent free/used when to warn\n";
+  print " -c PERCENT   Percent free/used when critical\n";
+  print "\nCopyright (C) 2000 Dan Larsson <dl\@tyfon.net>\n";
+  print "check_mem.pl comes with absolutely NO WARRANTY either implied or explicit\n";
+  print "This program is licensed under the terms of the\n";
+  print "GNU General Public License (check source code for details)\n";
+  exit $exit_codes{'UNKNOWN'};
+}
+
+sub get_memory_info {
+    my $used_memory_kb  = 0;
+    my $free_memory_kb  = 0;
+    my $total_memory_kb = 0;
+    my $caches_kb       = 0;
+
+    my $uname;
+    if ( -e '/usr/bin/uname') {
+        $uname = `/usr/bin/uname -a`;
+    }
+    elsif ( -e '/bin/uname') {
+        $uname = `/bin/uname -a`;
+    }
+    else {
+        die "Unable to find uname in /usr/bin or /bin!\n";
+    }
+    print "uname returns $uname" if ($opt_v);
+    if ( $uname =~ /Linux/ ) {
+        my @meminfo = `/bin/cat /proc/meminfo`;
+        foreach (@meminfo) {
+            chomp;
+            if (/^Mem(Total|Free):\s+(\d+) kB/) {
+                my $counter_name = $1;
+                if ($counter_name eq 'Free') {
+                    $free_memory_kb = $2;
+                }
+                elsif ($counter_name eq 'Total') {
+                    $total_memory_kb = $2;
+                }
+            }
+            elsif (/^(Buffers|Cached):\s+(\d+) kB/) {
+                $caches_kb += $2;
+            }
+        }
+        $used_memory_kb = $total_memory_kb - $free_memory_kb;
+    }
+    elsif ( $uname =~ /SunOS/ ) {
+        eval "use Sun::Solaris::Kstat";
+        if ($@) { #Kstat not available
+            if ($opt_C) {
+                print "You can't report on Solaris caches without Sun::Solaris::Kstat available!\n";
+                exit $exit_codes{UNKNOWN};
+            }
+            my @vmstat = `/usr/bin/vmstat 1 2`;
+            my $line;
+            foreach (@vmstat) {
+              chomp;
+              $line = $_;
+            }
+            $free_memory_kb = (split(/ /,$line))[5] / 1024;
+            my @prtconf = `/usr/sbin/prtconf`;
+            foreach (@prtconf) {
+                if (/^Memory size: (\d+) Megabytes/) {
+                    $total_memory_kb = $1 * 1024;
+                }
+            }
+            $used_memory_kb = $total_memory_kb - $free_memory_kb;
+
+        }
+        else { # We have kstat
+            my $kstat = Sun::Solaris::Kstat->new();
+            my $phys_pages = ${kstat}->{unix}->{0}->{system_pages}->{physmem};
+            my $free_pages = ${kstat}->{unix}->{0}->{system_pages}->{freemem};
+            # We probably should account for UFS caching here, but it's unclear
+            # to me how to determine UFS's cache size.  There's inode_cache,
+            # and maybe the physmem variable in the system_pages module??
+            # In the real world, it looks to be so small as not to really matter,
+            # so we don't grab it.  If someone can give me code that does this,
+            # I'd be glad to put it in.
+            my $arc_size = (exists ${kstat}->{zfs} && ${kstat}->{zfs}->{0}->{arcstats}->{size}) ?
+                 ${kstat}->{zfs}->{0}->{arcstats}->{size} / 1024
+                 : 0;
+            $caches_kb += $arc_size;
+            my $pagesize = `pagesize`;
+
+            $total_memory_kb = $phys_pages * $pagesize / 1024;
+            $free_memory_kb = $free_pages * $pagesize / 1024;
+            $used_memory_kb = $total_memory_kb - $free_memory_kb;
+        }
+    }
+    else {
+        if ($opt_C) {
+            print "You can't report on $uname caches!\n";
+            exit $exit_codes{UNKNOWN};
+        }
+        my $command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`;
+        chomp $command_line;
+        my @memlist      = split(/ /, $command_line);
+
+        # Define the calculating scalars
+        $used_memory_kb  = $memlist[0]/1024;
+        $free_memory_kb = $memlist[1]/1024;
+        $total_memory_kb = $used_memory_kb + $free_memory_kb;
+    }
+    return ($free_memory_kb,$used_memory_kb,$caches_kb);
+}
+
+sub init {
+    # Get the options
+    if ($#ARGV le 0) {
+      &usage;
+    }
+    else {
+      getopts('c:fuCvw:');
+    }
+
+    # Shortcircuit the switches
+    if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0) {
+      print "*** You must define WARN and CRITICAL levels!\n";
+      &usage;
+    }
+    elsif (!$opt_f and !$opt_u) {
+      print "*** You must select to monitor either USED or FREE memory!\n";
+      &usage;
+    }
+
+    # Check if levels are sane
+    if ($opt_w <= $opt_c and $opt_f) {
+      print "*** WARN level must not be less than CRITICAL when checking FREE memory!\n";
+      &usage;
+    }
+    elsif ($opt_w >= $opt_c and $opt_u) {
+      print "*** WARN level must not be greater than CRITICAL when checking USED memory!\n";
+      &usage;
+    }
+}
+
+sub finish {
+    my ($msg,$state) = @_;
+    print "$msg\n";
+    exit $state;
+}
diff --git a/nagios/servicegroups.cfg b/nagios/servicegroups.cfg
new file mode 100644
index 0000000..1051fd2
--- /dev/null
+++ b/nagios/servicegroups.cfg
@@ -0,0 +1,4 @@
+define servicegroup{
+    servicegroup_name                  jboss_instances
+    alias                              JBoss Instances
+}

--
Gitblit v1.8.0