From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 14 Jun 2006 21:44:44 -0000 Subject: [Cluster-devel] conga ./Makefile ./configure ./conga.spec.in.i ... Message-ID: <20060614214444.27621.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: kupcevic at sourceware.org 2006-06-14 21:44:37 Modified files: . : Makefile configure conga.spec.in.in luci : Makefile configure luci/init.d : Makefile make : version.in ricci : Makefile configure ricci/init.d : Makefile ricci/make : defines.mk.in ricci/modules/cluster/clumon: Makefile ricci/modules/cluster/clumon/init.d: Makefile ricci/modules/cluster/clumon/src: Makefile ricci/modules/cluster/clumon/src/common: Makefile ricci/oddjobd.conf.d: Makefile ricci/pam.d : Makefile ricci/ricci : Makefile Added files: . : COPYING INSTALL autogen.sh luci : autogen.sh ricci : autogen.sh ricci/modules/cluster/clumon: COPYING README README.cim README.snmpd REDHAT-CLUSTER-MIB REDHAT-MIB RedHat_ClusterProvider.mof RedHat_ClusterSchema.mof ricci/modules/cluster/clumon/src/cim-provider: ClusterProvider.cpp ClusterProvider.h ClusterProviderMain.cpp Makefile SmartHandler.h clusterCIM_test.cpp clusterCIM_test.h ricci/modules/cluster/clumon/src/common: ClusterMonitor.cpp ricci/modules/cluster/clumon/src/include: ClusterMonitor.h ricci/modules/cluster/clumon/src/snmp-agent: Makefile clusterMIB.cpp clusterMIB.h clusterMonitorSnmp.cpp clusterMonitorSnmp.h nodesMIB.cpp nodesMIB.h nodesMIB_access.cpp nodesMIB_access.h nodesMIB_checkfns.cpp nodesMIB_checkfns.h nodesMIB_checkfns_local.cpp nodesMIB_checkfns_local.h nodesMIB_columns.h nodesMIB_enums.h servicesMIB.cpp servicesMIB.h servicesMIB_access.cpp servicesMIB_access.h servicesMIB_checkfns.cpp servicesMIB_checkfns.h servicesMIB_checkfns_local.cpp servicesMIB_checkfns_local.h servicesMIB_columns.h servicesMIB_enums.h Log message: Revamp build system; package cluster-snmp and cluster-cim rpms Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/COPYING.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/INSTALL.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/autogen.sh.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/Makefile.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/configure.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/autogen.sh.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/Makefile.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/configure.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/init.d/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/autogen.sh.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/configure.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/init.d/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/make/defines.mk.in.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/COPYING.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/README.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/README.cim.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/README.snmpd.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-MIB.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/RedHat_ClusterProvider.mof.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/init.d/Makefile.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/Makefile.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/ClusterMonitor.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/include/ClusterMonitor.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/Makefile.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/oddjobd.conf.d/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/pam.d/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Makefile.diff?cvsroot=cluster&r1=1.8&r2=1.9 /cvs/cluster/conga/COPYING,v --> standard output revision 1.1 --- conga/COPYING +++ - 2006-06-14 21:44:38.069571000 +0000 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. /cvs/cluster/conga/INSTALL,v --> standard output revision 1.1 --- conga/INSTALL +++ - 2006-06-14 21:44:38.156362000 +0000 @@ -0,0 +1,17 @@ + +# installation +make distclean +./autogen +./configure +make +su +make install + +# removal (broken - use rpm) +su +make uninstall + +# SRPM +make distclean +./autogen +make srpm /cvs/cluster/conga/autogen.sh,v --> standard output revision 1.1 --- conga/autogen.sh +++ - 2006-06-14 21:44:38.244958000 +0000 @@ -0,0 +1,17 @@ +#!/bin/bash + +# TODO: improve me + + +. make/version.in + +sed -e s/@@VERS@@/$VERSION/g conga.spec.in.in | \ + sed -e s/@@REL@@/$RELEASE/g > conga.spec + + +cd ricci ; ./autogen.sh ; cd .. +cd luci ; ./autogen.sh ; cd .. + + +echo "Run \`./configure\` to configure conga build" +echo "or \`make srpm\` to build srpm." --- conga/Makefile 2006/06/02 00:14:27 1.3 +++ conga/Makefile 2006/06/14 21:44:34 1.4 @@ -16,7 +16,6 @@ - all: make -C ricci make -C luci @@ -27,6 +26,11 @@ make -C luci install +clean: + make -C ricci clean + make -C luci clean + + distclean: make -C ricci distclean make -C luci distclean @@ -34,17 +38,10 @@ rm -f conga*.tar.gz conga*.src.rpm -clean: - make -C ricci clean - make -C luci clean - - -spec: - sed -e 's/@@VERS@@/${VERSION}/g' conga.spec.in.in > conga.spec.in - sed -e 's/@@REL@@/${RELEASE}/g' conga.spec.in > conga.spec +rebuild: clean all -srpm: distclean spec +srpm: clean rm -rf ${TMP_DIR}/${CONGA_DIRNAME} cp -r . ${TMP_DIR}/${CONGA_DIRNAME} rm -rf `find ${TMP_DIR}/${CONGA_DIRNAME} -name CVS` --- conga/configure 2006/06/02 00:14:27 1.1 +++ conga/configure 2006/06/14 21:44:34 1.2 @@ -3,10 +3,10 @@ # TODO: implement me - -./ricci/configure -./luci/configure +cd ricci ; ./configure $@ ; cd .. +cd luci ; ./configure $@ ; cd .. echo "Run 'make' to compile conga" + exit 0 --- conga/conga.spec.in.in 2006/06/09 16:32:19 1.3 +++ conga/conga.spec.in.in 2006/06/14 21:44:34 1.4 @@ -18,6 +18,7 @@ %define _libdir /usr/lib64 %endif +%define PEGASUS_PROVIDERS_DIR %{_libdir}/Pegasus/providers @@ -38,6 +39,7 @@ BuildRequires: glibc-devel gcc-c++ libxml2-devel make BuildRequires: openssl-devel dbus-devel pam-devel +BuildRequires: net-snmp-devel tog-pegasus-devel %description conga source rpm @@ -46,12 +48,14 @@ %setup -q %build -./configure --arch=%{_arch} --sbindir=%{_sbindir} --libdir=%{_libdir} +./autogen.sh +#./configure --arch=%{_arch} --sbindir=%{_sbindir} --libdir=%{_libdir} --docdir=%{_docdir} +%configure --arch=%{_arch} --docdir=%{_docdir} --pegasus_providers_dir=%{PEGASUS_PROVIDERS_DIR} make %install rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install %clean rm -rf $RPM_BUILD_ROOT @@ -82,9 +86,20 @@ %files -n luci %defattr(-,root,root) -/etc/init.d/luci +%config /etc/rc.d/init.d/luci %{_sbindir}/luci_admin -%attr(-,zope,zope)/var/lib/luci +%attr(-,luci,root) /var/lib/luci +%attr(600,luci,root) /var/lib/luci/var/Data.fs +%config /var/lib/luci/var/Data.fs +%config /var/lib/luci/etc/zope.conf +%config(noreplace) /var/lib/luci/etc/logrotate.conf +%config(noreplace) /var/lib/luci/etc/stunnel.conf + + +%pre -n luci +/usr/sbin/groupadd -r -f luci >/dev/null 2>&1 +/usr/sbin/useradd -r -M -s /sbin/nologin -g luci luci >/dev/null 2>&1 +exit 0 %post -n luci @@ -98,15 +113,15 @@ echo -n "admin:{SHA}$i" > /var/lib/luci/inituser fi done + /bin/chmod 600 /var/lib/luci/inituser + /bin/chown luci /var/lib/luci/inituser fi - %preun -n luci if [ "$1" = 0 ]; then /sbin/service luci stop >/dev/null 2>$1 /sbin/chkconfig --del luci -# /usr/sbin/userdel luci fi @@ -145,30 +160,36 @@ %files -n ricci %defattr(-,root,root) + # ricci #%doc README COPYING +%config /etc/rc.d/init.d/ricci +%config /etc/oddjobd.conf.d/reboot.conf +%config(noreplace) /etc/pam.d/ricci +%attr(-,ricci,root) /var/lib/ricci %{_sbindir}/ricci %{_sbindir}/ricci-worker %attr(4755,root,root) %{_sbindir}/ricci-auth -/var/lib/ricci -/etc/init.d/ricci -%attr(644,root,root) /etc/pam.d/ricci -%attr(644,root,root) /etc/oddjobd.conf.d/reboot.conf + # modrpm +%config /etc/oddjobd.conf.d/modrpm_rw.conf %{_sbindir}/ricci-modrpm %{_sbindir}/ricci-modrpm.exe -%attr(644,root,root) /etc/oddjobd.conf.d/modrpm_rw.conf + + +%pre -n ricci +/usr/sbin/groupadd -r -f ricci >/dev/null 2>&1 +/usr/sbin/useradd -r -M -s /sbin/nologin -g ricci ricci >/dev/null 2>&1 +exit 0 %post -n ricci -/usr/sbin/adduser -r -M -s /sbin/nologin ricci > /dev/null 2>&1 /sbin/chkconfig --add ricci -/bin/chown -R ricci:ricci /var/lib/ricci if [ ! -e /var/lib/ricci/certs/privkey.pem ]; then /usr/bin/openssl genrsa -out /var/lib/ricci/certs/privkey.pem 2048 > /dev/null 2>&1 /usr/bin/openssl req -new -x509 -key /var/lib/ricci/certs/privkey.pem \ -out /var/lib/ricci/certs/cacert.pem -days 1095 -config /var/lib/ricci/certs/cacert.config - /bin/chown ricci:ricci /var/lib/ricci/certs/*.pem + /bin/chown ricci:root /var/lib/ricci/certs/*.pem /bin/chmod 644 /var/lib/ricci/certs/cacert.pem /bin/chmod 600 /var/lib/ricci/certs/privkey.pem fi @@ -185,9 +206,9 @@ if [ "$1" = 0 ]; then /sbin/service ricci stop > /dev/null 2>&1 /sbin/chkconfig --del ricci -# /usr/sbin/userdel ricci fi + %postun -n ricci if [ "$1" -ge "1" ]; then /sbin/service ricci condrestart > /dev/null 2>&1 @@ -216,28 +237,27 @@ %files -n ricci-modcluster %defattr(-,root,root) -#%doc README README.snmpd COPYING REDHAT-MIB REDHAT-CLUSTER-MIB -#%{_libdir}/clumon-snmp/ -#%attr(644,root,root) /usr/share/snmp/mibs/REDHAT-MIB -#%attr(644,root,root) /usr/share/snmp/mibs/REDHAT-CLUSTER-MIB +#%doc README +%config /etc/rc.d/init.d/ricci-modclusterd +%config /etc/oddjobd.conf.d/modcluster_rw.conf %{_sbindir}/ricci-modcluster %{_sbindir}/ricci-modcluster.exe -%attr(644,root,root) /etc/oddjobd.conf.d/modcluster_rw.conf %{_sbindir}/ricci-modclusterd -/etc/init.d/ricci-modclusterd %post -n ricci-modcluster -/sbin/service oddjobd reload > /dev/null 2>&1 /sbin/chkconfig --add ricci-modclusterd +/sbin/service oddjobd reload > /dev/null 2>&1 /sbin/service ricci-modclusterd restart > /dev/null 2>&1 + %preun -n ricci-modcluster if [ "$1" = 0 ]; then /sbin/service ricci-modclusterd stop > /dev/null 2>&1 /sbin/chkconfig --del ricci-modclusterd fi + %postun -n ricci-modcluster if [ "$1" -ge "1" ]; then /sbin/service ricci-modclusterd condrestart > /dev/null 2>&1 @@ -265,16 +285,15 @@ %files -n ricci-modstorage %defattr(-,root,root) -#%doc README README.snmpd COPYING REDHAT-MIB REDHAT-CLUSTER-MIB +#%doc README +%config /etc/oddjobd.conf.d/modstorage_rw.conf %{_sbindir}/ricci-modstorage %{_sbindir}/ricci-modstorage.exe -%attr(644,root,root) /etc/oddjobd.conf.d/modstorage_rw.conf %post -n ricci-modstorage /sbin/service oddjobd reload > /dev/null 2>&1 exit 0 - %preun -n ricci-modstorage %postun -n ricci-modstorage @@ -301,16 +320,15 @@ %files -n ricci-modservice %defattr(-,root,root) -#%doc README README.snmpd COPYING REDHAT-MIB REDHAT-CLUSTER-MIB +#%doc README +%config /etc/oddjobd.conf.d/modservice_rw.conf %{_sbindir}/ricci-modservice %{_sbindir}/ricci-modservice.exe -%attr(644,root,root) /etc/oddjobd.conf.d/modservice_rw.conf %post -n ricci-modservice /sbin/service oddjobd reload > /dev/null 2>&1 exit 0 - %preun -n ricci-modservice %postun -n ricci-modservice @@ -337,10 +355,10 @@ %files -n ricci-modlog %defattr(-,root,root) -#%doc README README.snmpd COPYING REDHAT-MIB REDHAT-CLUSTER-MIB +#%doc README +%config /etc/oddjobd.conf.d/modlog_rw.conf %{_sbindir}/ricci-modlog %{_sbindir}/ricci-modlog.exe -%attr(644,root,root) /etc/oddjobd.conf.d/modlog_rw.conf %post -n ricci-modlog /sbin/service oddjobd reload > /dev/null 2>&1 @@ -357,12 +375,94 @@ +### cluster-snmp ### + + +%package -n cluster-snmp +Group: System Environment/Base +Summary: Red Hat Enterprise Linux Cluster Suite - SNMP agent +Requires: /bin/bash +Requires: net-snmp ricci-modcluster +Requires: oddjob libxml2 openssl +Provides: cluster-snmp +Conflicts: clumon-snmp + +%description -n cluster-snmp +SNMP agent for Red Hat Enterprise Linux Cluster Suite + + +%files -n cluster-snmp +%defattr(-,root,root) +%{_libdir}/cluster-snmp/ +%attr(644,root,root) %{_datadir}/snmp/mibs/REDHAT-MIB +%attr(644,root,root) %{_datadir}/snmp/mibs/REDHAT-CLUSTER-MIB +%{_docdir}/cluster-snmp-%{version}/ + +%pre -n cluster-snmp + +%post -n cluster-snmp +#/sbin/service oddjobd reload > /dev/null 2>&1 +/sbin/service snmpd condrestart > /dev/null 2>&1 +exit 0 + +%preun -n cluster-snmp + +%postun -n cluster-snmp +#/sbin/service oddjobd reload > /dev/null 2>&1 +/sbin/service snmpd condrestart > /dev/null 2>&1 +exit 0 + + + + + +### cluster-cim ### + + +%package -n cluster-cim +Group: System Environment/Base +Summary: Red Hat Enterprise Linux Cluster Suite - CIM provider +Requires: /bin/bash +Requires: tog-pegasus ricci-modcluster +Requires: oddjob libxml2 openssl +Provides: cluster-cim +Conflicts: clumon-cim + +%description -n cluster-cim +CIM provider for Red Hat Enterprise Linux Cluster Suite + + +%files -n cluster-cim +%defattr(-,root,root) +%{PEGASUS_PROVIDERS_DIR}/libRedHatClusterProvider.so +%{_docdir}/cluster-cim-%{version}/ + +%pre -n cluster-cim + +%post -n cluster-cim +#/sbin/service oddjobd reload > /dev/null 2>&1 +/sbin/service tog-pegasus condrestart > /dev/null 2>&1 +exit 0 + +%preun -n cluster-cim + +%postun -n cluster-cim +#/sbin/service oddjobd reload > /dev/null 2>&1 +/sbin/service tog-pegasus condrestart > /dev/null 2>&1 +exit 0 + + + + ### changelog ### %changelog +* Wed Jun 14 2006 Stanko Kupcevic 0.8-1 +- Packaged cluster-snmp (cluster snmp agent) +- Packaged cluster-cim (cluster CIM provider) * Mon Jun 06 2006 Stanko Kupcevic 0.7-5 - Disable non-https access to Luci, enable https on port 8181 * Mon Jun 02 2006 Stanko Kupcevic 0.7-1 /cvs/cluster/conga/luci/autogen.sh,v --> standard output revision 1.1 --- conga/luci/autogen.sh +++ - 2006-06-14 21:44:38.601019000 +0000 @@ -0,0 +1,6 @@ +#!/bin/bash + +# TODO: implement me + + +exit 0 --- conga/luci/Makefile 2006/06/02 00:14:27 1.3 +++ conga/luci/Makefile 2006/06/14 21:44:34 1.4 @@ -1,6 +1,8 @@ -# $Id: Makefile,v 1.3 2006/06/02 00:14:27 kupcevic Exp $ +# $Id: Makefile,v 1.4 2006/06/14 21:44:34 kupcevic Exp $ +all: luci + luci: make -C site @@ -9,6 +11,9 @@ make -C docs +rebuild: clean all + + install: make -C site install make -C utils install @@ -54,7 +59,7 @@ ZOPEHTTP=http://localhost:8080/ ZOPEDIRS=cluster storage homebase -all: tar +all_old: tar tar: --- conga/luci/configure 2006/06/02 00:14:27 1.1 +++ conga/luci/configure 2006/06/14 21:44:34 1.2 @@ -4,6 +4,4 @@ -echo "Run 'make' to compile luci" - exit 0 --- conga/luci/init.d/Makefile 2006/06/02 00:14:28 1.1 +++ conga/luci/init.d/Makefile 2006/06/14 21:44:34 1.2 @@ -5,8 +5,8 @@ install: - install -d ${DESTDIR}/etc/init.d - install luci ${DESTDIR}/etc/init.d + install -d ${DESTDIR}/etc/rc.d/init.d + install luci ${DESTDIR}/etc/rc.d/init.d clean: --- conga/make/version.in 2006/06/06 21:05:43 1.2 +++ conga/make/version.in 2006/06/14 21:44:34 1.3 @@ -1,2 +1,2 @@ -VERSION=0.7 -RELEASE=5.FC5 +VERSION=0.8 +RELEASE=1.FC5 /cvs/cluster/conga/ricci/autogen.sh,v --> standard output revision 1.1 --- conga/ricci/autogen.sh +++ - 2006-06-14 21:44:39.814945000 +0000 @@ -0,0 +1,6 @@ +#!/bin/bash + +# TODO: implement me + + +cp make/defines.mk.in make/defines.mk --- conga/ricci/Makefile 2006/06/02 00:14:29 1.6 +++ conga/ricci/Makefile 2006/06/14 21:44:34 1.7 @@ -10,6 +10,7 @@ #include make/version.in +include make/defines.mk @@ -38,21 +39,10 @@ make -C init.d clean make -C pam.d clean make -C oddjobd.conf.d clean - rm -f ricci.spec.in ricci.spec distclean: clean -# rm -f make/defines.mk + rm -f make/defines.mk check: rebuild: clean all - -#spec: -# sed -e 's/@@VERS@@/${VERSION}/g' ricci.spec.in.in > ricci.spec.in -# sed -e 's/@@REL@@/${RELEASE}/g' ricci.spec.in > ricci.spec - - -#srpm: clean spec -#srpm: -# make -C .. ricci-srpm -# mv ../ricci-${VERSION}-${RELEASE}.src.rpm . --- conga/ricci/configure 2006/05/26 22:17:35 1.2 +++ conga/ricci/configure 2006/06/14 21:44:34 1.3 @@ -1,17 +1,39 @@ #!/bin/bash -# TODO: implement me +# improve me -LIBDIR_SED=\\/usr\\/lib +MAKE_DEFINES=make/defines.mk + + +echo "# generated automaticaly by ./configure" > $MAKE_DEFINES +echo "# modify make/defines.mk.in for permanent changes" >> $MAKE_DEFINES +echo >> $MAKE_DEFINES +cat ../make/version.in >> $MAKE_DEFINES +echo >> $MAKE_DEFINES +echo "# priority: 1. make's params, 2. configure's params, 3. default params" >> $MAKE_DEFINES +echo >> $MAKE_DEFINES +echo >> $MAKE_DEFINES + +echo "# configure's params:" >> make/defines.mk +for arg in $@ +do + var=`echo $arg | sed -e s,^--\\\\\(.*\\\\\)=\\\\\(.*\\\\\),\\\1\ ?=\ \\\2,` + var=`echo $var | sed -e s,?=\ /,?=\ \\${DESTDIR}/,` + echo $var >> $MAKE_DEFINES +done + + + +LIBDIR_SED=\\/lib X86_64_TMP=`uname -a | grep x86_64` if [ "$X86_64_TMP" ]; then - LIBDIR_SED=\\/usr\\/lib64 + LIBDIR_SED=\\/lib64 fi -sed -e "s/@@LIBDIR@@/$LIBDIR_SED/g" make/defines.mk.in > make/defines.mk +sed -e "s,@@LIBDIR@@,$LIBDIR_SED,g" $MAKE_DEFINES.in | sed -e "s,@@ARCH@@,`uname -m`,g" >> $MAKE_DEFINES + -echo "Run 'make' to compile ricci" exit 0 --- conga/ricci/init.d/Makefile 2006/03/13 19:03:31 1.1 +++ conga/ricci/init.d/Makefile 2006/06/14 21:44:34 1.2 @@ -18,8 +18,8 @@ all: install: - install -d ${DESTDIR}/etc/init.d - install ${TARGET} ${DESTDIR}/etc/init.d + install -d ${sysconfdir}/rc.d/init.d + install ${TARGET} ${sysconfdir}/rc.d/init.d uninstall: --- conga/ricci/make/defines.mk.in 2006/05/26 22:17:35 1.1 +++ conga/ricci/make/defines.mk.in 2006/06/14 21:44:36 1.2 @@ -1,8 +1,27 @@ -# TODO: implement and integrate with configure +# default params: +program-prefix ?= +prefix ?= ${DESTDIR}/usr +exec-prefix ?= ${DESTDIR}/usr +bindir ?= ${exec-prefix}/bin +sbindir ?= ${exec-prefix}/sbin +sysconfdir ?= ${DESTDIR}/etc +datadir ?= ${prefix}/share +includedir ?= ${prefix}/include +libdir ?= ${prefix}@@LIBDIR@@ +libexecdir ?= ${prefix}/libexec +localstatedir ?= ${DESTDIR}/var +sharedstatedir ?= ${prefix}/com +mandir ?= ${datadir}/man +infodir ?= ${datadir}/info +docdir ?= ${datadir}/doc +arch ?= @@ARCH@@ +pegasus_providers_dir ?= ${libdir}/Pegasus/providers +#--build=i686-redhat-linux-gnu +#--host=i686-redhat-linux-gnu +#--target=i386-redhat-linux-gnu -sbindir ?= ${DESTDIR}/usr/sbin -LIBDIR=@@LIBDIR@@ -RANLIB=ranlib +RANLIB ?= ranlib + /cvs/cluster/conga/ricci/modules/cluster/clumon/COPYING,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/COPYING +++ - 2006-06-14 21:44:40.278175000 +0000 @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. /cvs/cluster/conga/ricci/modules/cluster/clumon/README,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/README +++ - 2006-06-14 21:44:40.364129000 +0000 @@ -0,0 +1 @@ +Work in progress, everything subject to change, including MIB and CIM schema /cvs/cluster/conga/ricci/modules/cluster/clumon/README.cim,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/README.cim +++ - 2006-06-14 21:44:40.443804000 +0000 @@ -0,0 +1,13 @@ + +To execute following commands, Pegasus CIM server has to be running +and root account has to be used, + +Register Red Hat Cluster provider: +cimmof -n root/PG_InterOp RedHat_ClusterProvider.mof + +Install Red Hat Cluster schema: +cimmof -n root/cimv2 RedHat_ClusterSchema.mof + + +Refer to Pegasus documentation and /usr/share/doc/tog-pegasus for CIM +user management and ACL. /cvs/cluster/conga/ricci/modules/cluster/clumon/README.snmpd,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/README.snmpd +++ - 2006-06-14 21:44:40.528120000 +0000 @@ -0,0 +1,62 @@ + +net-snmp configuration: + +Refer to net-snmp documentation for ACL configuration (/etc/snmp/snmpd.conf is commented as well). +To load cluster MIB's shared library, add following line to /etc/snmpd/snmp.conf +dlmod RedHatCluster /usr/lib/cluster-snmp/libClusterMonitorSnmp.so + + +Sample configurations: + +1. cluster info is accessible from anywhere using "public" community (add the following to default /etc/snmp/snmpd.conf): + +###################################### +## cluster monitoring configuration ## +###################################### + +dlmod RedHatCluster /usr/lib/cluster-snmp/libClusterMonitorSnmp.so +view systemview included REDHAT-CLUSTER-MIB:RedHatCluster + +###################################### +## cluster monitoring done ## +###################################### + + + +2. cluster info is accessible from localhost and 192.168.0.0/16 using "cluster" community: + +###################################### +## cluster monitoring configuration ## +###################################### + +dlmod RedHatCluster /usr/lib/cluster-snmp/libClusterMonitorSnmp.so + +# sec.name source community +com2sec local localhost cluster +com2sec localnet 192.168.0.0/16 cluster + +# groupName securityModel securityName +group clusterGroup v1 local +group clusterGroup v2c local +group clusterGroup v1 localnet +group clusterGroup v2c localnet + +# name incl/excl subtree mask(optional) +view clusterview included REDHAT-CLUSTER-MIB:RedHatCluster + +# group context sec.model sec.level prefix read write notif +access clusterGroup "" any noauth prefix clusterview none none + +###################################### +## cluster monitoring done ## +###################################### + + + +net-snmp client configuration: +Place REDHAT-MIB and REDHAT-CLUSTER-MIB into ~/.snmp/mibs/, and query cluster using: +snmpwalk -v 2c -c COMMUNITY NODENAME REDHAT-CLUSTER-MIB::RedHatCluster +(replace NODENAME with the hostname of one of cluster nodes running software) + + + /cvs/cluster/conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB +++ - 2006-06-14 21:44:40.631225000 +0000 @@ -0,0 +1,380 @@ +REDHAT-CLUSTER-MIB DEFINITIONS ::= BEGIN + + +IMPORTS + RedHat FROM REDHAT-MIB + MODULE-IDENTITY, OBJECT-TYPE, Integer32 FROM SNMPv2-SMI; + + +RedHatCluster MODULE-IDENTITY + LAST-UPDATED "200512060000Z" -- Dec 06 2005, midnight + ORGANIZATION "Red Hat, Inc (www.redhat.com)" + CONTACT-INFO "postal: Red Hat, Inc + 1801 Varsity Drive + Raleigh, North Carolina 27606 + USA + + email: customerservice at redhat.com + " + DESCRIPTION "Red Hat Cluster Suite MIB + " + REVISION "200512060000Z" -- Dec 06 2005, midnight + DESCRIPTION "MIB version 1 + " + ::= { RedHat 8 } + + + +rhcMIBInfo OBJECT IDENTIFIER ::= { RedHatCluster 1 } +rhcCluster OBJECT IDENTIFIER ::= { RedHatCluster 2 } +rhcTables OBJECT IDENTIFIER ::= { RedHatCluster 3 } + + + + +-- ##### MIB info ##### + +rhcMIBVersion OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Version of Red Hat Cluster MIB + " + ::= { rhcMIBInfo 1 } + + + +-- ##### Cluster ##### -- + +rhcClusterName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Cluster name" + ::= { rhcCluster 1 } + + +rhcClusterStatusCode OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Cluster status code. + ORed values: + 1 All services and nodes functional + 2 Some services failed + 4 Some services not running + 8 Some nodes unavailable + 16 Not quorate + 32 Cluster stopped + " + ::= { rhcCluster 2 } + +rhcClusterStatusDesc OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Cluster status description" + ::= { rhcCluster 3 } + + +rhcClusterVotesNeededForQuorum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Minimum number of votes required for quorum. + If cluster is not quorate, all services are stopped." + ::= { rhcCluster 4 } + +rhcClusterVotes OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current number of votes" + ::= { rhcCluster 5 } + +rhcClusterQuorate OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "1 if cluster is quorate, 0 otherwise" + ::= { rhcCluster 6 } + + +rhcClusterNodesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of nodes configured to participate in cluster" + ::= { rhcCluster 7 } + +rhcClusterNodesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of nodes configured to participate in cluster" + ::= { rhcCluster 8 } + +rhcClusterAvailNodesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of nodes currently participating in cluster" + ::= { rhcCluster 9 } + +rhcClusterAvailNodesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of nodes currently participating in cluster" + ::= { rhcCluster 10 } + +rhcClusterUnavailNodesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of nodes currently NOT participating in cluster" + ::= { rhcCluster 11 } + +rhcClusterUnavailNodesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of nodes currently NOT participating in cluster" + ::= { rhcCluster 12 } + + +rhcClusterServicesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of configured services" + ::= { rhcCluster 13 } + +rhcClusterServicesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of configured services" + ::= { rhcCluster 14 } + +rhcClusterRunningServicesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of running services" + ::= { rhcCluster 15 } + +rhcClusterRunningServicesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of running services" + ::= { rhcCluster 16 } + +rhcClusterStoppedServicesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of stopped services" + ::= { rhcCluster 17 } + +rhcClusterStoppedServicesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of stopped services" + ::= { rhcCluster 18 } + +rhcClusterFailedServicesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of failed services" + ::= { rhcCluster 19 } + +rhcClusterFailedServicesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of failed services" + ::= { rhcCluster 20 } + + + +-- ##### nodes ##### -- + + +rhcNodesTable OBJECT-TYPE + SYNTAX SEQUENCE OF RhcNodeEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of cluster nodes" + ::= { rhcTables 1 } + +rhcNodeEntry OBJECT-TYPE + SYNTAX RchNodeEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Cluster node" + INDEX { rhcNodeName } + ::= { rhcNodesTable 1 } + +RhcNodeEntry ::= SEQUENCE { + rhcNodeName OCTET STRING, + rhcNodeStatusCode Integer32, + rhcNodeStatusDesc OCTET STRING, + rhcNodeRunningServicesNum Integer32, + rhcNodeRunningServicesNames OCTET STRING +} + +rhcNodeName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Node name" + ::= { rhcNodeEntry 1 } + + +rhcNodeStatusCode OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Node status code. + Values: + 0 Participating in cluster + 1 Running, but not participating in cluster + 2 Not running + " + ::= { rhcNodeEntry 2 } + +rhcNodeStatusDesc OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Node status description" + ::= { rhcNodeEntry 3 } + + +rhcNodeRunningServicesNum OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of services running on node" + ::= { rhcNodeEntry 4 } + +rhcNodeRunningServicesNames OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Names of services running on node" + ::= { rhcNodeEntry 5 } + + + +-- ##### services ##### -- + + +rhcServicesTable OBJECT-TYPE + SYNTAX SEQUENCE OF RhcServiceEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Table of cluster services" + ::= { rhcTables 2 } + +rhcServiceEntry OBJECT-TYPE + SYNTAX RchServiceEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Cluster service" + INDEX { rhcServiceName } + ::= { rhcServicesTable 1 } + +RhcServiceEntry ::= SEQUENCE { + rhcServiceName OCTET STRING, + rhcServiceStatusCode Integer32, + rhcServiceStatusDesc OCTET STRING, + rhcServiceStartMode OCTET STRING, + rhcServiceRunningOnNode OCTET STRING +} + +rhcServiceName OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Service name" + ::= { rhcServiceEntry 1 } + +rhcServiceStatusCode OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Service status code. + Codes: + 0 running + 1 stopped + 2 failed + " + ::= { rhcServiceEntry 2 } + +rhcServiceStatusDesc OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Dervice status description" + ::= { rhcServiceEntry 3 } + +rhcServiceStartMode OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Service start mode, automatic or manual" + ::= { rhcServiceEntry 4 } + +rhcServiceRunningOnNode OBJECT-TYPE + SYNTAX OCTET STRING + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of node the service runs on" + ::= { rhcServiceEntry 5 } + + + + +END + + /cvs/cluster/conga/ricci/modules/cluster/clumon/REDHAT-MIB,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/REDHAT-MIB +++ - 2006-06-14 21:44:40.760651000 +0000 @@ -0,0 +1,35 @@ +REDHAT-MIB DEFINITIONS ::= BEGIN + + +IMPORTS + enterprises FROM RFC1155-SMI + MODULE-IDENTITY FROM SNMPv2-SMI; + + +RedHat MODULE-IDENTITY + LAST-UPDATED "200512060000Z" -- Dec 06 2005, midnight + ORGANIZATION "Red Hat, Inc (www.redhat.com)" + CONTACT-INFO "postal: Red Hat, Inc + 1801 Varsity Drive + Raleigh, North Carolina 27606 + USA + + email: customerservice at redhat.com + " + DESCRIPTION "Red Hat, Inc MIB + " + REVISION "200512060000Z" -- Dec 06 2005, midnight + DESCRIPTION "Initial version. + " + ::= { enterprises 2312 } + + + +-- 4 Red Hat OS Development +-- 5 Red Hat IS/IT +-- 6 Red Hat Directory Server +-- 7 Red Hat Network +-- 8 Red Hat Cluster Suite + + +END /cvs/cluster/conga/ricci/modules/cluster/clumon/RedHat_ClusterProvider.mof,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/RedHat_ClusterProvider.mof +++ - 2006-06-14 21:44:40.889311000 +0000 @@ -0,0 +1,92 @@ +instance of PG_ProviderModule +{ + Description = "RedHat Cluster Suite Provider Module"; + Name = "RedHatClusterProviderModule"; + Vendor = "RedHat"; + Version = "0.0.1"; + InterfaceType = "C++Default"; + InterfaceVersion = "2.1.0"; + Location = "RedHatClusterProvider"; +}; + +instance of PG_Provider +{ + Name = "RedHatClusterProvider"; + ProviderModuleName = "RedHatClusterProviderModule"; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "1"; + ClassName = "RedHat_Cluster"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Association + SupportedProperties = NULL; + SupportedMethods = NULL; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "2"; + ClassName = "RedHat_ClusterNode"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Association + SupportedProperties = NULL; + SupportedMethods = NULL; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "3"; + ClassName = "RedHat_ClusterParticipatingNode"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance + SupportedProperties = NULL; + SupportedMethods = NULL; +}; + + + + + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "4"; + ClassName = "RedHat_ClusterFailoverService"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance, Association + SupportedProperties = NULL; + SupportedMethods = NULL; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "5"; + ClassName = "RedHat_ClusterHostingFailoverService"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance + SupportedProperties = NULL; + SupportedMethods = NULL; +}; + +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "RedHatClusterProviderModule"; + ProviderName = "RedHatClusterProvider"; + CapabilityID = "6"; + ClassName = "RedHat_ClusterNodeHostingFailoverService"; + Namespaces = {"root/cimv2"}; + ProviderType = { 2, 3 }; // Instance + SupportedProperties = NULL; + SupportedMethods = NULL; +}; /cvs/cluster/conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/RedHat_ClusterSchema.mof +++ - 2006-06-14 21:44:41.023401000 +0000 @@ -0,0 +1,129 @@ + +[ Description ("RedHat Cluster. \nServices are accessible thru RedHat_ClusterHostingFailoverService.\nNodes are accessible thru RedHat_ClusterParticipatingNode.\nIf RequiredQuorum is not fulfilled, all services are stoped and Status is set to Degraded.\nIf some services have failed, Status is set to Stressed."), + Version("0.0.2") ] +class RedHat_Cluster : CIM_Cluster +{ + [ Description("Number of available nodes' votes.") ] + uint16 Votes; + + [ Description("Minimum quorum required for cluster to be operational.") ] + uint16 VotesNeededForQuorum; + + + [ Description("Number of nodes.") ] + uint16 NodesNumber; + + [ Description("Number of available nodes.") ] + uint16 AvailableNodesNumber; + + [ Description("Number of unavailable nodes.") ] + uint16 UnavailableNodesNumber; + + [ Description("Node Names.") ] + string NodesNames[]; + + [ Description("Available Nodes.") ] + string AvailableNodesNames[]; + + [ Description("Unavailable Nodes.") ] + string UnavailableNodesNames[]; + + + [ Description("Number of services.") ] + uint16 ServicesNumber; + + [ Description("Number of running services.") ] + uint16 RunningServicesNumber; + + [ Description("Number of stopped services.") ] + uint16 StoppedServicesNumber; + + [ Description("Number of failed services.") ] + uint16 FailedServicesNumber; + + [ Description("Names of running services.") ] + string ServicesNames[]; + + [ Description("Names of running services.") ] + string RunningServicesNames[]; + + [ Description("Names of stopped services.") ] + string StoppedServicesNames[]; + + [ Description("Names of failed services.") ] + string FailedServicesNames[]; +}; + + +[ Description("Cluster Node"), + Version("0.0.2") ] +class RedHat_ClusterNode : CIM_ComputerSystem +{ + [ Key, Description("Name of cluster this node participates in.") ] + string ClusterName; + + [ Description("Number of services running on this node") ] + uint16 RunningServicesNumber; + + [ Description("Services running on this node") ] + string RunningServicesNames[]; +}; + + +[ Description("Cluster Failover Service"), Version("0.0.1") ] +class RedHat_ClusterFailoverService : CIM_ClusteringService +{ + [ Description("Node service runs on") ] + string NodeName; + + [ Description("Cluster Name") ] + string ClusterName; +}; + + + + + + + +// ### Associations ### + + +/* +[ Association, + Description("Links cluster to cluster nodes."), Version("0.0.1") ] +class RedHat_ClusterParticipatingNode : CIM_ParticipatingCS +{ + [ Override("Antecedent") ] + RedHat_ClusterNode REF Antecedent; + + [ Description("Number of node's votes participating in cluster quorum.") ] + uint16 QuorumVotes; +}; +*/ + +/* +[ Association, + Description("Defines hosting cluster for cluster service.") ] +class RedHat_ClusterHostingFailoverService : CIM_HostedClusterService +{ + [ Override("Antecedent") ] + RedHat_Cluster REF Antecedent; + + [ Override("Dependent") ] + RedHat_ClusterFailoverService REF Dependent; +}; +*/ + +/* +[ Association, + Description("Defines cluster node on which the cluster service is currently executing.") ] +class RedHat_ClusterNodeHostingFailoverService : CIM_HostedService +{ + [ Override("Antecedent") ] + RedHat_ClusterNode REF Antecedent; + + [ Override("Dependent") ] + RedHat_ClusterFailoverService REF Dependent; +}; +*/ --- conga/ricci/modules/cluster/clumon/Makefile 2006/03/27 23:15:30 1.1 +++ conga/ricci/modules/cluster/clumon/Makefile 2006/06/14 21:44:36 1.2 @@ -25,10 +25,24 @@ install: cd src && ${MAKE} install cd init.d && ${MAKE} install -# cd man && ${MAKE} install -# install -d ${DESTDIR}/usr/share/snmp/mibs -# install REDHAT-MIB ${DESTDIR}/usr/share/snmp/mibs/ -# install REDHAT-CLUSTER-MIB ${DESTDIR}/usr/share/snmp/mibs/ + cd man && ${MAKE} install +# snmp + install -d ${datadir}/snmp/mibs + install REDHAT-MIB ${datadir}/snmp/mibs/ + install REDHAT-CLUSTER-MIB ${datadir}/snmp/mibs/ + install -d ${docdir}/cluster-snmp-${VERSION} + install README ${docdir}/cluster-snmp-${VERSION}/ + install README.snmpd ${docdir}/cluster-snmp-${VERSION}/ + install COPYING ${docdir}/cluster-snmp-${VERSION}/ + install REDHAT-MIB ${docdir}/cluster-snmp-${VERSION}/ + install REDHAT-CLUSTER-MIB ${docdir}/cluster-snmp-${VERSION}/ +# cim + install -d ${docdir}/cluster-cim-${VERSION} + install README ${docdir}/cluster-cim-${VERSION}/ + install README.cim ${docdir}/cluster-cim-${VERSION}/ + install RedHat_ClusterProvider.mof ${docdir}/cluster-cim-${VERSION}/ + install RedHat_ClusterSchema.mof ${docdir}/cluster-cim-${VERSION}/ + uninstall: cd src && ${MAKE} uninstall --- conga/ricci/modules/cluster/clumon/init.d/Makefile 2006/03/28 15:46:57 1.2 +++ conga/ricci/modules/cluster/clumon/init.d/Makefile 2006/06/14 21:44:36 1.3 @@ -19,8 +19,8 @@ clean: install: - install -d ${DESTDIR}/etc/init.d - install ${TARGET} ${DESTDIR}/etc/init.d + install -d ${sysconfdir}/rc.d/init.d + install ${TARGET} ${sysconfdir}/rc.d/init.d uninstall: ${UNINSTALL} ${TARGET} ${DESTDIR}/etc/init.d --- conga/ricci/modules/cluster/clumon/src/Makefile 2006/03/27 23:15:30 1.1 +++ conga/ricci/modules/cluster/clumon/src/Makefile 2006/06/14 21:44:36 1.2 @@ -14,14 +14,14 @@ all: cd common && ${MAKE} all cd daemon && ${MAKE} all -# cd snmp-agent && ${MAKE} all -# cd cim-provider && ${MAKE} all + cd snmp-agent && ${MAKE} all + cd cim-provider && ${MAKE} all clean: cd common && ${MAKE} clean cd daemon && ${MAKE} clean -# cd snmp-agent && ${MAKE} clean -# cd cim-provider && ${MAKE} clean + cd snmp-agent && ${MAKE} clean + cd cim-provider && ${MAKE} clean check: cd common && ${MAKE} check @@ -34,8 +34,8 @@ install: cd common && ${MAKE} install cd daemon && ${MAKE} install -# cd snmp-agent && ${MAKE} install -# cd cim-provider && ${MAKE} install + cd snmp-agent && ${MAKE} install + cd cim-provider && ${MAKE} install uninstall: cd common && ${MAKE} uninstall /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.cpp +++ - 2006-06-14 21:44:41.460315000 +0000 @@ -0,0 +1,1222 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#include "ClusterProvider.h" +#include "SmartHandler.h" +#include "Cluster.h" +#include "Logger.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + + +using namespace std; +using namespace Pegasus; +using namespace ClusterMonitoring; + + +static CIMInstance +buildClusterInstance(counting_auto_ptr& cluster, Boolean qual, Boolean orig); +static CIMInstance +buildNodeInstance(counting_auto_ptr& node, Boolean qual, Boolean orig); +static CIMInstance +buildServiceInstance(counting_auto_ptr& service, Boolean qual, Boolean orig); + + +static CIMObjectPath +buildClusterInstancePath(counting_auto_ptr& cluster, const CIMNamespaceName& nameSpace); +static CIMObjectPath +buildNodeInstancePath(counting_auto_ptr& node, const CIMNamespaceName& nameSpace); +static CIMObjectPath +buildServiceInstancePath(counting_auto_ptr& service, const CIMNamespaceName& nameSpace); + + +static String +hostname(void); + + +ClusterProvider::ClusterProvider(void) throw() +{ + //set_logger(counting_auto_ptr(Logger(LOG_FILE, "ClusterProvider", LogBasic))); + log("ClusterProvider Created"); +} + +ClusterProvider::~ClusterProvider(void) throw() +{ + set_logger(counting_auto_ptr(new Logger())); +} + + +// CIMProvider interface +void +ClusterProvider::initialize (CIMOMHandle& cimom) +{ + log("ClusterProvider::initialize called"); +} + +void +ClusterProvider::terminate (void) +{ + log("ClusterProvider::terminate called"); + delete this; +} + + +// CIMInstanceProvider interface +void +ClusterProvider::getInstance(const OperationContext &context, + const CIMObjectPath &ref, + const Boolean includeQualifiers, + const Boolean includeClassOrigin, + const CIMPropertyList &propertyList, + InstanceResponseHandler &handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + CIMName className(ref.getClassName()); + + log("getInstance(... " + className.getString() + " ...) called"); + + if(className.equal(CLUSTER_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + CIMObjectPath path = buildClusterInstancePath(cluster, + ref.getNameSpace()); + if(path.identical(ref)) + { + CIMInstance inst = buildClusterInstance(cluster, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + } + else if(className.equal(CLUSTER_NODE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > nodes = cluster->nodes(); + for(list >::iterator iter = nodes.begin(); + iter != nodes.end(); + iter++) + { + CIMObjectPath path = buildNodeInstancePath(*iter, + ref.getNameSpace()); + if(path.identical(ref)) + { + CIMInstance inst = buildNodeInstance(*iter, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + } + } + else if(className.equal(CLUSTER_SERVICE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > services = cluster->services(); + for(list >::iterator iter = services.begin(); + iter != services.end(); + iter++) + { + CIMObjectPath path = buildServiceInstancePath(*iter, + ref.getNameSpace()); + if(path.identical(ref)) + { + CIMInstance inst = buildServiceInstance(*iter, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + } + } + else + throw CIMInvalidParameterException(ref.toString()); +} + +void +ClusterProvider::enumerateInstances(const OperationContext &context, + const CIMObjectPath &ref, + const Boolean includeQualifiers, + const Boolean includeClassOrigin, + const CIMPropertyList &propertyList, + InstanceResponseHandler &handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + CIMName className(ref.getClassName()); + + log("enumerateInstances(... " + className.getString() + " ...) called"); + + if(className.equal(CLUSTER_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + CIMInstance inst = buildClusterInstance(cluster, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + else if(className.equal(CLUSTER_NODE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > nodes = cluster->nodes(); + for(list >::iterator iter = nodes.begin(); + iter != nodes.end(); + iter++) + { + CIMInstance inst = buildNodeInstance(*iter, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + } + else if(className.equal(CLUSTER_SERVICE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > services = cluster->services(); + for(list >::iterator iter = services.begin(); + iter != services.end(); + iter++) + { + CIMInstance inst = buildServiceInstance(*iter, + includeQualifiers, + includeClassOrigin); + handler.deliver(inst); + } + } + else + throw CIMInvalidParameterException(ref.toString()); +} + +void +ClusterProvider::enumerateInstanceNames(const OperationContext &context, + const CIMObjectPath &classRef, + ObjectPathResponseHandler &handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + CIMName className(classRef.getClassName()); + + log("enumerateInstanceNames(... " + className.getString() + " ...) called"); + + if(className.equal(CLUSTER_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + CIMObjectPath path = buildClusterInstancePath(cluster, + classRef.getNameSpace()); + handler.deliver(path); + } + else if(className.equal(CLUSTER_NODE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > nodes = cluster->nodes(); + for(list >::iterator iter = nodes.begin(); + iter != nodes.end(); + iter++) + { + CIMObjectPath path = buildNodeInstancePath(*iter, + classRef.getNameSpace()); + handler.deliver(path); + } + } + else if(className.equal(CLUSTER_SERVICE_CLASSNAME)) + { + if(cluster.get() == NULL) + return; + list > services = cluster->services(); + for(list >::iterator iter = services.begin(); + iter != services.end(); + iter++) + { + CIMObjectPath path = buildServiceInstancePath(*iter, + classRef.getNameSpace()); + handler.deliver(path); + } + } + else + throw CIMInvalidParameterException(classRef.toString()); +} + + +void +ClusterProvider::createInstance(const OperationContext &context, + const CIMObjectPath &ref, + const CIMInstance &obj, + ObjectPathResponseHandler &handler) +{ + throw CIMNotSupportedException(CLUSTER_PROVIDER_CLASSNAME + "::createInstance"); +} + +void +ClusterProvider::modifyInstance(const OperationContext &context, + const CIMObjectPath &ref, + const CIMInstance &obj, + const Boolean includeQualifiers, + const CIMPropertyList &propertyList, + ResponseHandler &handler) +{ + throw CIMNotSupportedException(CLUSTER_PROVIDER_CLASSNAME + "::modifyInstance"); +} + +void +ClusterProvider::deleteInstance(const OperationContext &context, + const CIMObjectPath &ref, + ResponseHandler &handler) +{ + throw CIMNotSupportedException(CLUSTER_PROVIDER_CLASSNAME + "::deleteInstance"); +} + + + + +// private + +void +ClusterProvider::log(const String& str) +{ + ::log((const char*) str.getCString()); +} + + + + + + +CIMInstance +buildClusterInstance(counting_auto_ptr& cluster, Boolean qual, Boolean orig) +{ + CIMInstance inst(CIMName(CLUSTER_CLASSNAME)); + + // Name + inst.addProperty(CIMProperty( + CIMName("Name"), + CIMValue(String(cluster->name().c_str())))); + + // Caption + //inst.addProperty(CIMProperty( + // CIMName("Caption"), + // CIMValue(String(cluster.name.c_str())))); + // Description + //inst.addProperty(CIMProperty( + // CIMName("Description"), + // CIMValue(String(cluster.name.c_str())))); + + // *** Votes *** + + inst.addProperty(CIMProperty( + CIMName("Votes"), + CIMValue(Uint16(cluster->votes())))); + inst.addProperty(CIMProperty( + CIMName("VotesNeededForQuorum"), + CIMValue(Uint16(cluster->minQuorum())))); + + + // *** Nodes *** + + list > nodes = cluster->nodes(); + Array names; + Array namesA; + Array namesU; + for(list >::iterator iterN = nodes.begin(); + iterN != nodes.end(); + iterN++) + { + counting_auto_ptr& node = *iterN; + String name(node->name().c_str()); + names.append(name); + if(node->clustered()) + namesA.append(name); + else + namesU.append(name); + } + inst.addProperty(CIMProperty( + CIMName("MaxNumberOfNodes"), + CIMValue(Uint32(0)))); // unlimited + inst.addProperty(CIMProperty( + CIMName("NodesNumber"), + CIMValue(Uint16(nodes.size())))); + inst.addProperty(CIMProperty( + CIMName("AvailableNodesNumber"), + CIMValue(Uint16(cluster->clusteredNodes().size())))); + inst.addProperty(CIMProperty( + CIMName("UnavailableNodesNumber"), + CIMValue(Uint16(cluster->unclusteredNodes().size())))); + inst.addProperty(CIMProperty( + CIMName("NodesNames"), + CIMValue(names))); + inst.addProperty(CIMProperty( + CIMName("AvailableNodesNames"), + CIMValue(namesA))); + inst.addProperty(CIMProperty( + CIMName("UnavailableNodesNames"), + CIMValue(namesU))); + + // *** services *** + + list > services = cluster->services(); + names.clear(); + Array namesR; + Array namesF; + Array namesS; + for(list >::iterator iterS = services.begin(); + iterS != services.end(); + iterS++) + { + counting_auto_ptr& service = *iterS; + String name(service->name().c_str()); + names.append(name); + if(service->running()) + namesR.append(name); + else + namesS.append(name); + if(service->failed()) + namesF.append(name); + } + inst.addProperty(CIMProperty( + CIMName("ServicesNumber"), + CIMValue(Uint16(cluster->services().size())))); + inst.addProperty(CIMProperty( + CIMName("RunningServicesNumber"), + CIMValue(Uint16(cluster->runningServices().size())))); + inst.addProperty(CIMProperty( + CIMName("StoppedServicesNumber"), + CIMValue(Uint16(cluster->stoppedServices().size())))); + inst.addProperty(CIMProperty( + CIMName("FailedServicesNumber"), + CIMValue(Uint16(cluster->failedServices().size())))); + inst.addProperty(CIMProperty( + CIMName("ServicesNames"), + CIMValue(names))); + inst.addProperty(CIMProperty( + CIMName("RunningServicesNames"), + CIMValue(namesR))); + inst.addProperty(CIMProperty( + CIMName("StoppedServicesNames"), + CIMValue(namesS))); + inst.addProperty(CIMProperty( + CIMName("FailedServicesNames"), + CIMValue(namesF))); + + + // *** status begin *** + + bool online = cluster->clusteredNodes().size() > 0; + bool failedServices = cluster->failedServices().size() != 0; + bool stoppedServices = cluster->stoppedServices().size() != 0; + bool unclusteredNodes = cluster->unclusteredNodes().size() != 0; + bool quorate = cluster->quorate(); + Array Ostatus; // OperationalStatus + Array statusD; // StatusDescription + if(online) + { + if(quorate) + { + if(!unclusteredNodes && !failedServices && !stoppedServices) + { + // OK + Ostatus.append(2); + statusD.append("All services and nodes functional"); + } + else + { + if(failedServices) + { + // Error + Ostatus.append(6); + statusD.append("Some services failed"); + } + if(stoppedServices) + { + // Stressed + Ostatus.append(4); + statusD.append("Some services not running"); + } + if(unclusteredNodes) + { + // Stressed + Ostatus.append(4); + statusD.append("Some nodes unavailable"); + } + } + } + else + { + // Degraded + Ostatus.append(3); + statusD.append("All services stopped, not quorate"); + } + } + else + { + // Stopped + Ostatus.append(10); + statusD.append("Cluster stopped"); + } + + //inst.addProperty(CIMProperty( + // CIMName("Status"), + // CIMValue(status))); + inst.addProperty(CIMProperty( + CIMName("OperationalStatus"), + CIMValue(Ostatus))); + inst.addProperty(CIMProperty( + CIMName("StatusDescriptions"), + CIMValue(statusD))); + + CIMValue clusterState; + if(online) + clusterState = CIMValue(Uint16(2)); // online + else + clusterState = CIMValue(Uint16(3)); // offline + inst.addProperty(CIMProperty( + CIMName("ClusterState"), + clusterState)); + + // *** status done *** + + + // Types + Array types; + types.append(2); // failover + inst.addProperty(CIMProperty( + CIMName("Types"), + CIMValue(types))); + + + // CreationClassName + inst.addProperty(CIMProperty( + CIMName("CreationClassName"), + CIMValue(String(CLUSTER_CLASSNAME)))); + + // ResetCapability + //inst.addProperty(CIMProperty( + // CIMName("ResetCapability"), + // CIMValue(Uint16(5)))); // not implemented - cluster :) + // PowerManagementCapabilities + + // ElementName + // InstallDate + + // EnabledState + // OtherEnabledState + // EnabledDefault + + // RequestedState + // TimeOfLastStateChange + + // Roles + + // NameFormat + + // PrimaryOwnerContact + // PrimaryOwnerName + // OtherIdentifingInfo + // IdentifyingDescription + + // Dedicated + // OtherDedicatedDescription + + + // Interconnect + // InterconnectAddress + + return inst; +} + +CIMInstance +buildNodeInstance(counting_auto_ptr& node, Boolean qual, Boolean orig) +{ + CIMInstance inst(CIMName(CLUSTER_NODE_CLASSNAME)); + /* + [ Key, Description("Name of cluster this node participates in.") ] + string ClusterName; + + [ Description("Number of services running on this node") ] + uint16 RunningServicesNumber; + + [ Description("Services running on this node") ] + uint16 RunningServicesNames; + */ + + // ClusterName + inst.addProperty(CIMProperty( + CIMName("ClusterName"), + CIMValue(String(node->clustername().c_str())))); + + // Name + inst.addProperty(CIMProperty( + CIMName("Name"), + CIMValue(String(node->name().c_str())))); + + // Caption + //inst.addProperty(CIMProperty( + // CIMName("Caption"), + // CIMValue(String(cluster.name.c_str())))); + // Description + //inst.addProperty(CIMProperty( + // CIMName("Description"), + // CIMValue(String(cluster.name.c_str())))); + + + // *** Votes *** + + inst.addProperty(CIMProperty( + CIMName("Votes"), + CIMValue(Uint16(node->votes())))); + + // *** services *** + + list > services = node->services(); + Array names; + for(list >::iterator iter = services.begin(); + iter != services.end(); + iter++) + { + String name((*iter)->name().c_str()); + names.append(name); + } + inst.addProperty(CIMProperty( + CIMName("RunningServicesNumber"), + CIMValue(Uint16(node->services().size())))); + inst.addProperty(CIMProperty( + CIMName("RunningServicesNames"), + CIMValue(names))); + + + // *** status begin *** + + Array Ostatus; // OperationalStatus + Array statusD; // StatusDescription + if(node->online() && node->clustered()) + { + // OK + Ostatus.append(2); + statusD.append("Node available to cluster"); + } + else if(node->online()) + { + // Error + Ostatus.append(6); + statusD.append("Node running, but unavailable to cluster"); + } + else + { + // Stopped + Ostatus.append(10); + statusD.append("Node not running"); + } + + //inst.addProperty(CIMProperty( + // CIMName("Status"), + // CIMValue(status))); + inst.addProperty(CIMProperty( + CIMName("OperationalStatus"), + CIMValue(Ostatus))); + inst.addProperty(CIMProperty( + CIMName("StatusDescriptions"), + CIMValue(statusD))); + + + // CreationClassName + inst.addProperty(CIMProperty( + CIMName("CreationClassName"), + CIMValue(String(CLUSTER_NODE_CLASSNAME)))); + + // ResetCapability + //inst.addProperty(CIMProperty( + // CIMName("ResetCapability"), + // CIMValue(Uint16(5)))); // not implemented - cluster :) + // PowerManagementCapabilities + + // ElementName + // InstallDate + + // EnabledState + // OtherEnabledState + // EnabledDefault + + // RequestedState + // TimeOfLastStateChange + + // Roles + + // NameFormat + + // PrimaryOwnerContact + // PrimaryOwnerName + // OtherIdentifingInfo + // IdentifyingDescription + + // Dedicated + // OtherDedicatedDescription + + return inst; +} + +CIMInstance +buildServiceInstance(counting_auto_ptr& service, Boolean qual, Boolean orig) +{ + CIMInstance inst(CIMName(CLUSTER_SERVICE_CLASSNAME)); + + // Name + inst.addProperty(CIMProperty( + CIMName("Name"), + CIMValue(String(service->name().c_str())))); + + // Caption + //inst.addProperty(CIMProperty( + // CIMName("Caption"), + // CIMValue(String(cluster.name.c_str())))); + // Description + //inst.addProperty(CIMProperty( + // CIMName("Description"), + // CIMValue(String(cluster.name.c_str())))); + + // ClusterName + inst.addProperty(CIMProperty( + CIMName("ClusterName"), + CIMValue(String(service->clustername().c_str())))); + + // Started + inst.addProperty(CIMProperty( + CIMName("Started"), + CIMValue(service->running()))); + // StartMode + String autostart; + if(service->autostart()) + autostart = "Automatic"; + else + autostart = "Manual"; + inst.addProperty(CIMProperty( + CIMName("StartMode"), + CIMValue(autostart))); + + // NodeName + if(service->running()) + { + String nodeName = String(service->nodename().c_str()); + inst.addProperty(CIMProperty( + CIMName("NodeName"), + CIMValue(nodeName))); + } + + // *** status begin *** + + Array Ostatus; // OperationalStatus + Array statusD; // StatusDescription + if(service->failed()) + { + // Error + Ostatus.append(6); + statusD.append("Failed"); + } + else if(!service->running()) + { + // Stopped + Ostatus.append(10); + statusD.append("Stopped"); + } + else + { + // OK + Ostatus.append(2); + statusD.append("Running"); + } + //inst.addProperty(CIMProperty( + // CIMName("Status"), + // CIMValue(status))); + inst.addProperty(CIMProperty( + CIMName("OperationalStatus"), + CIMValue(Ostatus))); + inst.addProperty(CIMProperty( + CIMName("StatusDescriptions"), + CIMValue(statusD))); + // *** status done *** + + // CreationClassName + inst.addProperty(CIMProperty( + CIMName("CreationClassName"), + CIMValue(String(CLUSTER_SERVICE_CLASSNAME)))); + + // SystemCreationClassName + inst.addProperty(CIMProperty( + CIMName("SystemCreationClassName"), + CIMValue(String(CLUSTER_CLASSNAME)))); + + // SystemName + inst.addProperty(CIMProperty( + CIMName("SystemName"), + CIMValue(String(service->clustername().c_str())))); + + + // ElementName + // InstallDate + + // EnabledState + // OtherEnabledState + // EnabledDefault + + // RequestedState + // TimeOfLastStateChange + + // PrimaryOwnerContact + // PrimaryOwnerName + // OtherIdentifingInfo + // IdentifyingDescription + + return inst; +} + + + + +CIMObjectPath +buildClusterInstancePath(counting_auto_ptr& cluster, + const CIMNamespaceName& nameSpace) +{ + Array keys; + keys.append(CIMKeyBinding("CreationClassName", + String(CLUSTER_CLASSNAME), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("Name", + String(cluster->name().c_str()), + CIMKeyBinding::STRING)); + return CIMObjectPath(hostname(), nameSpace, CLUSTER_CLASSNAME, keys); +} + +CIMObjectPath +buildNodeInstancePath(counting_auto_ptr& node, + const CIMNamespaceName& nameSpace) +{ + Array keys; + keys.append(CIMKeyBinding("CreationClassName", + String(CLUSTER_NODE_CLASSNAME), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("Name", + String(node->name().c_str()), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("ClusterName", + String(node->clustername().c_str()), + CIMKeyBinding::STRING)); + return CIMObjectPath(hostname(), nameSpace, CLUSTER_NODE_CLASSNAME, keys); +} + +CIMObjectPath +buildServiceInstancePath(counting_auto_ptr& service, + const CIMNamespaceName& nameSpace) +{ + Array keys; + keys.append(CIMKeyBinding("CreationClassName", + String(CLUSTER_SERVICE_CLASSNAME), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("Name", + String(service->name().c_str()), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("SystemCreationClassName", + String(CLUSTER_CLASSNAME), + CIMKeyBinding::STRING)); + keys.append(CIMKeyBinding("SystemName", + String(service->clustername().c_str()), + CIMKeyBinding::STRING)); + return CIMObjectPath(hostname(), nameSpace, CLUSTER_SERVICE_CLASSNAME, keys); +} + + +String +hostname() +{ + String hostname; + struct utsname uts; + + if (uname(&uts) == 0) + hostname = uts.nodename; + else + hostname = "unknown"; + + return hostname; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* + ### Implement later ### + + + + +class Association +{ +public: + Association(CIMInstance assoc, CIMObjectPath assocPath, + CIMInstance ante, CIMObjectPath antePath, + CIMInstance dep, CIMObjectPath depPath) : + assoc(assoc), assocPath(assocPath), + ante(ante), antePath(antePath), + dep(dep), depPath(depPath) {} + + CIMInstance assoc; + CIMObjectPath assocPath; + CIMInstance ante; + CIMObjectPath antePath; + CIMInstance dep; + CIMObjectPath depPath; +}; + +vector +buildAssociations(Cluster& cluster, + const CIMNamespaceName& nameSpace, + Boolean quals, + Boolean orig); + + + +static CIMInstance +buildClusterParticipatingNodeInstance(Cluster& cluster, + Node& node, + const CIMNamespaceName& nameSpace, + Boolean qual, + Boolean orig); +static CIMObjectPath +buildClusterParticipatingNodeInstancePath(Cluster& cluster, + Node& node, + const CIMNamespaceName& nameSpace); + + + +// CIMAssociationProvider interface +void +ClusterProvider::associatorNames(const OperationContext& context, + const CIMObjectPath& objectName, + const CIMName& associationClass, + const CIMName& resultClass, + const String& role, + const String& resultRole, + ObjectPathResponseHandler& handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + log("associatorNames(" + objectName.toString() + ", " + + associationClass.getString() + ", " + + resultClass.getString() + ", " + + role + ", " + + resultRole + ", ...) called"); + return; + +} + +void +ClusterProvider::associators(const OperationContext& context, + const CIMObjectPath& objectName, + const CIMName& associationClass, + const CIMName& resultClass, + const String& role, + const String& resultRole, + const Boolean includeQualifiers, + const Boolean includeClassOrigin, + const CIMPropertyList& propertyList, + ObjectResponseHandler& handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + log("associatorNames(" + objectName.toString() + ", " + + associationClass.getString() + ", " + + resultClass.getString() + ", " + + role + ", " + + resultRole + ", ...) called"); + return; + +} + +void +ClusterProvider::referenceNames(const OperationContext& context, + const CIMObjectPath& objectName, + const CIMName& resultClass, + const String& role, + ObjectPathResponseHandler& handler) +{ + counting_auto_ptr cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + CIMName className(objectName.toString()); + + log("referenceNames(" + objectName.toString() + ", " + + resultClass.getString() + ", " + + role + ", ...) called"); + return; + + + if(! className.equal(CLUSTER_CLASSNAME) || + ! className.equal(CLUSTER_NODE_CLASSNAME) || + ! className.equal(CLUSTER_SERVICE_CLASSNAME)) + throw CIMInvalidParameterException(className.getString()); + if(role.size()!=0 && + !role.equalNoCase(role, "Dependent") && + !role.equalNoCase(role, "Antecedent")) + throw CIMInvalidParameterException(className.getString()); + + + if(cluster.get() == NULL) + return; + + vector assocs = buildAssociations(*cluster, + objectName.getNameSpace(), + false, + false); + + for(unsigned int i=0; i cluster = _monitor.get_cluster(); + + SmartHandler t(handler); + + CIMName className(objectName.toString()); + + log("references(" + objectName.toString() + ", " + + resultClass.getString() + ", " + + role + ", ...) called"); + return; + + + if(! className.equal(CLUSTER_CLASSNAME) || + ! className.equal(CLUSTER_NODE_CLASSNAME) || + ! className.equal(CLUSTER_SERVICE_CLASSNAME)) + throw CIMInvalidParameterException(className.getString()); + if(role.size()!=0 && + !role.equalNoCase(role, "Dependent") && + !role.equalNoCase(role, "Antecedent")) + throw CIMInvalidParameterException(className.getString()); + + if(cluster.get() == NULL) + return; + + + vector assocs = buildAssociations(*cluster, + objectName.getNameSpace(), + includeQualifiers, + includeClassOrigin); + + for(unsigned int i=0; i keys; + keys.append(CIMKeyBinding("Dependent", + String(buildClusterInstancePath(cluster, nameSpace).toString()), + CIMKeyBinding::REFERENCE)); + keys.append(CIMKeyBinding("Antecedent", + String(buildNodeInstancePath(node, nameSpace).toString()), + CIMKeyBinding::REFERENCE)); + return CIMObjectPath(hostname(), nameSpace, CLUSTER_PARTICIPATING_NODE_CLASSNAME, keys); +} + +vector +buildAssociations(Cluster& cluster, + const CIMNamespaceName& nameSpace, + Boolean quals, + Boolean orig) +{ + vector assocs; + + // cluster - node + list::iterator iter = cluster.getNodes().begin(); + for( ; iter != cluster.getNodes().end(); iter++) + { + // association + CIMInstance inst = buildClusterParticipatingNodeInstance(cluster, + *iter, + nameSpace, + quals, + orig); + CIMObjectPath instPath = buildClusterParticipatingNodeInstancePath(cluster, + *iter, + nameSpace); + // ante + CIMInstance ante = buildNodeInstance(*iter, + quals, + orig); + CIMObjectPath antePath = buildNodeInstancePath(*iter, + nameSpace); + // dep + CIMInstance dep = buildClusterInstance(cluster, + quals, + orig); + CIMObjectPath depPath = buildClusterInstancePath(cluster, + nameSpace); + + Association assoc(inst, instPath, + ante, antePath, + dep, depPath); + + assocs.push_back(assoc); + } + + // cluster - service + + + // node - service + + + + return assocs; +} +*/ /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProvider.h +++ - 2006-06-14 21:44:41.548757000 +0000 @@ -0,0 +1,144 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#ifndef ClusterProvider_h +#define ClusterProvider_h + +#include +#include +#include + +#include "Cluster.h" +#include "ClusterMonitor.h" + + +namespace ClusterMonitoring +{ + + +#define CLUSTER_PROVIDER_CLASSNAME Pegasus::String("RedHatClusterProvider") +#define CLUSTER_SERVICE_CLASSNAME "RedHat_ClusterFailoverService" +#define CLUSTER_NODE_CLASSNAME "RedHat_ClusterNode" +#define CLUSTER_CLASSNAME "RedHat_Cluster" +//#define CLUSTER_PARTICIPATING_NODE_CLASSNAME "RedHat_ClusterParticipatingNode" +//#define CLUSTER_HOSTING_FAILOVER_SERVICE_CLASSNAME "RedHat_ClusterHostingFailoverService" +//#define CLUSTER_NODE_HOSTING_FAILOVER_SERVICE_CLASSNAME "RedHat_ClusterNodeHostingFailoverService" + + + +class ClusterProvider : + public Pegasus::CIMInstanceProvider //, public Pegasus::CIMAssociationProvider +{ + public: + ClusterProvider (void) throw (); + virtual ~ClusterProvider (void) throw (); + + // CIMProvider interface + virtual void initialize (Pegasus::CIMOMHandle& cimom); + virtual void terminate (void); + + // CIMInstanceProvider interface + virtual void getInstance( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + const Pegasus::Boolean includeQualifiers, + const Pegasus::Boolean includeClassOrigin, + const Pegasus::CIMPropertyList & propertyList, + Pegasus::InstanceResponseHandler & handler); + virtual void enumerateInstances( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + const Pegasus::Boolean includeQualifiers, + const Pegasus::Boolean includeClassOrigin, + const Pegasus::CIMPropertyList & propertyList, + Pegasus::InstanceResponseHandler & handler); + virtual void enumerateInstanceNames( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + Pegasus::ObjectPathResponseHandler & handler); + virtual void modifyInstance( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + const Pegasus::CIMInstance & obj, + const Pegasus::Boolean includeQualifiers, + const Pegasus::CIMPropertyList & propertyList, + Pegasus::ResponseHandler & handler); + virtual void createInstance( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + const Pegasus::CIMInstance & obj, + Pegasus::ObjectPathResponseHandler & handler); + virtual void deleteInstance( + const Pegasus::OperationContext & context, + const Pegasus::CIMObjectPath & ref, + Pegasus::ResponseHandler & handler); + + /* + // CIMAssociationProvider + virtual void associatorNames( + const Pegasus::OperationContext& context, + const Pegasus::CIMObjectPath& objectName, + const Pegasus::CIMName& associationClass, + const Pegasus::CIMName& resultClass, + const Pegasus::String& role, + const Pegasus::String& resultRole, + Pegasus::ObjectPathResponseHandler& handler) ; + + virtual void associators(const Pegasus::OperationContext& context, + const Pegasus::CIMObjectPath& objectName, + const Pegasus::CIMName& associationClass, + const Pegasus::CIMName& resultClass, + const Pegasus::String& role, + const Pegasus::String& resultRole, + const Pegasus::Boolean includeQualifiers, + const Pegasus::Boolean includeClassOrigin, + const Pegasus::CIMPropertyList& propertyList, + Pegasus::ObjectResponseHandler& handler); + + virtual void referenceNames(const Pegasus::OperationContext& context, + const Pegasus::CIMObjectPath& objectName, + const Pegasus::CIMName& resultClass, + const Pegasus::String& role, + Pegasus::ObjectPathResponseHandler& handler); + + virtual void references(const Pegasus::OperationContext& context, + const Pegasus::CIMObjectPath& objectName, + const Pegasus::CIMName& resultClass, + const Pegasus::String& role, + const Pegasus::Boolean includeQualifiers, + const Pegasus::Boolean includeClassOrigin, + const Pegasus::CIMPropertyList& propertyList, + Pegasus::ObjectResponseHandler& handler); + */ + + private: + void log(const Pegasus::String& str); + ClusterMonitor _monitor; + +}; // class ClusterProvider + + +}; // namespace ClusterMonitoring + + +#endif /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/ClusterProviderMain.cpp +++ - 2006-06-14 21:44:41.628941000 +0000 @@ -0,0 +1,40 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#include +#include + +#include "ClusterProvider.h" + + +using namespace Pegasus; + +extern "C" PEGASUS_EXPORT Pegasus::CIMProvider* PegasusCreateProvider(const String &providerName) +{ + if (String::equalNoCase(providerName, "RedHatClusterProvider")) + { + return new ClusterMonitoring::ClusterProvider(); + } + + return (0); +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/Makefile,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/Makefile +++ - 2006-06-14 21:44:41.709957000 +0000 @@ -0,0 +1,89 @@ +################################################################################################################################################################ +## +## Copyright (C) 2005 Red Hat, Inc. All rights reserved. +## +## This copyrighted material is made available to anyone wishing to use, +## modify, copy, or redistribute it subject to the terms and conditions +## of the GNU General Public License v.2. +## +############################################################################################################################################################## + +top_srcdir=../../../../.. +UNINSTALL = ${top_srcdir}/scripts/uninstall.pl + +INCLUDE = -I $(top_srcdir)/include -I ../include `xml2-config --cflags` + +include ${top_srcdir}/make/defines.mk +#INCLUDE += -I ${INCLUDE_DIR} + +ifeq ($(arch),i386) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IX86_GNU +endif +ifeq ($(arch),i586) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IX86_GNU +endif +ifeq ($(arch),i686) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IX86_GNU +endif +ifeq ($(arch),athlon) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IX86_GNU +endif +ifeq ($(arch),ia64) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IA64_GNU +endif +ifeq ($(arch),x86_64) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_IA64_GNU +endif + +ifeq ($(arch),ppc) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_PPC_GNU +endif +ifeq ($(arch),ppc64) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_PPC64_GNU +endif + +ifeq ($(arch),s390) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_ZSERIES_GNU +endif +ifeq ($(arch),s390x) +PEGASUS_CXXFLAGS = -DPEGASUS_PLATFORM_LINUX_ZSERIES64_GNU +endif + + + +CXXFLAGS += $(PEGASUS_CXXFLAGS) ${INCLUDE} + +#LDFLAGS += -fPIC -shared -ldl -lpthread -lcrypt \ +# -L${top_srcdir}/src/common -lClusterMonitor `xml2-config --libs` +LDFLAGS += -fPIC -shared -ldl -lpthread -lcrypt \ + ${top_srcdir}/common/*.o ../common/*.o `xml2-config --libs` + +OBJECTS = ClusterProviderMain.o ClusterProvider.o + +TARGET = libRedHatClusterProvider.so +TARGET_TEST = clusterCIM_test + + + +all: ${TARGET} $(TARGET_TEST) + +install: + install -d ${pegasus_providers_dir} + install ${TARGET} ${pegasus_providers_dir} + +uninstall: + ${UNINSTALL} ${TARGET} ${pegasus_providers_dir} + +clean: + rm -f $(OBJECTS) $(TARGET) $(TARGET_TEST) + +check: + +rebuild: clean all + + +$(TARGET): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) + +$(TARGET_TEST): clusterCIM_test.* + $(CXX) -Wall -Wno-unused ${INCLUDE} $(PEGASUS_CXXFLAGS) -lpegcommon -lpegclient -lpthread -lcrypt -o $@ $@.cpp /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/SmartHandler.h +++ - 2006-06-14 21:44:41.792310000 +0000 @@ -0,0 +1,48 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#ifndef SmartHandler_h +#define SmartHandler_h + + +namespace ClusterMonitoring +{ + + +template +class SmartHandler +{ + public: + SmartHandler(cl &handler) : _handler(handler) { _handler.processing(); } + virtual ~SmartHandler(void) { _handler.complete(); } + + private: + cl& _handler; + +}; // class SmartHandler + + +}; // namespace ClusterMonitoring + + +#endif /cvs/cluster/conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.cpp +++ - 2006-06-14 21:44:41.872232000 +0000 @@ -0,0 +1,161 @@ +#include "clusterCIM_test.h" + +#include + + +PEGASUS_USING_PEGASUS; +PEGASUS_USING_STD; + + +int +main(int argc, char** argv) +{ + try + { + CIMClient client; + string hostname; + + if (argc == 1) { + cout << "Enter hostname: "; + cin >> hostname; + } + else if (argc == 2) + hostname = argv[1]; + else { + cout << "Usage:" << endl; + cout << " " << argv[0] << " " << endl; + return 1; + } + + // connect + + if (hostname == "localhost") + client.connectLocal(); + else { + string username, password; + cout << "Enter username: "; + cin >> username; + cout << "Enter password for user \"" + username + "\" on \"" + hostname + "\": "; + cin >> password; + + client.connect(hostname.c_str(), + PEGASUS_PORT, + SSLContext("", NULL), + username.c_str(), + password.c_str()); + } + + // print + + printClusters(client); + printNodes(client); + printServices(client); + } + catch(Exception& e) + { + cerr << "Error: " << e.getMessage() << endl; + exit(1); + } + + return 0; +} + + +void +printClusters(CIMClient& client) +{ + const CIMNamespaceName NAMESPACE = CIMNamespaceName("root/cimv2"); + const CIMName CLASSNAME = CIMName("RedHat_Cluster"); + + Boolean deepInheritance = true; + Boolean localOnly = true; + Boolean includeQualifiers = false; + Boolean includeClassOrigin = false; + Array cimInstances; + + // + // Enumerate Instances. + // + cimInstances = client.enumerateInstances(NAMESPACE, + CLASSNAME, + deepInheritance, + localOnly, + includeQualifiers, + includeClassOrigin ); + int size = cimInstances.size(); + if (size == 0) + cout << "Cluster info is not accessible" << endl; + for (int i=0; i cimInstances; + + // + // Enumerate Instances. + // + cimInstances = client.enumerateInstances(NAMESPACE, + CLASSNAME, + deepInheritance, + localOnly, + includeQualifiers, + includeClassOrigin ); + int size = cimInstances.size(); + for (int i=0; i cimInstances; + + // + // Enumerate Instances. + // + cimInstances = client.enumerateInstances(NAMESPACE, + CLASSNAME, + deepInheritance, + localOnly, + includeQualifiers, + includeClassOrigin ); + int size = cimInstances.size(); + for (int i=0; i standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/cim-provider/clusterCIM_test.h +++ - 2006-06-14 21:44:41.955896000 +0000 @@ -0,0 +1,23 @@ +#ifndef ClusterClient_h +#define ClusterClient_h + +#include +#include +#include + + +PEGASUS_USING_PEGASUS; +PEGASUS_USING_STD; + + +#define PEGASUS_PORT 5989 + + +void printClusters(CIMClient& client); +void printNodes(CIMClient& client); +void printServices(CIMClient& client); + +void printInstance(string tab, CIMInstance& inst); + + +#endif /cvs/cluster/conga/ricci/modules/cluster/clumon/src/common/ClusterMonitor.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/common/ClusterMonitor.cpp +++ - 2006-06-14 21:44:42.037451000 +0000 @@ -0,0 +1,84 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#include "ClusterMonitor.h" +#include "Socket.h" +#include "Time.h" + +#include +#include + + +using namespace ClusterMonitoring; + + +ClusterMonitor::ClusterMonitor(const std::string& socket_path) : + _sock_path(socket_path) +{} + +ClusterMonitor::~ClusterMonitor() +{} + + +counting_auto_ptr +ClusterMonitor::get_cluster() +{ + try { + ClientSocket sock(_sock_path); + + if(sock.send("GET").size()) + throw int(); + + std::string xml; + unsigned int timeout = 1000; + while (timeout > 0) { + struct pollfd poll_data; + poll_data.fd = sock.get_sock(); + poll_data.events = POLLIN; + poll_data.revents = 0; + + unsigned int time_start = time_mil(); + int ret = poll(&poll_data, 1, timeout); + timeout -= (time_mil() - time_start); + if (ret == 0) + continue; + else if (ret == -1) { + if (errno == EINTR) + continue; + else + throw std::string("get_cluster(): poll() error"); + } + if (poll_data.revents & POLLIN) { + xml += sock.recv(); + if (xml.find("\n\n") != xml.npos) + break; + continue; + } + if (poll_data.revents & (POLLERR | POLLHUP | POLLNVAL)) + throw std::string("get_cluster(): socket error"); + } + return xml2cluster(xml); + } catch ( ... ) { + return counting_auto_ptr(); + } +} --- conga/ricci/modules/cluster/clumon/src/common/Makefile 2006/03/27 23:15:30 1.1 +++ conga/ricci/modules/cluster/clumon/src/common/Makefile 2006/06/14 21:44:37 1.2 @@ -25,7 +25,7 @@ # Logger.o \ # Time.o -OBJECTS = Cluster.o Node.o Service.o +OBJECTS = Cluster.o Node.o Service.o ClusterMonitor.o CXXFLAGS = -Wall $(INCLUDE) /cvs/cluster/conga/ricci/modules/cluster/clumon/src/include/ClusterMonitor.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/include/ClusterMonitor.h +++ - 2006-06-14 21:44:42.206131000 +0000 @@ -0,0 +1,58 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#ifndef ClusterMonitor_h +#define ClusterMonitor_h + +#include "Cluster.h" +#include "counting_auto_ptr.h" +#include "clumond_globals.h" + +#include + + +namespace ClusterMonitoring +{ + + +class ClusterMonitor +{ + public: + ClusterMonitor(const std::string& socket_path=MONITORING_CLIENT_SOCKET); + virtual ~ClusterMonitor(); + + counting_auto_ptr get_cluster(); + + private: + std::string _sock_path; + + ClusterMonitor(const ClusterMonitor&); + ClusterMonitor& operator= (const ClusterMonitor&); + +}; // class ClusterMonitor + + +}; // namespace ClusterMonitoring + + +#endif /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/Makefile,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/Makefile +++ - 2006-06-14 21:44:42.288681000 +0000 @@ -0,0 +1,66 @@ +################################################################################################################################################################ +## +## Copyright (C) 2005 Red Hat, Inc. All rights reserved. +## +## This copyrighted material is made available to anyone wishing to use, +## modify, copy, or redistribute it subject to the terms and conditions +## of the GNU General Public License v.2. +## +############################################################################################################################################################## + +top_srcdir=../../../../.. +UNINSTALL = ${top_srcdir}/scripts/uninstall.pl + +INCLUDE += -I $(top_srcdir)/include -I ../include `xml2-config --cflags` + +include ${top_srcdir}/make/defines.mk +#INCLUDE += -I ${INCLUDE_DIR} + + +SNMP_CFLAGS = `net-snmp-config --cflags` +CXXFLAGS += $(SNMP_CFLAGS) $(INCLUDE) + + +#LDFLAGS += -fPIC -shared -lpthread \ +# -L${top_srcdir}/src/common -lClusterMonitor \ +# `net-snmp-config --libs` \ +# `xml2-config --libs` + +LDFLAGS += -fPIC -shared -lssl -lpthread \ + ${top_srcdir}/common/*.o ../common/*.o \ + `net-snmp-config --libs` \ + `xml2-config --libs` + + + +OBJECTS = clusterMonitorSnmp.o \ + clusterMIB.o \ + nodesMIB.o nodesMIB_access.o nodesMIB_checkfns.o \ + nodesMIB_checkfns_local.o \ + servicesMIB.o servicesMIB_access.o \ + servicesMIB_checkfns.o servicesMIB_checkfns_local.o + +TARGET = libClusterMonitorSnmp.so + + + +all: ${TARGET} + + +install: + install -d ${libdir}/cluster-snmp + install ${TARGET} ${libdir}/cluster-snmp + +uninstall: + ${UNINSTALL} ${TARGET} ${libdir}/cluster-snmp + +clean: + rm -f $(OBJECTS) $(TARGET) + +check: + +rebuild: clean all + + +$(TARGET): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.cpp +++ - 2006-06-14 21:44:42.370115000 +0000 @@ -0,0 +1,1279 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $ + */ + + +#include "clusterMIB.h" +#include "clusterMonitorSnmp.h" + + +using namespace ClusterMonitoring; +using namespace std; + + +static unsigned int getStatusCode(); +static string getStatusDescription(unsigned int code); + + +void +initialize_clusterMIB(void) +{ + static oid rhcMIBVersion_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 1, 1 }; + + static oid rhcClusterName_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 1 }; + static oid rhcClusterStatusCode_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 2 }; + static oid rhcClusterStatusDesc_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 3 }; + static oid rhcClusterVotesNeededForQuorum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 4 }; + static oid rhcClusterVotes_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 5 }; + static oid rhcClusterQuorate_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 6 }; + static oid rhcClusterNodesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 7 }; + static oid rhcClusterNodesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 8 }; + static oid rhcClusterAvailNodesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 9 }; + static oid rhcClusterAvailNodesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 10 }; + static oid rhcClusterUnavailNodesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 11 }; + static oid rhcClusterUnavailNodesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 12 }; + static oid rhcClusterServicesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 13 }; + static oid rhcClusterServicesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 14 }; + static oid rhcClusterRunningServicesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 15 }; + static oid rhcClusterRunningServicesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 16 }; + static oid rhcClusterStoppedServicesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 17 }; + static oid rhcClusterStoppedServicesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 18 }; + static oid rhcClusterFailedServicesNum_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 19 }; + static oid rhcClusterFailedServicesNames_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 2, 20 }; + + DEBUGMSGTL(("libClusterMonitorSnmp", "Initializing\n")); + + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcMIBVersion", + handle_rhcMIBVersion, + rhcMIBVersion_oid, + OID_LENGTH(rhcMIBVersion_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterFailedServicesNum", + handle_rhcClusterFailedServicesNum, + rhcClusterFailedServicesNum_oid, + OID_LENGTH(rhcClusterFailedServicesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterFailedServicesNames", + handle_rhcClusterFailedServicesNames, + rhcClusterFailedServicesNames_oid, + OID_LENGTH(rhcClusterFailedServicesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterStatusDesc", + handle_rhcClusterStatusDesc, + rhcClusterStatusDesc_oid, + OID_LENGTH(rhcClusterStatusDesc_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterVotes", handle_rhcClusterVotes, + rhcClusterVotes_oid, + OID_LENGTH(rhcClusterVotes_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterQuorate", handle_rhcClusterQuorate, + rhcClusterQuorate_oid, + OID_LENGTH(rhcClusterQuorate_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterStoppedServicesNum", + handle_rhcClusterStoppedServicesNum, + rhcClusterStoppedServicesNum_oid, + OID_LENGTH(rhcClusterStoppedServicesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterStoppedServicesNames", + handle_rhcClusterStoppedServicesNames, + rhcClusterStoppedServicesNames_oid, + OID_LENGTH(rhcClusterStoppedServicesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterAvailNodesNum", + handle_rhcClusterAvailNodesNum, + rhcClusterAvailNodesNum_oid, + OID_LENGTH(rhcClusterAvailNodesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterAvailNodesNames", + handle_rhcClusterAvailNodesNames, + rhcClusterAvailNodesNames_oid, + OID_LENGTH(rhcClusterAvailNodesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterServicesNum", + handle_rhcClusterServicesNum, + rhcClusterServicesNum_oid, + OID_LENGTH(rhcClusterServicesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterServicesNames", + handle_rhcClusterServicesNames, + rhcClusterServicesNames_oid, + OID_LENGTH(rhcClusterServicesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterName", handle_rhcClusterName, + rhcClusterName_oid, + OID_LENGTH(rhcClusterName_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterStatusCode", + handle_rhcClusterStatusCode, + rhcClusterStatusCode_oid, + OID_LENGTH(rhcClusterStatusCode_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterUnavailNodesNum", + handle_rhcClusterUnavailNodesNum, + rhcClusterUnavailNodesNum_oid, + OID_LENGTH(rhcClusterUnavailNodesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterUnavailNodesNames", + handle_rhcClusterUnavailNodesNames, + rhcClusterUnavailNodesNames_oid, + OID_LENGTH(rhcClusterUnavailNodesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterNodesNum", + handle_rhcClusterNodesNum, + rhcClusterNodesNum_oid, + OID_LENGTH(rhcClusterNodesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterNodesNames", + handle_rhcClusterNodesNames, + rhcClusterNodesNames_oid, + OID_LENGTH(rhcClusterNodesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterRunningServicesNum", + handle_rhcClusterRunningServicesNum, + rhcClusterRunningServicesNum_oid, + OID_LENGTH(rhcClusterRunningServicesNum_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterRunningServicesNames", + handle_rhcClusterRunningServicesNames, + rhcClusterRunningServicesNames_oid, + OID_LENGTH(rhcClusterRunningServicesNames_oid), + HANDLER_CAN_RONLY)); + netsnmp_register_scalar(netsnmp_create_handler_registration + ("rhcClusterVotesNeededForQuorum", + handle_rhcClusterVotesNeededForQuorum, + rhcClusterVotesNeededForQuorum_oid, + OID_LENGTH + (rhcClusterVotesNeededForQuorum_oid), + HANDLER_CAN_RONLY)); +} + + +unsigned int +getStatusCode(Cluster* cluster) +{ + unsigned int code = 1; // OK + + if (cluster->failedServices().size() != 0) + // service failed + code = (code & ~1) | 2; + + if (cluster->stoppedServices().size() != 0) + // service not running + code = (code & ~1) | 4; + + if (cluster->unclusteredNodes().size() != 0) + // unavailable node + code = (code & ~1) | 8; + + if (cluster->votes() < cluster->minQuorum()) + // not quorate + code = (code & ~1) | 16; + + if (cluster->unclusteredNodes().size() == cluster->nodes().size()) + // cluster stopped + code = (code & ~1) | 32; + + return code; +} + +string +getStatusDescription(unsigned int code) +{ + if (code == 1) + return "All services and nodes functional"; + if (code & 32) + return "Cluster stopped (all services stopped)"; + if (code & 16) + return "Not quorate (all services stopped)"; + + string descr; + if (code & 2) { + string c = "Some services failed"; + if (descr.size() == 0) + descr = c; + else + descr += ", " + c; + } + if (code & 4) { + string c = "Some services not running"; + if (descr.size() == 0) + descr = c; + else + descr += ", " + c; + } + if (code & 8) { + string c = "Some nodes unavailable"; + if (descr.size() == 0) + descr = c; + else + descr += ", " + c; + } + return descr; +} + + +int +handle_rhcMIBVersion(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + + unsigned int num = 1; // MIB version 1 + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterFailedServicesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->failedServices().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterFailedServicesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->failedServices(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterStatusDesc(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int code = getStatusCode(cluster.get()); + string str = getStatusDescription(code); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterVotes(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->votes(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterStoppedServicesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->stoppedServices().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterStoppedServicesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->stoppedServices(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterAvailNodesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->clusteredNodes().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterAvailNodesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->clusteredNodes(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterServicesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->services().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterServicesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->services(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterName(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + string name = cluster->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + name.c_str(), + name.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterStatusCode(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int code = getStatusCode(cluster.get()); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &code, + sizeof(code)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterUnavailNodesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->unclusteredNodes().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterUnavailNodesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->unclusteredNodes(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterNodesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->nodes().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterNodesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->nodes(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterRunningServicesNum(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->runningServices().size(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterRunningServicesNames(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + list > l = cluster->runningServices(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, + (u_char *) + str.c_str(), + str.size()); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterVotesNeededForQuorum(netsnmp_mib_handler *handler, + netsnmp_handler_registration + *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->minQuorum(); + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} + +int +handle_rhcClusterQuorate(netsnmp_mib_handler *handler, + netsnmp_handler_registration + *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if(cluster.get() == NULL) + return SNMP_ERR_NOERROR; + + unsigned int num = cluster->quorate() ? 1 : 0; + + /* + * We are never called for a GETNEXT if it's registered as a + * "instance", as it's "magically" handled for us. + */ + + /* + * a instance handler also only hands us one request at a time, so + * we don't need to loop over a list of requests; we'll only get one. + */ + + switch (reqinfo->mode) { + + case MODE_GET: + snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER, + (u_char *) + &num, + sizeof(num)); + break; + + default: + /* + * we should never get here, so this is a really bad error + */ + return SNMP_ERR_GENERR; + } + } + catch( ... ) { + return SNMP_ERR_GENERR; + } + return SNMP_ERR_NOERROR; +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMIB.h +++ - 2006-06-14 21:44:42.460611000 +0000 @@ -0,0 +1,66 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $ + */ + + +#ifndef clusterMIB_h +#define clusterMIB_h + +#include +#include +#include + + +void initialize_clusterMIB(void); + +extern "C" +{ + +Netsnmp_Node_Handler handle_rhcMIBVersion; +Netsnmp_Node_Handler handle_rhcClusterName; +Netsnmp_Node_Handler handle_rhcClusterStatusCode; +Netsnmp_Node_Handler handle_rhcClusterStatusDesc; +Netsnmp_Node_Handler handle_rhcClusterVotes; +Netsnmp_Node_Handler handle_rhcClusterQuorate; +Netsnmp_Node_Handler handle_rhcClusterFailedServicesNum; +Netsnmp_Node_Handler handle_rhcClusterFailedServicesNames; +Netsnmp_Node_Handler handle_rhcClusterStoppedServicesNum; +Netsnmp_Node_Handler handle_rhcClusterStoppedServicesNames; +Netsnmp_Node_Handler handle_rhcClusterAvailNodesNum; +Netsnmp_Node_Handler handle_rhcClusterAvailNodesNames; +Netsnmp_Node_Handler handle_rhcClusterServicesNum; +Netsnmp_Node_Handler handle_rhcClusterServicesNames; +Netsnmp_Node_Handler handle_rhcClusterUnavailNodesNum; +Netsnmp_Node_Handler handle_rhcClusterUnavailNodesNames; +Netsnmp_Node_Handler handle_rhcClusterNodesNum; +Netsnmp_Node_Handler handle_rhcClusterNodesNames; +Netsnmp_Node_Handler handle_rhcClusterRunningServicesNum; +Netsnmp_Node_Handler handle_rhcClusterRunningServicesNames; +Netsnmp_Node_Handler handle_rhcClusterVotesNeededForQuorum; + +}; + + +#endif /* clusterMIB_h */ /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.cpp +++ - 2006-06-14 21:44:42.542359000 +0000 @@ -0,0 +1,44 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + + +#include "clusterMonitorSnmp.h" +#include "clusterMIB.h" +#include "nodesMIB.h" +#include "servicesMIB.h" +#include "clumond_globals.h" + + +ClusterMonitoring::ClusterMonitor monitor; + +void +init_RedHatCluster(void) +{ + try { + initialize_clusterMIB(); + initialize_nodesMIB(); + initialize_servicesMIB(); + + // TODO: initialize others + } catch ( ... ) + {} +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/clusterMonitorSnmp.h +++ - 2006-06-14 21:44:42.630779000 +0000 @@ -0,0 +1,39 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $ + */ + + +#ifndef clusterMonitorSnmp_h +#define clusterMonitorSnmp_h + +#include "ClusterMonitor.h" + +extern ClusterMonitoring::ClusterMonitor monitor; + + +// called by snmpd +extern "C" void init_RedHatCluster(void); + +#endif /* clusterMonitorSnmp_h */ /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.cpp +++ - 2006-06-14 21:44:42.741474000 +0000 @@ -0,0 +1,341 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $ + */ + + +#include "nodesMIB.h" +#include "nodesMIB_checkfns.h" +#include "nodesMIB_access.h" + + +void +initialize_nodesMIB(void) +{ + init_rhcNodesTable(); +} + + + +static netsnmp_oid_stash_node *undoStorage = NULL; +static netsnmp_oid_stash_node *commitStorage = NULL; + +struct undoInfo { + void *ptr; + size_t len; +}; + +struct commitInfo { + void *data_context; + int have_committed; + int new_row; +}; + + +void +rhcNodesTable_free_undoInfo(void *vptr) +{ + struct undoInfo *ui = (struct undoInfo*) vptr; + if (!ui) + return; + SNMP_FREE(ui->ptr); + SNMP_FREE(ui); +} + +/** Initialize the rhcNodesTable table by defining its contents and how it's structured */ +void +initialize_table_rhcNodesTable(void) +{ + static oid rhcNodesTable_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 3, 1 }; + netsnmp_table_registration_info *table_info; + netsnmp_handler_registration *my_handler; + netsnmp_iterator_info *iinfo; + + /** create the table registration information structures */ + table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); + iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); + + /** if your table is read only, it's easiest to change the + HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */ + my_handler = netsnmp_create_handler_registration("rhcNodesTable", + rhcNodesTable_handler, + rhcNodesTable_oid, + OID_LENGTH + (rhcNodesTable_oid), + HANDLER_CAN_RONLY); + + if (!my_handler || !table_info || !iinfo) { + snmp_log(LOG_ERR, + "malloc failed in initialize_table_rhcNodesTable"); + return; /** Serious error. */ + } + + /*************************************************** + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, + /** index: rhcNodeName */ + 0); + + /** Define the minimum and maximum accessible columns. This + optimizes retrival. */ + table_info->min_column = 1; + table_info->max_column = 5; + + /** iterator access routines */ + iinfo->get_first_data_point = rhcNodesTable_get_first_data_point; + iinfo->get_next_data_point = rhcNodesTable_get_next_data_point; + + /** you may wish to set these as well */ + //#ifdef MAYBE_USE_THESE + iinfo->make_data_context = rhcNodesTable_context_convert_function; + iinfo->free_data_context = rhcNodesTable_data_free; + + /** pick *only* one of these if you use them */ + //iinfo->free_loop_context = rhcNodesTable_loop_free; + iinfo->free_loop_context_at_end = rhcNodesTable_loop_free; + //#endif + + /** tie the two structures together */ + iinfo->table_reginfo = table_info; + + /*************************************************** + * registering the table with the master agent + */ + DEBUGMSGTL(("initialize_table_rhcNodesTable", + "Registering table rhcNodesTable as a table iterator\n")); + netsnmp_register_table_iterator(my_handler, iinfo); +} + +/** Initializes the rhcNodesTable module */ +void +init_rhcNodesTable(void) +{ + + /** here we initialize all the tables we're planning on supporting */ + initialize_table_rhcNodesTable(); +} + +/** handles requests for the rhcNodesTable table, if anything else needs to be done */ +int +rhcNodesTable_handler(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + + netsnmp_request_info *request; + netsnmp_table_request_info *table_info; + netsnmp_variable_list *var; + struct commitInfo *ci = NULL; + + void *data_context = NULL; + + oid *suffix; + size_t suffix_len; + + /** column and row index encoded portion */ + suffix = requests->requestvb->name + reginfo->rootoid_len + 1; + suffix_len = requests->requestvb->name_length - + (reginfo->rootoid_len + 1); + + for (request = requests; request; request = request->next) { + var = request->requestvb; + if (request->processed != 0) + continue; + + switch (reqinfo->mode) { + case MODE_GET: + case MODE_SET_RESERVE1: + data_context = netsnmp_extract_iterator_context(request); + if (data_context == NULL) { + if (reqinfo->mode == MODE_GET) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + } + break; + + default: /* == the other SET modes */ + ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, + suffix + 1, suffix_len - 1); + break; + + } + + /** extracts the information about the table from the request */ + table_info = netsnmp_extract_table_info(request); + /** table_info->colnum contains the column number requested */ + /** table_info->indexes contains a linked list of snmp variable + bindings for the indexes of the table. Values in the list + have been set corresponding to the indexes of the + request */ + if (table_info == NULL) { + continue; + } + + switch (reqinfo->mode) { + case MODE_GET: + switch (table_info->colnum) { + case COLUMN_RHCNODENAME: + { + char *retval; + size_t retval_len = 0; + retval = get_rhcNodeName(data_context, &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCNODESTATUSCODE: + { + long *retval; + size_t retval_len = 0; + retval = + get_rhcNodeStatusCode(data_context, &retval_len); + snmp_set_var_typed_value(var, ASN_INTEGER, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCNODESTATUSDESC: + { + char *retval; + size_t retval_len = 0; + retval = + get_rhcNodeStatusDesc(data_context, &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCNODERUNNINGSERVICESNUM: + { + long *retval; + size_t retval_len = 0; + retval = + get_rhcNodeRunningServicesNum(data_context, + &retval_len); + snmp_set_var_typed_value(var, ASN_INTEGER, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCNODERUNNINGSERVICESNAMES: + { + char *retval; + size_t retval_len = 0; + retval = + get_rhcNodeRunningServicesNames(data_context, + &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + default: + /** We shouldn't get here */ + snmp_log(LOG_ERR, + "problem encountered in rhcNodesTable_handler: unknown column\n"); + } + break; + + case MODE_SET_RESERVE1: + ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, + suffix + 1, suffix_len - 1); + + if (!ci) { + /** create the commit storage info */ + ci = SNMP_MALLOC_STRUCT(commitInfo); + if (!data_context) { + ci->data_context = + rhcNodesTable_create_data_context(table_info-> + indexes); + ci->new_row = 1; + } else { + ci->data_context = data_context; + } + netsnmp_oid_stash_add_data(&commitStorage, + suffix + 1, suffix_len - 1, ci); + } + break; + + case MODE_SET_RESERVE2: + switch (table_info->colnum) { + default: + netsnmp_set_request_error(reqinfo, request, + SNMP_ERR_NOTWRITABLE); + break; + } + break; + + case MODE_SET_ACTION: + /** save a variable copy */ + switch (table_info->colnum) { + } + break; + + case MODE_SET_COMMIT: + if (!ci->have_committed) { + /** do this once per row only */ + rhcNodesTable_commit_row(&ci->data_context, ci->new_row); + ci->have_committed = 1; + } + break; + + case MODE_SET_UNDO: + /** save a variable copy */ + switch (table_info->colnum) { + } + break; + + case MODE_SET_FREE: + break; + + default: + snmp_log(LOG_ERR, + "problem encountered in rhcNodesTable_handler: unsupported mode\n"); + } + } + + /** clean up after all requset processing has ended */ + switch (reqinfo->mode) { + case MODE_SET_UNDO: + case MODE_SET_FREE: + case MODE_SET_COMMIT: + /** clear out the undo cache */ + netsnmp_oid_stash_free(&undoStorage, rhcNodesTable_free_undoInfo); + netsnmp_oid_stash_free(&commitStorage, netsnmp_oid_stash_no_free); + } + + + return SNMP_ERR_NOERROR; +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB.h +++ - 2006-06-14 21:44:42.847651000 +0000 @@ -0,0 +1,56 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $ + */ + + +#ifndef nodesMIB_h +#define nodesMIB_h + +#include +#include +#include + + +void initialize_nodesMIB(void); + +extern "C" { +config_require(rhcNodesTable_access) + /** other required module components */ + config_require(rhcNodesTable_checkfns) + + /* + * function declarations + */ + void init_rhcNodesTable(void); + void initialize_table_rhcNodesTable(void); + Netsnmp_Node_Handler rhcNodesTable_handler; +}; + +#include "nodesMIB_columns.h" + +#include "nodesMIB_enums.h" + + +#endif // nodesMIB_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.cpp +++ - 2006-06-14 21:44:42.929205000 +0000 @@ -0,0 +1,395 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.access_functions.conf,v 1.6.2.2 2004/06/21 10:12:28 dts12 Exp $ + */ + + +#include "nodesMIB_access.h" +#include "nodesMIB_enums.h" + +#include "ClusterMonitor.h" +#include "Cluster.h" +#include "clusterMonitorSnmp.h" + +#include + + +using namespace ClusterMonitoring; +using namespace std; + + +static unsigned int getStatusCode(counting_auto_ptr); +static string getStatusDescription(unsigned int code); + + +class LoopContext +{ +public: + LoopContext(counting_auto_ptr cluster) : + _cluster(cluster), + _nodes(_cluster->nodes()), + _curr(_nodes.begin()) {} + virtual ~LoopContext() {} + + counting_auto_ptr curr() + { + if (_curr == _nodes.end()) + return counting_auto_ptr(); + else + return *_curr; + } + counting_auto_ptr next() + { + if (curr().get() != NULL) + _curr++; + return curr(); + } + +private: + counting_auto_ptr _cluster; + list > _nodes; + list >::iterator _curr; +}; + +class DataContext +{ +public: + DataContext(LoopContext& loop) : + _node(loop.curr()) {} + virtual ~DataContext() {} + counting_auto_ptr getNode() + { + return _node; + } + string str_holder; + long long_holder; + +private: + counting_auto_ptr _node; +}; + + + +// ######################## INDEXES functions ########################## + + +/** returns the first data point within the rhcNodesTable table data. + + Set the my_loop_context variable to the first data point structure + of your choice (from which you can find the next one). This could + be anything from the first node in a linked list, to an integer + pointer containing the beginning of an array variable. + + Set the my_data_context variable to something to be returned to + you later that will provide you with the data to return in a given + row. This could be the same pointer as what my_loop_context is + set to, or something different. + + The put_index_data variable contains a list of snmp variable + bindings, one for each index in your table. Set the values of + each appropriately according to the data matching the first row + and return the put_index_data variable at the end of the function. +*/ +netsnmp_variable_list* +rhcNodesTable_get_first_data_point(void** my_loop_context, + void** my_data_context, + netsnmp_variable_list* put_index_data, + netsnmp_iterator_info* mydata) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if (cluster.get() == NULL) + return NULL; + + LoopContext* loopctx = new LoopContext(cluster); + *my_loop_context = loopctx; + + counting_auto_ptr node = loopctx->curr(); + if (node.get() == NULL) + return NULL; + + const string& name = node->name(); + snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); + return put_index_data; + } catch ( ... ) { + return NULL; + } +} + +/** functionally the same as rhcNodesTable_get_first_data_point, but + my_loop_context has already been set to a previous value and should + be updated to the next in the list. For example, if it was a + linked list, you might want to cast it to your local data type and + then return my_loop_context->next. The my_data_context pointer + should be set to something you need later and the indexes in + put_index_data updated again. */ +netsnmp_variable_list* +rhcNodesTable_get_next_data_point(void** my_loop_context, + void** my_data_context, + netsnmp_variable_list* put_index_data, + netsnmp_iterator_info* mydata) +{ + try { + LoopContext* loopctx = (LoopContext*) *my_loop_context; + if (loopctx == NULL) + return NULL; + + counting_auto_ptr node = loopctx->next(); + if (node.get() == NULL) + return NULL; + + const string& name = node->name(); + snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); + return put_index_data; + } catch ( ... ) { + return NULL; + } +} + +void* +rhcNodesTable_context_convert_function(void *loop_context, + netsnmp_iterator_info *iinfo) +{ + try { + LoopContext *loopctx = (LoopContext*) loop_context; + return new DataContext(*loopctx); + } catch ( ... ) { + return NULL; + } +} + +void +rhcNodesTable_loop_free(void *loopctx, netsnmp_iterator_info *iinfo) +{ + delete (LoopContext*) loopctx; +} + +void +rhcNodesTable_data_free(void *data, netsnmp_iterator_info *iinfo) +{ + delete (DataContext*) data; +} + + + +// ######################## GET functions ########################## + + +/* + * User-defined data access functions (per column) for data in table rhcNodesTable + */ +/* + * NOTE: + * - these get_ routines MUST return data that will not be freed (ie, + * use static variables or persistent data). It will be copied, if + * needed, immediately after the get_ routine has been called. + */ + + +char* +get_rhcNodeName(void *data_context, size_t * ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr node = datactx->getNode(); + if (node.get() == NULL) + return NULL; + + datactx->str_holder = node->name(); + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + +long* +get_rhcNodeRunningServicesNum(void *data_context, size_t * ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr node = datactx->getNode(); + if (node.get() == NULL) + return NULL; + + datactx->long_holder = node->services().size(); + *ret_len = sizeof(datactx->long_holder); + return &datactx->long_holder; + } catch ( ... ) { + return NULL; + } +} + +char* +get_rhcNodeRunningServicesNames(void *data_context, size_t * ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr node = datactx->getNode(); + if (node.get() == NULL) + return NULL; + + list > l = node->services(); + string str; + for (list >::iterator iter = l.begin(); + iter != l.end(); + iter++) + if (str.empty()) + str = (*iter)->name(); + else + str += ", " + (*iter)->name(); + + datactx->str_holder = str; + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + + +// ## status ## + +unsigned int +getStatusCode(counting_auto_ptr node) +{ + if (node->clustered()) + // in cluster + return 0; + + if (node->online()) + // unavailable to cluster + return 1; + + // OK + return 2; +} +string +getStatusDescription(unsigned int code) +{ + switch(code) { + case 0: + return "Participating in cluster"; + case 1: + return "Running, but not participating in cluster"; + case 2: + return "Not running"; + default: + return "Unknown"; + } +} + +long* +get_rhcNodeStatusCode(void *data_context, size_t * ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr node = datactx->getNode(); + if (node.get() == NULL) + return NULL; + + datactx->long_holder = getStatusCode(node); + *ret_len = sizeof(datactx->long_holder); + return &datactx->long_holder; + } catch ( ... ) { + return NULL; + } +} + +char* +get_rhcNodeStatusDesc(void *data_context, size_t * ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr node = datactx->getNode(); + if (node.get() == NULL) + return NULL; + + unsigned int code = getStatusCode(node); + datactx->str_holder = getStatusDescription(code); + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + + + + + + +// ######################### SET functions ####################### + + + +/** Create a data_context for non-existent rows that SETs are performed on. + * return a void * pointer which will be passed to subsequent get_XXX + * and set_XXX functions for data retrival and modification during + * this SET request. + * + * The indexs are encoded (in order) into the index_data pointer if it + * would be helpful to use that information. + */ +void* +rhcNodesTable_create_data_context(netsnmp_variable_list * index_data) +{ + return NULL; /* XXX: you likely want to return a real pointer */ +} + +/** If the implemented set_* functions don't operate directly on the + real-live data (which is actually recommended), then this function + can be used to take a given my_data_context pointer and "commit" it + to whereever the modified data needs to be put back to. For + example, if this was a routing table you could publish the modified + routes back into the kernel at this point. + + new_or_del will be set to 1 if new, or -1 if it should be deleted + or 0 if it is just a modification of an existing row. + + If you free the data yourself, make sure to *my_data_context = NULL */ +int +rhcNodesTable_commit_row(void **my_data_context, int new_or_del) +{ + /** Add any necessary commit code here */ + /* + */ + + /* + * return no errors. And there shouldn't be any!!! Ever!!! You + * should have checked the values long before this. + */ + return SNMP_ERR_NOERROR; +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_access.h +++ - 2006-06-14 21:44:43.015473000 +0000 @@ -0,0 +1,56 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ + +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.access_functions.conf,v 1.6.2.2 2004/06/21 10:12:28 dts12 Exp $ + */ + +#ifndef nodesMIB_access_h +#define nodesMIB_access_h + +#include +#include +#include + + +extern "C" { + /** User-defined data access functions for data in table rhcNodesTable */ + /** row level accessors */ + Netsnmp_First_Data_Point rhcNodesTable_get_first_data_point; + Netsnmp_Next_Data_Point rhcNodesTable_get_next_data_point; + Netsnmp_Free_Loop_Context rhcNodesTable_loop_free; + Netsnmp_Make_Data_Context rhcNodesTable_context_convert_function; + Netsnmp_Free_Data_Context rhcNodesTable_data_free; + + int rhcNodesTable_commit_row(void** my_data_context, int new_or_del); + void* rhcNodesTable_create_data_context(netsnmp_variable_list* index_data); + + /** column accessors */ + char* get_rhcNodeName(void* data_context, size_t* ret_len); + long* get_rhcNodeStatusCode(void* data_context, size_t* ret_len); + char* get_rhcNodeStatusDesc(void* data_context, size_t* ret_len); + long* get_rhcNodeRunningServicesNum(void* data_context, size_t* ret_len); + char* get_rhcNodeRunningServicesNames(void* data_context, size_t* ret_len); +}; + +#endif // nodesMIB_access_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.cpp +++ - 2006-06-14 21:44:43.102388000 +0000 @@ -0,0 +1,22 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.check_values.conf,v 1.6.2.3 2004/01/12 00:55:31 rstory Exp $ + */ + +/******************************************************************** + * NOTE NOTE NOTE + * This file is auto-generated and SHOULD NOT BE EDITED by hand. + * Modify the rhcNodesTable_checkfns_local.[ch] files insead so that you + * can regenerate this one as mib2c improvements are made. + ********************************************************************/ + + +/* + * standard headers + */ +#include +#include + +#include "nodesMIB_checkfns.h" +#include "nodesMIB_checkfns_local.h" +#include "nodesMIB_enums.h" /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns.h +++ - 2006-06-14 21:44:43.184123000 +0000 @@ -0,0 +1,27 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf,v 5.6 2003/02/20 00:52:07 hardaker Exp $ + */ + +/*********************************************************************** + * This file is auto-generated and SHOULD NOT BE EDITED by hand. + * Modify the rhcNodesTable_checkfns_local.[ch] files insead. + * (so that you can regenerate this one as mib2c improvements are made) + ***********************************************************************/ + +#ifndef nodesMIB_checkfns_h +#define nodesMIB_checkfns_h + +extern "C" { +/** make sure we load the functions that you can modify */ +config_require(rhcNodesTable_checkfns_local) + + /* + * these functions are designed to check incoming values for + * columns in the rhcNodesTable table for legality with respect to + * datatype and value. + */ +}; + + +#endif // nodesMIB_checkfns_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.cpp +++ - 2006-06-14 21:44:43.275746000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.check_values_local.conf,v 5.1.2.1 2004/05/04 23:35:32 hardaker Exp $ + */ + + +#include +#include + +#include "nodesMIB_checkfns.h" +#include "nodesMIB_enums.h" /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_checkfns_local.h +++ - 2006-06-14 21:44:43.360844000 +0000 @@ -0,0 +1,46 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : : mib2c.check_values_local.conf,v 5.1.2.1 2004/05/04 23:35:32 hardaker Exp $ + * + */ + + +#ifndef nodesMIB_chekfns_local_h +#define nodesMIB_chekfns_local_h + +extern "C" { + +/* + * these functions are designed to check incoming values for + * columns in the rhcNodesTable table for legality with respect to + * datatype and value according to local conventions. You should modify + * them as appropriate. They will be called from parent check_value + * functions that are auto-generated using mib2c and the parent functions + * should NOT be modified. + */ + +}; + + +#endif // nodesMIB_chekfns_local_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_columns.h +++ - 2006-06-14 21:44:43.456282000 +0000 @@ -0,0 +1,42 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $ + */ + + +#ifndef nodesMIB_columns_h +#define nodesMIB_columns_h + + +/* + * column number definitions for table rhcNodesTable + */ +#define COLUMN_RHCNODENAME 1 +#define COLUMN_RHCNODESTATUSCODE 2 +#define COLUMN_RHCNODESTATUSDESC 3 +#define COLUMN_RHCNODERUNNINGSERVICESNUM 4 +#define COLUMN_RHCNODERUNNINGSERVICESNAMES 5 + + +#endif // nodesMIB_columns_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/nodesMIB_enums.h +++ - 2006-06-14 21:44:43.542473000 +0000 @@ -0,0 +1,33 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.column_enums.conf,v 5.2 2003/02/22 04:09:25 hardaker Exp $ + */ + + +#ifndef nodesMIB_enums_h +#define nodesMIB_enums_h + + + +#endif // nodesMIB_enums_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.cpp +++ - 2006-06-14 21:44:43.623603000 +0000 @@ -0,0 +1,345 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $ + */ + + +#include "servicesMIB.h" +#include "servicesMIB_checkfns.h" +#include "servicesMIB_access.h" + + +void +initialize_servicesMIB(void) +{ + init_rhcServicesTable(); +} + + + +static netsnmp_oid_stash_node *undoStorage = NULL; +static netsnmp_oid_stash_node *commitStorage = NULL; + +struct undoInfo { + void *ptr; + size_t len; +}; + +struct commitInfo { + void *data_context; + int have_committed; + int new_row; +}; + +void +rhcServicesTable_free_undoInfo(void *vptr) +{ + struct undoInfo* ui = (struct undoInfo*) vptr; + if (!ui) + return; + SNMP_FREE(ui->ptr); + SNMP_FREE(ui); +} + +/** Initialize the rhcServicesTable table by defining its contents and how it's structured */ +void +initialize_table_rhcServicesTable(void) +{ + static oid rhcServicesTable_oid[] = + { 1, 3, 6, 1, 4, 1, 2312, 8, 3, 2 }; + netsnmp_table_registration_info *table_info; + netsnmp_handler_registration *my_handler; + netsnmp_iterator_info *iinfo; + + /** create the table registration information structures */ + table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); + iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); + + /** if your table is read only, it's easiest to change the + HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */ + my_handler = netsnmp_create_handler_registration("rhcServicesTable", + rhcServicesTable_handler, + rhcServicesTable_oid, + OID_LENGTH + (rhcServicesTable_oid), + HANDLER_CAN_RONLY); + + if (!my_handler || !table_info || !iinfo) { + snmp_log(LOG_ERR, + "malloc failed in initialize_table_rhcServicesTable"); + return; /** Serious error. */ + } + + /*************************************************** + * Setting up the table's definition + */ + netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, + /** index: rhcServiceName */ + 0); + + /** Define the minimum and maximum accessible columns. This + optimizes retrival. */ + table_info->min_column = 1; + table_info->max_column = 5; + + /** iterator access routines */ + iinfo->get_first_data_point = rhcServicesTable_get_first_data_point; + iinfo->get_next_data_point = rhcServicesTable_get_next_data_point; + + /** you may wish to set these as well */ + //#ifdef MAYBE_USE_THESE + iinfo->make_data_context = rhcServicesTable_context_convert_function; + iinfo->free_data_context = rhcServicesTable_data_free; + + /** pick *only* one of these if you use them */ + //iinfo->free_loop_context = rhcServicesTable_loop_free; + iinfo->free_loop_context_at_end = rhcServicesTable_loop_free; + //#endif + + /** tie the two structures together */ + iinfo->table_reginfo = table_info; + + /*************************************************** + * registering the table with the master agent + */ + DEBUGMSGTL(("initialize_table_rhcServicesTable", + "Registering table rhcServicesTable as a table iterator\n")); + netsnmp_register_table_iterator(my_handler, iinfo); +} + +/** Initializes the rhcServicesTable module */ +void +init_rhcServicesTable(void) +{ + + /** here we initialize all the tables we're planning on supporting */ + initialize_table_rhcServicesTable(); +} + +/** handles requests for the rhcServicesTable table, if anything else needs to be done */ +int +rhcServicesTable_handler(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reginfo, + netsnmp_agent_request_info *reqinfo, + netsnmp_request_info *requests) +{ + + netsnmp_request_info *request; + netsnmp_table_request_info *table_info; + netsnmp_variable_list *var; + struct commitInfo *ci = NULL; + + void *data_context = NULL; + + oid *suffix; + size_t suffix_len; + + /** column and row index encoded portion */ + suffix = requests->requestvb->name + reginfo->rootoid_len + 1; + suffix_len = requests->requestvb->name_length - + (reginfo->rootoid_len + 1); + + for (request = requests; request; request = request->next) { + var = request->requestvb; + if (request->processed != 0) + continue; + + switch (reqinfo->mode) { + case MODE_GET: + case MODE_SET_RESERVE1: + data_context = netsnmp_extract_iterator_context(request); + if (data_context == NULL) { + if (reqinfo->mode == MODE_GET) { + netsnmp_set_request_error(reqinfo, request, + SNMP_NOSUCHINSTANCE); + continue; + } + } + break; + + default: /* == the other SET modes */ + ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, + suffix + 1, + suffix_len - 1); + break; + + } + + /** extracts the information about the table from the request */ + table_info = netsnmp_extract_table_info(request); + /** table_info->colnum contains the column number requested */ + /** table_info->indexes contains a linked list of snmp variable + bindings for the indexes of the table. Values in the list + have been set corresponding to the indexes of the + request */ + if (table_info == NULL) { + continue; + } + + switch (reqinfo->mode) { + case MODE_GET: + switch (table_info->colnum) { + case COLUMN_RHCSERVICENAME: + { + char *retval; + size_t retval_len = 0; + retval = get_rhcServiceName(data_context, &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCSERVICESTATUSCODE: + { + long *retval; + size_t retval_len = 0; + retval = + get_rhcServiceStatusCode(data_context, + &retval_len); + snmp_set_var_typed_value(var, ASN_INTEGER, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCSERVICESTATUSDESC: + { + char *retval; + size_t retval_len = 0; + retval = + get_rhcServiceStatusDesc(data_context, + &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCSERVICESTARTMODE: + { + char *retval; + size_t retval_len = 0; + retval = + get_rhcServiceStartMode(data_context, &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + case COLUMN_RHCSERVICERUNNINGONNODE: + { + char *retval; + size_t retval_len = 0; + retval = + get_rhcServiceRunningOnNode(data_context, + &retval_len); + snmp_set_var_typed_value(var, ASN_OCTET_STR, + (const u_char *) retval, + retval_len); + } + break; + + default: + /** We shouldn't get here */ + snmp_log(LOG_ERR, + "problem encountered in rhcServicesTable_handler: unknown column\n"); + } + break; + + case MODE_SET_RESERVE1: + ci = (struct commitInfo*) netsnmp_oid_stash_get_data(commitStorage, + suffix + 1, + suffix_len - 1); + + if (!ci) { + /** create the commit storage info */ + ci = SNMP_MALLOC_STRUCT(commitInfo); + if (!data_context) { + ci->data_context = + rhcServicesTable_create_data_context(table_info-> + indexes); + ci->new_row = 1; + } else { + ci->data_context = data_context; + } + netsnmp_oid_stash_add_data(&commitStorage, + suffix + 1, suffix_len - 1, ci); + } + break; + + case MODE_SET_RESERVE2: + switch (table_info->colnum) { + default: + netsnmp_set_request_error(reqinfo, request, + SNMP_ERR_NOTWRITABLE); + break; + } + break; + + case MODE_SET_ACTION: + /** save a variable copy */ + switch (table_info->colnum) { + } + break; + + case MODE_SET_COMMIT: + if (!ci->have_committed) { + /** do this once per row only */ + rhcServicesTable_commit_row(&ci->data_context, + ci->new_row); + ci->have_committed = 1; + } + break; + + case MODE_SET_UNDO: + /** save a variable copy */ + switch (table_info->colnum) { + } + break; + + case MODE_SET_FREE: + break; + + default: + snmp_log(LOG_ERR, + "problem encountered in rhcServicesTable_handler: unsupported mode\n"); + } + } + + /** clean up after all requset processing has ended */ + switch (reqinfo->mode) { + case MODE_SET_UNDO: + case MODE_SET_FREE: + case MODE_SET_COMMIT: + /** clear out the undo cache */ + netsnmp_oid_stash_free(&undoStorage, + rhcServicesTable_free_undoInfo); + netsnmp_oid_stash_free(&commitStorage, netsnmp_oid_stash_no_free); + } + + + return SNMP_ERR_NOERROR; +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB.h +++ - 2006-06-14 21:44:43.703083000 +0000 @@ -0,0 +1,54 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate_access.conf,v 1.6 2003/09/29 22:30:36 hardaker Exp $ + */ + + +#ifndef servicesMIB_h +#define servicesMIB_h + +#include +#include +#include + + +void initialize_servicesMIB(void); + +extern "C" { +config_require(rhcServicesTable_access) + config_require(rhcServicesTable_checkfns) + + /* + * function declarations + */ + void init_rhcServicesTable(void); + void initialize_table_rhcServicesTable(void); + Netsnmp_Node_Handler rhcServicesTable_handler; +}; + + +#include "servicesMIB_columns.h" +#include "servicesMIB_enums.h" + +#endif // servicesMIB_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.cpp +++ - 2006-06-14 21:44:43.783504000 +0000 @@ -0,0 +1,389 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.access_functions.conf,v 1.6.2.2 2004/06/21 10:12:28 dts12 Exp $ + */ + + +#include "servicesMIB_access.h" +#include "servicesMIB_enums.h" + +#include "ClusterMonitor.h" +#include "Cluster.h" +#include "clusterMonitorSnmp.h" + +#include + +using namespace ClusterMonitoring; +using namespace std; + + +static unsigned int getStatusCode(counting_auto_ptr); +static string getStatusDescription(unsigned int code); + + + +class LoopContext +{ +public: + LoopContext(counting_auto_ptr cluster) : + _cluster(cluster), + _services(cluster->services()), + _curr(_services.begin()) {} + virtual ~LoopContext() {} + + counting_auto_ptr curr() + { + if (_curr == _services.end()) + return counting_auto_ptr(); + else + return *_curr; + } + counting_auto_ptr next() + { + if (curr().get() != NULL) + _curr++; + return curr(); + } + +private: + counting_auto_ptr _cluster; + list > _services; + list >::iterator _curr; +}; + +class DataContext +{ +public: + DataContext(LoopContext& loop) : + _service(loop.curr()) {} + virtual ~DataContext() {} + + counting_auto_ptr getService() + { + return _service; + } + string str_holder; + long long_holder; + +private: + counting_auto_ptr _service; +}; + + + +// ######################## INDEXES functions ########################## + + +/** returns the first data point within the rhcServicesTable table data. + + Set the my_loop_context variable to the first data point structure + of your choice (from which you can find the next one). This could + be anything from the first node in a linked list, to an integer + pointer containing the beginning of an array variable. + + Set the my_data_context variable to something to be returned to + you later that will provide you with the data to return in a given + row. This could be the same pointer as what my_loop_context is + set to, or something different. + + The put_index_data variable contains a list of snmp variable + bindings, one for each index in your table. Set the values of + each appropriately according to the data matching the first row + and return the put_index_data variable at the end of the function. +*/ +netsnmp_variable_list * +rhcServicesTable_get_first_data_point(void** my_loop_context, + void** my_data_context, + netsnmp_variable_list* put_index_data, + netsnmp_iterator_info* mydata) +{ + try { + counting_auto_ptr cluster = monitor.get_cluster(); + if (cluster.get() == NULL) + return NULL; + + LoopContext* loopctx = new LoopContext(cluster); + *my_loop_context = loopctx; + + counting_auto_ptr service = loopctx->curr(); + if (service.get() == NULL) + return NULL; + + const string& name = service->name(); + snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); + return put_index_data; + } catch ( ... ) { + return NULL; + } +} + +/** functionally the same as rhcServicesTable_get_first_data_point, but + my_loop_context has already been set to a previous value and should + be updated to the next in the list. For example, if it was a + linked list, you might want to cast it to your local data type and + then return my_loop_context->next. The my_data_context pointer + should be set to something you need later and the indexes in + put_index_data updated again. */ +netsnmp_variable_list * +rhcServicesTable_get_next_data_point(void** my_loop_context, + void** my_data_context, + netsnmp_variable_list* put_index_data, + netsnmp_iterator_info* mydata) +{ + try { + LoopContext* loopctx = (LoopContext*) *my_loop_context; + if (loopctx == NULL) + return NULL; + + counting_auto_ptr service = loopctx->next(); + if (service.get() == NULL) + return NULL; + + const string& name = service->name(); + snmp_set_var_value(put_index_data, (u_char *) name.c_str(), name.size()); + return put_index_data; + } catch ( ... ) { + return NULL; + } +} + +void* +rhcServicesTable_context_convert_function(void* loop_context, + netsnmp_iterator_info *iinfo) +{ + try { + LoopContext *loopctx = (LoopContext*) loop_context; + return new DataContext(*loopctx); + } catch ( ... ) { + return NULL; + } +} + +void +rhcServicesTable_loop_free(void* loopctx, netsnmp_iterator_info* iinfo) +{ + delete (LoopContext*) loopctx; +} + +void +rhcServicesTable_data_free(void* data, netsnmp_iterator_info* iinfo) +{ + delete (DataContext*) data; +} + + + +// ######################## GET functions ########################## + + + +/* + * User-defined data access functions (per column) for data in table rhcServicesTable + */ +/* + * NOTE: + * - these get_ routines MUST return data that will not be freed (ie, + * use static variables or persistent data). It will be copied, if + * needed, immediately after the get_ routine has been called. + */ + + +char* +get_rhcServiceName(void* data_context, size_t* ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr service = datactx->getService(); + if (service.get() == NULL) + return NULL; + + datactx->str_holder = service->name(); + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + +char* +get_rhcServiceStartMode(void* data_context, size_t* ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr service = datactx->getService(); + if (service.get() == NULL) + return NULL; + + if (service->autostart()) + datactx->str_holder = "automatic"; + else + datactx->str_holder = "manual"; + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + +char* +get_rhcServiceRunningOnNode(void* data_context, size_t* ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr service = datactx->getService(); + if (service.get() == NULL) + return NULL; + + if (!service->running()) + return NULL; + + datactx->str_holder = service->nodename(); + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + +// ## status ## + +unsigned int +getStatusCode(counting_auto_ptr service) +{ + if (service->failed()) + // failed + return 2; + + if (service->running()) + // running + return 0; + else + // stopped + return 1; +} +string +getStatusDescription(unsigned int code) +{ + switch(code) { + case 0: + return "running"; + case 1: + return "stopped"; + case 2: + return "failed"; + default: + return "Unknown"; + } +} + +long* +get_rhcServiceStatusCode(void* data_context, size_t* ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr service = datactx->getService(); + if (service.get() == NULL) + return NULL; + + datactx->long_holder = getStatusCode(service); + *ret_len = sizeof(datactx->long_holder); + return &datactx->long_holder; + } catch ( ... ) { + return NULL; + } +} + +char* +get_rhcServiceStatusDesc(void* data_context, size_t* ret_len) +{ + try { + DataContext* datactx = (DataContext*) data_context; + if (datactx == NULL) + return NULL; + counting_auto_ptr service = datactx->getService(); + if (service.get() == NULL) + return NULL; + + unsigned int code = getStatusCode(service); + datactx->str_holder = getStatusDescription(code); + *ret_len = datactx->str_holder.size(); + return (char*) datactx->str_holder.c_str(); + } catch ( ... ) { + return NULL; + } +} + + + + +// ######################### SET functions ####################### + + + +/** Create a data_context for non-existent rows that SETs are performed on. + * return a void * pointer which will be passed to subsequent get_XXX + * and set_XXX functions for data retrival and modification during + * this SET request. + * + * The indexs are encoded (in order) into the index_data pointer if it + * would be helpful to use that information. + */ +void * +rhcServicesTable_create_data_context(netsnmp_variable_list * index_data) +{ + return NULL; /* XXX: you likely want to return a real pointer */ +} + +/** If the implemented set_* functions don't operate directly on the + real-live data (which is actually recommended), then this function + can be used to take a given my_data_context pointer and "commit" it + to whereever the modified data needs to be put back to. For + example, if this was a routing table you could publish the modified + routes back into the kernel at this point. + + new_or_del will be set to 1 if new, or -1 if it should be deleted + or 0 if it is just a modification of an existing row. + + If you free the data yourself, make sure to *my_data_context = NULL */ +int +rhcServicesTable_commit_row(void **my_data_context, int new_or_del) +{ + /** Add any necessary commit code here */ + /* + */ + + /* + * return no errors. And there shouldn't be any!!! Ever!!! You + * should have checked the values long before this. + */ + return SNMP_ERR_NOERROR; +} /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_access.h +++ - 2006-06-14 21:44:43.865877000 +0000 @@ -0,0 +1,56 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.access_functions.conf,v 1.6.2.2 2004/06/21 10:12:28 dts12 Exp $ + */ + + +#ifndef servicesMIB_access_h +#define servicesMIB_access_h + +#include +#include +#include + + +extern "C" { + /** User-defined data access functions for data in table rhcServicesTable */ + /** row level accessors */ + Netsnmp_First_Data_Point rhcServicesTable_get_first_data_point; + Netsnmp_Next_Data_Point rhcServicesTable_get_next_data_point; + Netsnmp_Free_Loop_Context rhcServicesTable_loop_free; + Netsnmp_Make_Data_Context rhcServicesTable_context_convert_function; + Netsnmp_Free_Data_Context rhcServicesTable_data_free; + + int rhcServicesTable_commit_row(void** my_data_context, int new_or_del); + void *rhcServicesTable_create_data_context(netsnmp_variable_list* index_data); + + /** column accessors */ + char *get_rhcServiceName(void *data_context, size_t * ret_len); + long *get_rhcServiceStatusCode(void *data_context, size_t * ret_len); + char *get_rhcServiceStatusDesc(void *data_context, size_t * ret_len); + char *get_rhcServiceStartMode(void *data_context, size_t * ret_len); + char *get_rhcServiceRunningOnNode(void *data_context, size_t * ret_len); +}; + +#endif // servicesMIB_access_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.cpp +++ - 2006-06-14 21:44:43.950880000 +0000 @@ -0,0 +1,22 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.check_values.conf,v 1.6.2.3 2004/01/12 00:55:31 rstory Exp $ + */ + +/******************************************************************** + * NOTE NOTE NOTE + * This file is auto-generated and SHOULD NOT BE EDITED by hand. + * Modify the rhcServicesTable_checkfns_local.[ch] files insead so that you + * can regenerate this one as mib2c improvements are made. + ********************************************************************/ + +/* + * standard headers + */ + +#include +#include + +#include "servicesMIB_checkfns.h" +#include "servicesMIB_checkfns_local.h" +#include "servicesMIB_enums.h" /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns.h +++ - 2006-06-14 21:44:44.033659000 +0000 @@ -0,0 +1,24 @@ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.iterate.conf,v 5.6 2003/02/20 00:52:07 hardaker Exp $ + */ + +/*********************************************************************** + * This file is auto-generated and SHOULD NOT BE EDITED by hand. + * Modify the rhcServicesTable_checkfns_local.[ch] files insead. + * (so that you can regenerate this one as mib2c improvements are made) + ***********************************************************************/ + +#ifndef servicesMIB_checkfns_h +#define servicesMIB_checkfns_h + +/** make sure we load the functions that you can modify */ +config_require(rhcServicesTable_checkfns_local) + + /* + * these functions are designed to check incoming values for + * columns in the rhcServicesTable table for legality with respect to + * datatype and value. + */ + +#endif // servicesMIB_checkfns_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.cpp +++ - 2006-06-14 21:44:44.116406000 +0000 @@ -0,0 +1,32 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.check_values_local.conf,v 5.1.2.1 2004/05/04 23:35:32 hardaker Exp $ + */ + + +#include +#include + +#include "servicesMIB_checkfns.h" +#include "servicesMIB_enums.h" /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_checkfns_local.h +++ - 2006-06-14 21:44:44.196461000 +0000 @@ -0,0 +1,41 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : : mib2c.check_values_local.conf,v 5.1.2.1 2004/05/04 23:35:32 hardaker Exp $ + */ + + +#ifndef servicesMIB_checkfns_local_h +#define servicesMIB_checkfns_local_h + +/* + * these functions are designed to check incoming values for + * columns in the rhcServicesTable table for legality with respect to + * datatype and value according to local conventions. You should modify + * them as appropriate. They will be called from parent check_value + * functions that are auto-generated using mib2c and the parent functions + * should NOT be modified. + */ + + +#endif // servicesMIB_checkfns_local_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_columns.h +++ - 2006-06-14 21:44:44.279964000 +0000 @@ -0,0 +1,40 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $ + */ + + +#ifndef servicesMIB_columns_h +#define servicesMIB_columns_h + +/* + * column number definitions for table rhcServicesTable + */ +#define COLUMN_RHCSERVICENAME 1 +#define COLUMN_RHCSERVICESTATUSCODE 2 +#define COLUMN_RHCSERVICESTATUSDESC 3 +#define COLUMN_RHCSERVICESTARTMODE 4 +#define COLUMN_RHCSERVICERUNNINGONNODE 5 + +#endif // servicesMIB_columns_h /cvs/cluster/conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h,v --> standard output revision 1.1 --- conga/ricci/modules/cluster/clumon/src/snmp-agent/servicesMIB_enums.h +++ - 2006-06-14 21:44:44.360495000 +0000 @@ -0,0 +1,31 @@ +/* + Copyright Red Hat, Inc. 2005 + + 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, 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, + MA 02139, USA. +*/ +/* + * Author: Stanko Kupcevic + */ +/* + * Note: this file originally auto-generated by mib2c using + * : mib2c.column_enums.conf,v 5.2 2003/02/22 04:09:25 hardaker Exp $ + */ + + +#ifndef servicesMIB_enums_h +#define servicesMIB_enums_h + +#endif // servicesMIB_enums_h --- conga/ricci/oddjobd.conf.d/Makefile 2006/06/02 00:14:29 1.4 +++ conga/ricci/oddjobd.conf.d/Makefile 2006/06/14 21:44:37 1.5 @@ -16,13 +16,13 @@ all: install: - install -d ${DESTDIR}/etc/oddjobd.conf.d - install reboot.conf ${DESTDIR}/etc/oddjobd.conf.d - install modstorage_rw.conf ${DESTDIR}/etc/oddjobd.conf.d - install modcluster_rw.conf ${DESTDIR}/etc/oddjobd.conf.d - install modrpm_rw.conf ${DESTDIR}/etc/oddjobd.conf.d - install modservice_rw.conf ${DESTDIR}/etc/oddjobd.conf.d - install modlog_rw.conf ${DESTDIR}/etc/oddjobd.conf.d + install -d ${sysconfdir}/oddjobd.conf.d + install reboot.conf ${sysconfdir}/oddjobd.conf.d + install modstorage_rw.conf ${sysconfdir}/oddjobd.conf.d + install modcluster_rw.conf ${sysconfdir}/oddjobd.conf.d + install modrpm_rw.conf ${sysconfdir}/oddjobd.conf.d + install modservice_rw.conf ${sysconfdir}/oddjobd.conf.d + install modlog_rw.conf ${sysconfdir}/oddjobd.conf.d uninstall: --- conga/ricci/pam.d/Makefile 2006/03/13 19:03:32 1.1 +++ conga/ricci/pam.d/Makefile 2006/06/14 21:44:37 1.2 @@ -16,8 +16,8 @@ all: install: - install -d ${DESTDIR}/etc/pam.d - install ricci ${DESTDIR}/etc/pam.d + install -d ${sysconfdir}/pam.d + install ricci ${sysconfdir}/pam.d/ uninstall: --- conga/ricci/ricci/Makefile 2006/06/09 16:32:19 1.8 +++ conga/ricci/ricci/Makefile 2006/06/14 21:44:37 1.9 @@ -14,7 +14,7 @@ include ${top_srcdir}/make/defines.mk INCLUDE += -I $(top_srcdir)/include \ - -I /usr/include/dbus-1.0 -I ${LIBDIR}/dbus-1.0/include \ + -I ${includedir}/dbus-1.0 -I ${libdir}/dbus-1.0/include \ `xml2-config --cflags` @@ -54,14 +54,14 @@ install: install -d ${sbindir} - install -d ${DESTDIR}/var/lib/ricci - install -d ${DESTDIR}/var/lib/ricci/certs - install -d ${DESTDIR}/var/lib/ricci/certs/clients - install -d ${DESTDIR}/var/lib/ricci/queue + install -d ${localstatedir}/lib/ricci + install -d ${localstatedir}/lib/ricci/certs + install -d ${localstatedir}/lib/ricci/certs/clients + install -d ${localstatedir}/lib/ricci/queue install ${TARGET} ${sbindir} install ${TARGET_AUTH} ${sbindir} install ${TARGET_WORKER} ${sbindir} - install cacert.config ${DESTDIR}/var/lib/ricci/certs/ + install cacert.config ${localstatedir}/lib/ricci/certs/ uninstall: