diff --git a/.gitignore b/.gitignore index 6a37df9..a78e75c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc cpu-usage-data.json +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e01ef2c..48c8650 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ EXPOSE 8080 ADD sendEmail-epel-7.repo /etc/yum.repos.d/ RUN yum install -y epel-release && \ - INSTALL_PKGS="httpd nagios telnet supervisor python-jinja2 nagios-plugins-all sendEmail perl-Net-SSLeay perl-IO-Socket-SSL" && \ + INSTALL_PKGS="httpd telnet supervisor python-jinja2 nagios-plugins-all sendEmail perl-Net-SSLeay perl-IO-Socket-SSL" && \ yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ yum clean all && \ @@ -18,16 +18,20 @@ RUN yum install -y epel-release && \ /etc/httpd/conf/httpd.conf && \ touch /supervisord.log /supervisord.pid && \ mkdir -p /var/log/nagios/archives /var/log/nagios/rw/ /var/log/nagios/spool/checkresults /opt/rhmap/nagios/plugins/lib && \ - chmod -R 777 /supervisord.log /supervisord.pid /var/log/nagios \ - /etc/httpd /etc/passwd /var/log /etc/nagios /usr/lib64/nagios \ - /var/spool/nagios /run /usr/share/httpd /usr/share/nagios && \ + chmod -R 777 /supervisord.log /supervisord.pid \ + /etc/httpd /etc/passwd /var/log \ + /run /usr/share/httpd +COPY ./nagios-4.0.8-2.el7.x86_64.rpm . +RUN yum localinstall -y --nogpgcheck ./nagios-4.0.8-2.el7.x86_64.rpm +RUN chmod -R 777 /usr/share/nagios /etc/nagios /usr/lib64/nagios /var/log/nagios /var/spool/nagios && \ sed -i -e 's|cfg_file=/etc/nagios/objects/localhost.cfg||' /etc/nagios/nagios.cfg - COPY supervisord.conf /etc/supervisord.conf COPY make-nagios-fhservices-cfg make-nagios-commands-cfg fhservices.cfg.j2 commands.cfg.j2 /opt/rhmap/ COPY plugins/default/ /opt/rhmap/nagios/plugins/ COPY scripts/ /opt/rhmap/ RUN chmod -R 755 /opt/rhmap/nagios/plugins/ COPY start /start +COPY snmp-scripts /usr/local/bin/ +COPY mibs/ /usr/share/snmp/mibs CMD ["/start"] diff --git a/README.md b/README.md index 8e66c1b..abadc0a 100644 --- a/README.md +++ b/README.md @@ -120,4 +120,4 @@ To bump the version for nagios-container: * Go to the [nagios_container_pullrequests](http://bob.feedhenry.net:8080/job/nagios-container_pullrequests/) job in Jenkins * Configure * Go to `Execute shell` -* Bump the version at `VERSION=""` +* Bump the version at `VERSION=""` \ No newline at end of file diff --git a/fhservices.cfg.j2 b/fhservices.cfg.j2 index 809a235..25fd3b5 100644 --- a/fhservices.cfg.j2 +++ b/fhservices.cfg.j2 @@ -123,7 +123,7 @@ define contact { define contactgroup { contactgroup_name rhmapadmins alias RHMAP Administrators - members rhmapadmin + members rhmapadmin, managementstation } define hostgroup { @@ -362,3 +362,26 @@ define service { notes One or more containers has no limit set for CPU and/or Memory. contact_groups rhmapadmins } + +# 'send-service-trap' command definition +define command{ + command_name send-service-trap + command_line /usr/local/bin/send-service-trap manager public "$HOSTNAME$" "$SERVICEDESC$" $SERVICESTATEID$ "$SERVICEOUTPUT$" +} + +# 'send-host-trap' command definition +define command{ + command_name send-host-trap + command_line /usr/local/bin/send-host-trap manager public "$HOSTNAME$" $HOSTSTATEID$ "$HOSTOUTPUT$" +} + +define contact{ + contact_name managementstation + use generic-contact + alias Management Station + service_notification_options w,u,c,r + host_notification_options d,u,r + service_notification_commands send-service-trap + host_notification_commands send-host-trap + } + diff --git a/mibs/NAGIOS-NOTIFY-MIB.txt b/mibs/NAGIOS-NOTIFY-MIB.txt new file mode 100644 index 0000000..03b4c07 --- /dev/null +++ b/mibs/NAGIOS-NOTIFY-MIB.txt @@ -0,0 +1,620 @@ +NAGIOS-NOTIFY-MIB DEFINITIONS ::= BEGIN + IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, + Integer32, Gauge32 + FROM SNMPv2-SMI + nagios,NotifyType,HostStateID,HostStateType,ServiceStateID + FROM NAGIOS-ROOT-MIB; + +nagiosNotify MODULE-IDENTITY + LAST-UPDATED "200503090000Z" -- March 9, 2005 + ORGANIZATION "Nagios" + CONTACT-INFO + " Subhendu Ghosh + + Telephone: +1 201 232 2851 + Email: sghosh@users.sourceforge.net + + Nagios Information: + http://www.nagios.org + " + DESCRIPTION + "Objects for Nagios(tm) events. There are 2 primary tables + reflecting the division in Nagios for Host events and + Service events. + + The event tables are extended by the HostNotifyTable and the + ServiceNotifyTable to keep track of the notifications based on events. + + The tables entries themselves are not accessible but are used for OID + entries for TRAP/INFORM notifications. + + These objects are based on the macros defined in Nagios v2.0 + " + REVISION "200503090000Z" -- March 9, 2005 + DESCRIPTION + "Spell check" + REVISION "200501200000Z" --January 20, 2005 + DESCRIPTION + "Initial Version" + ::= { nagios 1 } + + +nagiosHostEventTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostEventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of Nagios host events" + ::= { nagiosNotify 1 } + +HostEventEntry ::= SEQUENCE { + nHostEventIndex Integer32, + nHostname OCTET STRING, + nHostAlias OCTET STRING, + nHostStateID HostStateID, + nHostStateType HostStateType, + nHostAttempt Integer32, + nHostDurationSec Integer32, + nHostGroupName OCTET STRING, + nHostLastCheck INTEGER, + nHostLastChange INTEGER, + nHostLastUp INTEGER, + nHostLastDown INTEGER, + nHostLastUnreachable INTEGER, + nHostOutput OCTET STRING, + nHostPerfData OCTET STRING + } + +nagiosHostEventEntry OBJECT-TYPE + SYNTAX HostEventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Each notification event" + INDEX { nHostEventIndex } + ::= { nagiosHostEventTable 1 } + +nHostEventIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This object uniquely identifies this host event entry. It is generated + by the SNMP application and is not related to any Nagios data." + ::= { nagiosHostEventEntry 1 } + +nHostname OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Hostname as specified in the Nagios configuration file." + ::= { nagiosHostEventEntry 2 } + +nHostAlias OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The host alias as specified in the Nagios configuration file" + ::= { nagiosHostEventEntry 3 } + +nHostStateID OBJECT-TYPE + SYNTAX HostStateID + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The host state as defined by the HOSTSTATEID macro" + ::= { nagiosHostEventEntry 4 } + +nHostStateType OBJECT-TYPE + SYNTAX HostStateType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The host state as defined by the HOSTSTATETYPE macro" + ::= { nagiosHostEventEntry 5 } + +nHostAttempt OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of the current host check retry. For instance, if this is the + second time that the host is being rechecked, this will be the number two. + Current attempt number is really only useful when writing host event + handlers for soft states that take a specific action based on the host retry + number. The host state as defined by the HOSTSTATEID macro" + ::= { nagiosHostEventEntry 6 } + +nHostDurationSec OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A number indicating the number of seconds that the host has spent in its + current state" + ::= { nagiosHostEventEntry 7 } + +nHostGroupName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The short name of the hostgroup that this host belongs to. This value is + taken from the hostgroup_name directive in the hostgroup definition. If the + host belongs to more than one hostgroup this macro will contain the name of + just one of them." + ::= { nagiosHostEventEntry 8 } + +nHostLastCheck OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which a check of the host was last performed." + ::= { nagiosHostEventEntry 9 } + +nHostLastChange OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time the host last changed state." + ::= { nagiosHostEventEntry 10 } + +nHostLastUp OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the host was last detected as being in an UP + state." + ::= { nagiosHostEventEntry 11 } + +nHostLastDown OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the host was last detected as being in an + DOWN state." + ::= { nagiosHostEventEntry 12 } + +nHostLastUnreachable OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the host was last detected as being in an + UNREACHABLE state." + ::= { nagiosHostEventEntry 13 } + +nHostOutput OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The text output from the last host check (i.e. Ping OK)." + ::= { nagiosHostEventEntry 14 } + +nHostPerfData OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object contains any performance data that may have been returned + by the last host check." + ::= { nagiosHostEventEntry 15 } + + + +-- +-- Host Notifications + +nagiosHostNotifyTable OBJECT-TYPE + SYNTAX SEQUENCE OF HostNotifyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of Nagios host notifications" + ::= {nagiosNotify 2} + +HostNotifyEntry ::= SEQUENCE { + nHostNotifyType NotifyType, + nHostNotifyNum Gauge32, -- was Integer32, + nHostAckAuthor OCTET STRING, + nHostAckComment OCTET STRING + } + +nagiosHostNotifyEntry OBJECT-TYPE + SYNTAX HostNotifyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Nagios host notifications extends the nagiosHostEventTable when a + notification is generated for an event." + INDEX { nHostEventIndex } + ::= { nagiosHostNotifyTable 1 } + +nHostNotifyType OBJECT-TYPE + SYNTAX NotifyType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This identifies the type of notification that is being sent + (PROBLEM, RECOVERY, ACKNOWLEDGEMENT, FLAPPINGSTART or FLAPPINGSTOP)" + ::= { nagiosHostNotifyEntry 1 } + +nHostNotifyNum OBJECT-TYPE + SYNTAX Gauge32 -- was NotifyType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This identifies the current notification number for the service or host. + The notification number increases by one (1) each time a new notification + is sent out for a host or service (except for acknowledgements). The + notification number is reset to 0 when the host or service recovers + (after the recovery notification has gone out). Acknowledgements do not + cause the notification number to increase." + ::= { nagiosHostNotifyEntry 2 } + +nHostAckAuthor OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string containing the name of the user who acknowledged the host + problem. This macro is only valid in notifications where the + $NOTIFICATIONTYPE$ macro is set to ACKNOWLEDGEMENT." + ::= { nagiosHostNotifyEntry 3 } + +nHostAckComment OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string containing the acknowledgement comment that was entered by + the user who acknowledged the host problem. This macro is only valid + in notifications where the $NOTIFICATIONTYPE$ macro is set to ACKNOWLEDGEMENT" + ::= { nagiosHostNotifyEntry 4 } + + +-- +-- Service Events +-- + + +nagiosSvcEventTable OBJECT-TYPE + SYNTAX SEQUENCE OF SvcEventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of Nagios service notifications" + ::= { nagiosNotify 3 } + +SvcEventEntry ::= SEQUENCE { + nSvcEventIndex Integer32, + nSvcHostname OCTET STRING, + nSvcHostAlias OCTET STRING, + nSvcHostStateID HostStateID, + nSvcHostStateType HostStateType, + nSvcDesc OCTET STRING, + nSvcStateID ServiceStateID, + nSvcAttempt Integer32, + nSvcDurationSec Integer32, + nSvcGroupName OCTET STRING, + nSvcLastCheck INTEGER, + nSvcLastChange INTEGER, + nSvcLastOK INTEGER, + nSvcLastWarn INTEGER, + nSvcLastCrit INTEGER, + nSvcLastUnkn INTEGER, + nSvcOutput OCTET STRING, + nSvcPerfData OCTET STRING + } + +nagiosSvcEventEntry OBJECT-TYPE + SYNTAX SvcEventEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of Nagios service events." + INDEX { nSvcEventIndex } + ::= { nagiosSvcEventTable 1 } + +nSvcEventIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This object uniquely identifies this service event entry" + ::= { nagiosSvcEventEntry 1 } + +nSvcHostname OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Hostname as specified in the Nagios configuration file." + ::= { nagiosSvcEventEntry 2 } + +nSvcHostAlias OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The host alias as specified in the Nagios configuration file" + ::= { nagiosSvcEventEntry 3 } + +nSvcHostStateID OBJECT-TYPE + SYNTAX HostStateID + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A number that corresponds to the current state of the service: 0=OK, + 1=WARNING, 2=CRITICAL, 3=UNKNOWN." + ::= { nagiosSvcEventEntry 4 } + +nSvcHostStateType OBJECT-TYPE + SYNTAX HostStateType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Whether the host is in a hard or soft state." + ::= { nagiosSvcEventEntry 5 } + +nSvcDesc OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This value is taken from the description directive of the service + definition." + ::= { nagiosSvcEventEntry 6 } + +nSvcStateID OBJECT-TYPE + SYNTAX ServiceStateID + MAX-ACCESS read-only + STATUS current + DESCRIPTION + " A number that corresponds to the current state of the service: 0=OK, + 1=WARNING, 2=CRITICAL, 3=UNKNOWN" + ::= { nagiosSvcEventEntry 7 } + +nSvcAttempt OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of the current service check retry. For instance, if this is + the second time that the service is being rechecked, this will be the + number two. Current attempt number is really only useful when writing + service event handlers for soft states that take a specific action based + on the service retry number." + ::= { nagiosSvcEventEntry 8 } + +nSvcDurationSec OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A number indicating the number of seconds that the service has spent in + its current state." + ::= { nagiosSvcEventEntry 9 } + +nSvcGroupName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The short name of the servicegroup that this service belongs to. This + value is taken from the servicegroup_name directive in the servicegroup + definition. If the service belongs to more than one servicegroup this + object will contain the name of just one of them." + ::= { nagiosSvcEventEntry 10 } + +nSvcLastCheck OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which a check of the service was last performed." + ::= { nagiosSvcEventEntry 11 } + +nSvcLastChange OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time the service last changed state." + ::= { nagiosSvcEventEntry 12 } + +nSvcLastOK OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the service was last detected as being in an + OK state." + ::= { nagiosSvcEventEntry 13 } + +nSvcLastWarn OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the service was last detected as being in a + WARNING state." + ::= { nagiosSvcEventEntry 14 } + +nSvcLastCrit OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the service was last detected as being in a + CRITICAL state." + ::= { nagiosSvcEventEntry 15 } + +nSvcLastUnkn OBJECT-TYPE + SYNTAX INTEGER + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This is a timestamp in time_t format (seconds since the UNIX epoch) + indicating the time at which the service was last detected as being in an + UNKNOWN state." + ::= { nagiosSvcEventEntry 16 } + +nSvcOutput OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The text output from the last service check (i.e. Ping OK)." + ::= { nagiosSvcEventEntry 17 } + +nSvcPerfData OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "This object contains any performance data that may have been returned by + the last service check." + ::= { nagiosSvcEventEntry 18 } + + +-- +-- Service Notifications +-- + +nagiosSvcNotifyTable OBJECT-TYPE + SYNTAX SEQUENCE OF SvcNotifyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of Nagios service notifications." + ::= { nagiosNotify 4 } + +SvcNotifyEntry ::= SEQUENCE { + nSvcNotifyType NotifyType, + nSvcNotifyNum Gauge32, -- Integer32, + nSvcAckAuthor OCTET STRING, + nSvcAckComment OCTET STRING + } + +nagiosSvcNotifyEntry OBJECT-TYPE + SYNTAX SvcNotifyEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Nagios service notifications extends the nagiosSvcEnevtsTable when + a notification is generated for an event." + INDEX { nSvcEventIndex } + ::= { nagiosSvcNotifyTable 1} + + +nSvcNotifyType OBJECT-TYPE + SYNTAX NotifyType + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string identifying the type of notification that is being sent + (PROBLEM, RECOVERY, ACKNOWLEDGEMENT, FLAPPINGSTART or FLAPPINGSTOP)." + ::= { nagiosSvcNotifyEntry 1 } + +nSvcNotifyNum OBJECT-TYPE + SYNTAX Gauge32 -- Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current notification number for the service or host. The notification + number increases by one (1) each time a new notification is sent out for a + host or service (except for acknowledgements). The notification number is + reset to 0 when the host or service recovers (after the recovery + notification has gone out). Acknowledgements do not cause the notification + number to increase." + ::= { nagiosSvcNotifyEntry 2 } + +nSvcAckAuthor OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string containing the name of the user who acknowledged the service + problem. This object is only valid in notifications where the + nSvcNotifyType object is set to ACKNOWLEDGEMENT." + ::= { nagiosSvcNotifyEntry 3 } + +nSvcAckComment OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string containing the acknowledgement comment that was entered by the + user who acknowledged the service problem. This object is only valid in + notifications where the nSvcNotifyType object is set to ACKNOWLEDGEMENT." + ::= { nagiosSvcNotifyEntry 4 } + + +-- +-- Events and Notifications +-- + +nHostEvent NOTIFICATION-TYPE + OBJECTS { nHostname, nHostStateID, nHostStateType, nHostAttempt, + nHostDurationSec, nHostGroupName, nHostLastCheck, nHostLastChange, + nHostOutput } + STATUS current + DESCRIPTION + "The SNMP trap that is generated as a result of an event with the host + in Nagios." + + ::= { nagiosNotify 5 } + +nHostNotify NOTIFICATION-TYPE + OBJECTS { nHostNotifyType, nHostNotifyNum, nHostAckAuthor, nHostAckComment, + nHostname, nHostStateID, nHostStateType, nHostAttempt, + nHostDurationSec, nHostGroupName, nHostLastCheck, nHostLastChange, + nHostOutput } + STATUS current + DESCRIPTION + "The SNMP trap that is generated as a result of an event requiring + notification for a host in Nagios." + ::= { nagiosNotify 6 } + +nSvcEvent NOTIFICATION-TYPE + OBJECTS { nHostname, nHostStateID, nSvcDesc, nSvcStateID, nSvcAttempt, + nSvcDurationSec, nSvcGroupName, nSvcLastCheck, nSvcLastChange, + nSvcOutput } + STATUS current + DESCRIPTION + "The SNMP trap that is generated as a result of an event with the service + in Nagios." + ::= { nagiosNotify 7 } + +nSvcNotify NOTIFICATION-TYPE + OBJECTS { nSvcNotifyType, nSvcNotifyNum, nSvcAckAuthor, nSvcAckComment, + nHostname, nHostStateID, nSvcDesc, nSvcStateID, nSvcAttempt, + nSvcDurationSec, nSvcGroupName, nSvcLastCheck, nSvcLastChange, + nSvcOutput } + STATUS current + DESCRIPTION + "The SNMP trap that is generated as a result of an event requiring + notification for a service in Nagios." + ::= { nagiosNotify 8 } + + +END diff --git a/mibs/NAGIOS-ROOT-MIB.txt b/mibs/NAGIOS-ROOT-MIB.txt new file mode 100644 index 0000000..1aa88eb --- /dev/null +++ b/mibs/NAGIOS-ROOT-MIB.txt @@ -0,0 +1,86 @@ +NAGIOS-ROOT-MIB DEFINITIONS ::= BEGIN +IMPORTS + MODULE-IDENTITY, enterprises + FROM SNMPv2-SMI + TEXTUAL-CONVENTION + FROM SNMPv2-TC; + + +nagios MODULE-IDENTITY + LAST-UPDATED "200503090000Z" -- March 9, 2005 + ORGANIZATION "Nagios" + CONTACT-INFO + " Subhendu Ghosh + + Telephone: +1 201 232 2851 + Email: sghosh@users.sourceforge.net + + Nagios Information: + http://www.nagios.org + " + DESCRIPTION + "Objects for Nagios(tm) NMS" + REVISION "200503090000Z" -- March 9, 2005 + DESCRIPTION + "Spell check" + REVISION "200501200000Z" --January 20, 2005 + DESCRIPTION + "Initial Version" + ::= {enterprises 20006} + +-- +-- Textual Conventions +-- + +NotifyType ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "A string identifying the type of notification that is being sent + (PROBLEM, RECOVERY, ACKNOWLEDGEMENT, FLAPPINGSTART or FLAPPINGSTOP). + " + SYNTAX INTEGER { + problem(0), + recovery(1), + acknowledgement(2), + flappingstart(3), + flappingstop(4) + } + +HostStateID ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "A number that corresponds to the current state of the host: 0=UP, 1=DOWN, + 2=UNREACHABLE." + SYNTAX INTEGER { + up(0), + down(1), + unreachable(3) + } + +HostStateType ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "A string indicating the state type for the current host check (HARD or + SOFT). Soft states occur when host checks return a non-OK (non-UP) state + and are in the process of being retried. Hard states result when host + checks have been checked a specified maximum number of times." + SYNTAX INTEGER { + hard(0), + soft(1) + } + +ServiceStateID ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "A number that corresponds to the current state of the service: 0=OK, + 1=WARNING, 2=CRITICAL, 3=UNKNOWN. + " + SYNTAX INTEGER{ + ok(0), + warning(1), + critical(2), + unknown(3) + } + + +END diff --git a/nagios-4.0.8-2.el7.x86_64.rpm b/nagios-4.0.8-2.el7.x86_64.rpm new file mode 100644 index 0000000..fdbeb98 Binary files /dev/null and b/nagios-4.0.8-2.el7.x86_64.rpm differ diff --git a/snmp-scripts/send-host-trap b/snmp-scripts/send-host-trap new file mode 100755 index 0000000..480a2c4 --- /dev/null +++ b/snmp-scripts/send-host-trap @@ -0,0 +1,9 @@ +# Arguments: +# $1 = Management Station +# $2 = Community String +# $3 = host_name +# $4 = HostStatID A number that corresponds to the current state of the host: 0=UP, 1=DOWN, 2=UNREACHABLE. +# $5 = HOSTOUTPUT The first line of text output from the last host check (i.e. "Ping OK"). +# +# +/usr/bin/snmptrap -v 2c -c $2 $SNMP_MANAGER '' NAGIOS-NOTIFY-MIB::nHostEvent nHostname s "$3" nHostStateID i $4 nHostOutput s "$5" \ No newline at end of file diff --git a/snmp-scripts/send-service-trap b/snmp-scripts/send-service-trap new file mode 100755 index 0000000..b506f9e --- /dev/null +++ b/snmp-scripts/send-service-trap @@ -0,0 +1,13 @@ +# Arguments: +# $1 = Management Station +# $2 = Community String +# $3 = host_name +# $4 = service_description (Description of the service) +# $5 = return_code (An integer that determines the state +# of the service check, 0=OK, 1=WARNING, 2=CRITICAL, +# 3=UNKNOWN). +# $6 = plugin_output (A text string that should be used +# as the plugin output for the service check) +# +# +/usr/bin/snmptrap -v 2c -c $2 $SNMP_MANAGER '' NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s "$3" nSvcDesc s "$4" nSvcStateID i $5 nSvcOutput s "$6" \ No newline at end of file diff --git a/start b/start index a3f8000..c3bd4f0 100755 --- a/start +++ b/start @@ -8,7 +8,7 @@ mkdir -p /var/log/nagios/archives \ set -o errexit set -o nounset set -o pipefail - +echo 'Setting password' # Add nagios user htpasswd -c -b -s /etc/nagios/passwd ${NAGIOS_USER} ${NAGIOS_PASSWORD}