diff --git a/extra/PCMK-MIB.txt b/extra/PCMK-MIB.txt index 3554e68bfb..13e9f74292 100644 --- a/extra/PCMK-MIB.txt +++ b/extra/PCMK-MIB.txt @@ -1,97 +1,104 @@ PACEMAKER-MIB DEFINITIONS ::= BEGIN -- -- MIB objects for the pacemaker cluster manager implementation -- IMPORTS MODULE-IDENTITY, OBJECT-TYPE, Integer32, NOTIFICATION-TYPE, enterprises FROM SNMPv2-SMI SnmpAdminString FROM SNMP-FRAMEWORK-MIB netSnmp FROM NET-SNMP-MIB RowStatus, StorageType FROM SNMPv2-TC InetAddressType, InetAddress FROM INET-ADDRESS-MIB ; pacemaker MODULE-IDENTITY LAST-UPDATED "200901051115Z" ORGANIZATION "www.clusterlabs.org" CONTACT-INFO "name: Michael Schwartzkopff email: pacemaker@oss.clusterlabs.org" DESCRIPTION "MIB objects for the pacemaker cluster manager implementation" REVISION "200910051115Z" DESCRIPTION "First draft" REVISION "200910062115Z" DESCRIPTION "Corrections after feedback from beekhof" ::= { enterprises 32723 } -- -- top level structure -- pacemakerNotification OBJECT IDENTIFIER ::= { pacemaker 1 } -- -- pacemaker Notifications -- pacemakerNotificationNode OBJECT-TYPE SYNTAX OCTET STRING (SIZE(1..64)) MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The node on which the status change happened." ::= { pacemakerNotification 1 } pacemakerNotificationResource OBJECT-TYPE SYNTAX OCTET STRING (SIZE(1..256)) MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The name of the resource that changed the status." ::= { pacemakerNotification 2 } pacemakerNotificationOperation OBJECT-TYPE SYNTAX OCTET STRING (SIZE(1..64)) MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The operation that caused the status change." ::= { pacemakerNotification 3 } pacemakerNotificationDescription OBJECT-TYPE SYNTAX OCTET STRING (SIZE(1..256)) MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The textual output relevant error code of the operation (if any) that caused the status change." ::= { pacemakerNotification 4 } pacemakerNotificationStatus OBJECT-TYPE SYNTAX Integer32 MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The numerical representation of the status of the operation." ::= { pacemakerNotification 5 } pacemakerNotificationReturnCode OBJECT-TYPE SYNTAX Integer32 MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The return code of the operation." ::= { pacemakerNotification 6 } pacemakerNotificationTargetReturnCode OBJECT-TYPE SYNTAX Integer32 MAX-ACCESS accessible-for-notify STATUS current DESCRIPTION "The expected return code of the operation." ::= { pacemakerNotification 7 } +pacemakerNotificationTrap NOTIFICATION-TYPE + OBJECTS { pacemakerNotificationNode, pacemakerNotificationResource, pacemakerNotificationOperation, pacemakerNotificationDescription, pacemakerNotificationStatus, pacemakerNotificationReturnCode, pacemakerNotificationTargetReturnCode } + STATUS current + DESCRIPTION + "Pacemaker notification trap" +::= { pacemakerNotification 1 } + END diff --git a/extra/pcmk_snmp_helper.sh b/extra/pcmk_snmp_helper.sh index 7eca8e671e..d35971317d 100644 --- a/extra/pcmk_snmp_helper.sh +++ b/extra/pcmk_snmp_helper.sh @@ -1,54 +1,51 @@ #!/bin/bash # # Copyright (C) 2013 Florian CROUZAT # # 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 software 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 library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Resources: # crm ra meta ocf:pacemaker:ClusterMon # man 8 crm_mon # Sample configuration # ================================ # primitive ClusterMon ocf:pacemaker:ClusterMon \ # params user="root" update="30" extra_options="-E /path/to/pcmk_snmp_helper.sh -e 192.168.1.2" \ # op monitor on-fail="restart" interval="10" -# -# clone ClusterMon-clone ClusterMon \ -# meta target-role="Started" # ================================ # The external agent is fed with environment variables allowing us to know # what transition happened and to react accordingly: # http://clusterlabs.org/doc/en-US/Pacemaker/1.1-crmsh/html/Pacemaker_Explained/s-notification-external.html # Generates SNMP alerts for any failing monitor operation # OR # for any operations (even successful) that are not a monitor if [[ ${CRM_notify_rc} != 0 && ${CRM_notify_task} == "monitor" ]] || [[ ${CRM_notify_task} != "monitor" ]] ; then # This trap is compliant with PACEMAKER MIB # https://github.com/ClusterLabs/pacemaker/blob/master/extra/PCMK-MIB.txt - /usr/bin/snmptrap -v 2c -c public ${CRM_notify_recipient} "" PACEMAKER-MIB::pacemakerNotification \ + /usr/bin/snmptrap -v 2c -c public ${CRM_notify_recipient} "" PACEMAKER-MIB::pacemakerNotificationTrap \ PACEMAKER-MIB::pacemakerNotificationNode s "${CRM_notify_node}" \ PACEMAKER-MIB::pacemakerNotificationResource s "${CRM_notify_rsc}" \ PACEMAKER-MIB::pacemakerNotificationOperation s "${CRM_notify_task}" \ PACEMAKER-MIB::pacemakerNotificationDescription s "${CRM_notify_desc}" \ PACEMAKER-MIB::pacemakerNotificationStatus i "${CRM_notify_status}" \ PACEMAKER-MIB::pacemakerNotificationReturnCode i ${CRM_notify_rc} \ PACEMAKER-MIB::pacemakerNotificationTargetReturnCode i ${CRM_notify_target_rc} && exit 0 || exit 1 fi exit 0