This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
monitoring:nagios_san [2021/03/03 00:36] manu |
monitoring:nagios_san [2023/02/21 22:17] (current) manu |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Nagios SAN check ====== | ====== Nagios SAN check ====== | ||
| + | |||
| + | ===== Using Nagios Plugin ===== | ||
| + | |||
| + | https://exchange.nagios.org/directory/Plugins/Hardware/Network-Gear/Brocade/check_snmp_brocade--2D-monitor-Brocade-fibre-channel-switches/details | ||
| + | |||
| Example of check SAN (nagios server) | Example of check SAN (nagios server) | ||
| Line 56: | Line 61: | ||
| </code> | </code> | ||
| + | ===== Using Centreon Plugin ===== | ||
| + | |||
| + | ====== Use Nagios add a check Centreon for Brocade ====== | ||
| + | |||
| + | https://docs.centreon.com/pp/integrations/plugin-packs/procedures/network-switchs-brocade-snmp/ | ||
| + | |||
| + | ===== SAN swicth config SNMPv1 ===== | ||
| + | |||
| + | First test in SNMPv1 (easier, but not all metrics available | ||
| + | On SAN switch configure SNMPv1 | ||
| + | <cli prompt='>'> | ||
| + | sansw1:FID128:admin> snmpconfig --show snmpv1 | ||
| + | SNMPv1 community and trap recipient configuration: | ||
| + | Community 1: | ||
| + | No trap recipient configured yet | ||
| + | Community 2: | ||
| + | No trap recipient configured yet | ||
| + | Community 3: | ||
| + | No trap recipient configured yet | ||
| + | Community 4: | ||
| + | No trap recipient configured yet | ||
| + | Community 5: | ||
| + | No trap recipient configured yet | ||
| + | Community 6: | ||
| + | No trap recipient configured yet | ||
| + | SNMPv1:Enabled | ||
| + | |||
| + | sansw1:FID128:admin> snmpconfig --add snmpv1 -index 4 -community public -groupname ro | ||
| + | Committing configuration.....done. | ||
| + | sansw1:FID128:admin> snmpconfig --show snmpv1 | ||
| + | SNMPv1 community and trap recipient configuration: | ||
| + | Community 1: | ||
| + | No trap recipient configured yet | ||
| + | Community 2: | ||
| + | No trap recipient configured yet | ||
| + | Community 3: | ||
| + | No trap recipient configured yet | ||
| + | Community 4: public (ro) | ||
| + | No trap recipient configured yet | ||
| + | Community 5: | ||
| + | No trap recipient configured yet | ||
| + | Community 6: | ||
| + | No trap recipient configured yet | ||
| + | SNMPv1:Enabled | ||
| + | sansw1:FID128:admin> version | ||
| + | Kernel: 4.1.35rt41 | ||
| + | Fabric OS: v9.0.1c | ||
| + | </cli> | ||
| + | |||
| + | Test SNMP communication from nagios server | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 ~]$ snmpwalk -v 1 -c public sansw1 | ||
| + | ... | ||
| + | IF-MIB::ifDescr.1073741828 = STRING: FC port 0/4 | ||
| + | IF-MIB::ifDescr.1073741829 = STRING: FC port 0/5 | ||
| + | ... | ||
| + | </cli> | ||
| + | |||
| + | ===== Plugin Centreon ===== | ||
| + | |||
| + | Enable EPEL and codeready repository (cf DNF) | ||
| + | <cli prompt='#'> | ||
| + | [root@lnxb085t yum]# dnf repolist | ||
| + | Updating Subscription Management repositories. | ||
| + | repo id repo name | ||
| + | codeready-builder-for-rhel-8-ppc64le-rpms Red Hat CodeReady Linux Builder for RHEL 8 Power, little endian | ||
| + | epel Extra Packages for Enterprise Linux 8 - ppc64le | ||
| + | </cli> | ||
| + | |||
| + | Install snmp packages on nagios | ||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 ~]# dnf install net-snmp-perl net-snmp-utils net-snmp-agent-libs net-snmp net-snmp-libs perl-XML-LibXML perl-JSON perl-libwww-perl perl-XML-XPath perl-Net-Telnet perl-Net-DNS perl-DBI perl-DBD-MySQL perl-DBD-Pg | ||
| + | [root@nagsrv1 ~]# dnf install nagios-plugins-perl | ||
| + | </cli> | ||
| + | |||
| + | Download the centreon check for brocade: | ||
| + | https://download.centreon.com/ | ||
| + | select --> Custom Platforms --> Plugins | ||
| + | Extract from tar.gz package the latest script for brocade : centreon-plugins-20220414/centreon_brocade.pl | ||
| + | Copy it to /usr/lib64/nagios/plugins on nagios server | ||
| + | |||
| + | Test the perl script: | ||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 plugins]# perl centreon_brocade.pl --plugin=os::linux::snmp::plugin --mode=load | ||
| + | UNKNOWN: Cannot load module --plugin. | ||
| + | Can't locate os/linux/snmp/plugin.pm in @INC (you may need to install the os::linux::snmp::plugin module) | ||
| + | ... | ||
| + | </cli> | ||
| + | |||
| + | Some perl libraries from centreon are missing | ||
| + | |||
| + | Check Perl libraries location | ||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 ~]# perl -e 'print join("\n",@INC)' | ||
| + | /usr/local/lib64/perl5 | ||
| + | /usr/local/share/perl5 | ||
| + | /usr/lib64/perl5/vendor_perl | ||
| + | /usr/share/perl5/vendor_perl | ||
| + | /usr/lib64/perl5 | ||
| + | /usr/share/perl5 | ||
| + | </cli> | ||
| + | |||
| + | Create your own folder to prevent interaction with anything | ||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 plugins]# ll /usr/local/lib64/perl5 | ||
| + | ls: cannot access '/usr/local/lib64/perl5': No such file or directory | ||
| + | [root@nagsrv1 plugins]# mkdir /usr/local/lib64/perl5 | ||
| + | </cli> | ||
| + | |||
| + | Download the source packages from gihub (source code) | ||
| + | https://github.com/centreon/centreon-plugins/releases | ||
| + | Extract it and copy the content of src folder into your new created perl repository | ||
| + | |||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 ~]# cd /usr/local/lib64/perl5 | ||
| + | [root@nagsrv1 perl5]# ls -l | ||
| + | drwxrwxr-x 78 root root 4096 Jan 18 15:50 apps | ||
| + | drwxrwxr-x 4 root root 39 Jan 18 15:50 blockchain | ||
| + | drwxrwxr-x 4 root root 35 Jan 18 15:50 centreon | ||
| + | drwxrwxr-x 6 root root 113 Jan 18 15:50 centreon-plugins-20230118 | ||
| + | -rwxrwxr-x 1 root root 989 Jan 18 15:50 centreon_plugins.pl | ||
| + | drwxrwxr-x 17 root root 4096 Jan 18 15:50 cloud | ||
| + | drwxrwxr-x 3 root root 86 Jan 18 15:50 contrib | ||
| + | drwxrwxr-x 19 root root 4096 Jan 18 15:50 database | ||
| + | drwxrwxr-x 4 root root 107 Jan 18 15:50 example | ||
| + | drwxrwxr-x 11 root root 127 Jan 18 15:50 hardware | ||
| + | drwxrwxr-x 90 root root 4096 Jan 18 15:50 network | ||
| + | drwxrwxr-x 12 root root 158 Jan 18 15:50 notification | ||
| + | drwxrwxr-x 11 root root 124 Jan 18 15:50 os | ||
| + | drwxrwxr-x 3 root root 18 Jan 18 15:50 snmp_standard | ||
| + | drwxrwxr-x 29 root root 4096 Jan 18 15:50 storage | ||
| + | </cli> | ||
| + | |||
| + | Create the required temporary folder for centreon plugin | ||
| + | <cli> | ||
| + | mkdir /var/lib/centreon/centplugins | ||
| + | chown nagios.nagios /var/lib/centreon/centplugins | ||
| + | </cli> | ||
| + | |||
| + | Try again a connection | ||
| + | <cli prompt='$'> | ||
| + | [root@nagsrv1 plugins]$ cd /usr/lib64/nagios/plugins/ | ||
| + | [root@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=interfaces --hostname=sansw1 --snmp-version='1' --snmp-community='public' --interface='' --name --add-status --add-traffic --critical-status='' --warning-in-traffic='' --critical-in-traffic='' --warning-out-traffic='' --critical-out-traffic='' --use-new-perfdata | ||
| + | OK: All interfaces are ok | 'FC port 0/4#interface.traffic.in.bitspersecond'=2983594.46b/s;;;0;4294967295 'FC port | ||
| + | 0/4#interface.traffic.out.bitspersecond'=9405745.49b/s;;;0;4294967295 'FC port | ||
| + | 0/5#interface.traffic.in.bitspersecond'=3063697.14b/s;;;0;4294967295 'FC port | ||
| + | 0/5#interface.traffic.out.bitspersecond'=8112194.39b/s;;;0;4294967295 'FC port | ||
| + | 0/6#interface.traffic.in.bitspersecond'=848108.57b/s;;;0;4294967295 'FC port | ||
| + | ... | ||
| + | 0/47#interface.traffic.in.bitspersecond'=8957399.45b/s;;;0;4294967295 'FC port | ||
| + | 0/47#interface.traffic.out.bitspersecond'=3692879.80b/s;;;0;4294967295 | ||
| + | 'lo#interface.traffic.in.bitspersecond'=7320.76b/s;;;0; 'lo#interface.traffic.out.bitspersecond'=7320.76b/s;;;0; | ||
| + | 'eth0#interface.traffic.in.bitspersecond'=22688.20b/s;;;0;1000000000 | ||
| + | 'eth0#interface.traffic.out.bitspersecond'=25653.90b/s;;;0;1000000000 | ||
| + | </cli> | ||
| + | |||
| + | ===== Brocade plugin usage ===== | ||
| + | |||
| + | Howto get right syntax ? | ||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 plugins]# perl ./centreon_brocade.pl --list-plugin | ||
| + | ---------------- | ||
| + | PLUGIN: network::brocade::snmp::plugin | ||
| + | Plugin Description: | ||
| + | Check Brocade hardware in SNMP. | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 plugins]# perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --help | ||
| + | Plugin Description: | ||
| + | Check Brocade hardware in SNMP. | ||
| + | Global Options: | ||
| + | --mode Choose a mode. | ||
| + | --dyn-mode | ||
| + | Specify a mode with the path (separated by '::'). | ||
| + | --list-mode | ||
| + | List available modes. | ||
| + | ... | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='#'> | ||
| + | [root@nagsrv1 plugins]# perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --list-mode | ||
| + | Plugin Description: | ||
| + | Check Brocade hardware in SNMP. | ||
| + | ... | ||
| + | Modes Available: | ||
| + | cpu | ||
| + | hardware | ||
| + | interfaces | ||
| + | list-interfaces | ||
| + | memory | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='#'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=hardware --hostname=sansw1 --snmp-version='1' --snmp-community='public' | ||
| + | OK: All 1 components are ok [1/1 switch]. | 'count_switch'=1;;;; | ||
| + | </cli> | ||
| + | |||
| + | FIXME some checks are not available using SNMPv1 | ||
| + | <cli prompt='#'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=cpu --hostname=sansw1 --snmp-version='1' --snmp-community='public' | ||
| + | UNKNOWN: SNMP GET Request : Cant get a single value. | ||
| + | </cli> | ||
| + | |||
| + | ===== Switching on SNMPv3 for full feature ===== | ||
| + | |||
| + | <cli prompt='>'> | ||
| + | sansw1:FID128:admin> snmpconfig --show snmpv3 | ||
| + | SNMP Informs = 0 (OFF) | ||
| + | SNMPV3 user password encrypted = 0 (OFF) | ||
| + | SNMPv3 USM configuration: | ||
| + | User 1 (ro): snmpuser1 | ||
| + | Auth Protocol: noAuth | ||
| + | Priv Protocol: noPriv | ||
| + | User 2: | ||
| + | User 3: | ||
| + | User 4: | ||
| + | User 5: | ||
| + | User 6: | ||
| + | User 7: | ||
| + | User 8: | ||
| + | User 9: | ||
| + | User 10: | ||
| + | User 11: | ||
| + | User 12: | ||
| + | SNMPv3 Trap/Informs configuration: | ||
| + | Trap Entry 1: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 2: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 3: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 4: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 5: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 6: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='>'> | ||
| + | sansw1:FID128:admin> snmpconfig --add snmpv3 -index 6 -user test6 -groupname rw -auth_proto 1 -auth_passwd myauthpassword -priv_proto 1 -priv_passwd myprivpassword | ||
| + | Committing configuration.....done. | ||
| + | sansw1:FID128:admin> snmpconfig --show snmpv3 | ||
| + | SNMP Informs = 0 (OFF) | ||
| + | SNMPV3 user password encrypted = 0 (OFF) | ||
| + | SNMPv3 USM configuration: | ||
| + | User 1 (ro): snmpuser1 | ||
| + | Auth Protocol: noAuth | ||
| + | Priv Protocol: noPriv | ||
| + | User 2: | ||
| + | User 3: | ||
| + | User 4: | ||
| + | User 5: | ||
| + | User 6 (rw): test6 | ||
| + | Auth Protocol: MD5 | ||
| + | Priv Protocol: DES | ||
| + | User 7: | ||
| + | User 8: | ||
| + | User 9: | ||
| + | User 10: | ||
| + | User 11: | ||
| + | User 12: | ||
| + | SNMPv3 Trap/Informs configuration: | ||
| + | Trap Entry 1: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 2: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 3: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 4: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 5: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | Trap Entry 6: No trap recipient configured yet | ||
| + | Notify Type: TRAP(1) | ||
| + | </cli> | ||
| + | |||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ snmpwalk -v3 -l authPriv -u test6 -a MD5 -A myauthpassword -x DES -X myprivpassword sansw1 | ||
| + | SNMPv2-MIB::sysDescr.0 = STRING: Fibre Channel Switch. | ||
| + | SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.1588.2.1.1.181 | ||
| + | DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (3385689700) 391 days, 20:41:37.00 | ||
| + | SNMPv2-MIB::sysContact.0 = STRING: Field Support. | ||
| + | SNMPv2-MIB::sysName.0 = STRING: sansw1 | ||
| + | SNMPv2-MIB::sysLocation.0 = STRING: End User Premise. | ||
| + | SNMPv2-MIB::sysServices.0 = INTEGER: 79 | ||
| + | IF-MIB::ifNumber.0 = INTEGER: 68 | ||
| + | IF-MIB::ifIndex.805306369 = INTEGER: 805306369 | ||
| + | IF-MIB::ifIndex.805306370 = INTEGER: 805306370 | ||
| + | IF-MIB::ifIndex.805306371 = INTEGER: 805306371 | ||
| + | IF-MIB::ifIndex.805306372 = INTEGER: 805306372 | ||
| + | IF-MIB::ifIndex.805306373 = INTEGER: 805306373 | ||
| + | IF-MIB::ifIndex.805306374 = INTEGER: 805306374 | ||
| + | IF-MIB::ifIndex.805306375 = INTEGER: 805306375 | ||
| + | </cli> | ||
| + | |||
| + | Now changing user to RO | ||
| + | <cli prompt='>'> | ||
| + | sansw1:FID128:admin> snmpconfig --set snmpv3 -index 6 -user test6 -groupname ro | ||
| + | Committing configuration.....done. | ||
| + | sansw1:FID128:admin> snmpconfig --show snmpv3 | ||
| + | ... | ||
| + | User 6 (ro): test6 | ||
| + | </cli> | ||
| + | |||
| + | Test | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=cpu --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' | ||
| + | OK: CPU Usage: 14.00% | 'cpu'=14%;;;0;100 | ||
| + | </cli> | ||
| + | |||
| + | ===== Check examples ===== | ||
| + | |||
| + | CPU | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=cpu --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' --warning=60 --critical=90 | ||
| + | OK: CPU Usage: 2.00% | 'cpu'=2%;0:60;0:90;0;100 | ||
| + | </cli> | ||
| + | |||
| + | Hardware | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=hardware --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' | ||
| + | OK: All 18 components are ok [17/17 sensors, 1/1 switch]. | 'sensor_SLOT #0: TEMP #1'=32celsius;;;; 'sensor_SLOT #0: TEMP #2'=33celsius;;;; 'sensor_SLOT #0: TEMP #3'=31celsius;;;; 'sensor_SLOT #0: TEMP #4'=29celsius;;;; 'sensor_SLOT #0: TEMP #5'=30celsius;;;; 'sensor_SLOT #0: TEMP #6'=33celsius;;;; 'sensor_SLOT #0: TEMP #7'=30celsius;;;; 'sensor_SLOT #0: TEMP #8'=40celsius;;;; 'sensor_SLOT #0: TEMP #9'=54celsius;;;; 'sensor_SLOT #0: TEMP #10'=23celsius;;;; 'sensor_SLOT #0: TEMP #11'=24celsius;;;; 'sensor_SLOT #0: TEMP #12'=45celsius;;;; 'sensor_FAN #1'=12821rpm;;;; 'sensor_FAN #2'=13071rpm;;;; 'count_sensor'=17;;;; 'count_switch'=1;;;; | ||
| + | </cli> | ||
| + | |||
| + | Memory | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=memory --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' --warning=60 --critical=90 | ||
| + | OK: Memory Usage: 27.00% used | 'used'=27%;0:60;0:90;0;100 | ||
| + | </cli> | ||
| + | |||
| + | Ports | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=interfaces --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' | ||
| + | CRITICAL: Interface 'FC port 0/19' Status : down (admin: up) - Interface 'FC port 0/23' Status : down (admin: up) - Interface 'FC port 0/28' Status : down (admin: up) - Interface 'FC port 0/29' Status : down (admin: up) - Interface 'FC port 0/33' Status : down (admin: up) - Interface 'FC port 0/35' Status : down (admin: up) | ||
| + | </cli> | ||
| + | |||
| + | Interfaces status | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=list-interfaces --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' | ||
| + | List interfaces: | ||
| + | 'FC port 0/4' [speed = 8000][status = up][id = 1073741828][type = fibreChannel] | ||
| + | 'FC port 0/5' [speed = 8000][status = up][id = 1073741829][type = fibreChannel] | ||
| + | 'FC port 0/6' [speed = 8000][status = up][id = 1073741830][type = fibreChannel] | ||
| + | 'FC port 0/7' [speed = 8000][status = up][id = 1073741831][type = fibreChannel] | ||
| + | </cli> | ||
| + | |||
| + | All interfaces, bypass errors | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=interfaces --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' --warning-status='' --critical-status='' | ||
| + | OK: All interfaces are ok | ||
| + | </cli> | ||
| + | |||
| + | Check Gbic optical strenght | ||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 plugins]$ perl ./centreon_brocade.pl --plugin=network::brocade::snmp::plugin --mode=interfaces --hostname=sansw1 --snmp-version='3' --snmp-username='test6' --authprotocol='MD5' --authpassphrase='myauthpassword' --privprotocol='DES' --privpassphrase='myprivpassword' --name --warning-status='' --critical-status='' --add-optical --add-status | sed 's/laser_temp_FC\ /#FC_/g' | tr '#' '\n' | ||
| + | OK: All interfaces are ok | ' | ||
| + | FC_port 0/4'=39.00C;;;; 'input_power_FC port 0/4'=-2.6dBm;;;; 'output_power_FC port 0/4'=-1.5dBm;;;; ' | ||
| + | FC_port 0/5'=41.00C;;;; 'input_power_FC port 0/5'=-1.6dBm;;;; 'output_power_FC port 0/5'=-2.1dBm;;;; ' | ||
| + | FC_port 0/6'=43.00C;;;; 'input_power_FC port 0/6'=-2.1dBm;;;; 'output_power_FC port 0/6'=-2.2dBm;;;; ' | ||
| + | FC_port 0/7'=42.00C;;;; 'input_power_FC port 0/7'=-3.3dBm;;;; 'output_power_FC port 0/7'=-2.1dBm;;;; ' | ||
| + | FC_port 0/8'=44.00C;;;; 'input_power_FC port 0/8'=-0.2dBm;;;; 'output_power_FC port 0/8'=-0.2dBm;;;; ' | ||
| + | FC_port 0/9'=45.00C;;;; 'input_power_FC port 0/9'=-2.4dBm;;;; 'output_power_FC port 0/9'=-1.1dBm;;;; ' | ||
| + | ... | ||
| + | FC_port 0/19'=43.00C;;;; 'output_power_FC port 0/19'=-1.1dBm;;;; ' | ||
| + | </cli> | ||
| + | |||
| + | Add this paragraph to your command.cfg in nagios | ||
| + | <code> | ||
| + | define command{ | ||
| + | command_name check_brocade_health | ||
| + | command_line $USER1$/centreon_brocade.sh -H $HOSTADDRESS$ -c $ARG1$ | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | <cli prompt='$'> | ||
| + | [nagios@nagsrv1 ~]$ cat /usr/lib64/nagios/plugins/centreon_brocade.sh | ||
| + | </cli> | ||
| + | <code> | ||
| + | #!/bin/bash | ||
| + | #@(#) Check SAN switch status | ||
| + | # Version 1.0 02-2023 EIF | ||
| + | |||
| + | while test -n "$1"; do | ||
| + | case "$1" in | ||
| + | -H) host=$2 | ||
| + | shift ;; | ||
| + | -c) element=$2 | ||
| + | shift ;; | ||
| + | esac | ||
| + | shift | ||
| + | done | ||
| + | |||
| + | #host=$1 | ||
| + | #element=$2 | ||
| + | |||
| + | warning=60 | ||
| + | critical=90 | ||
| + | |||
| + | snmpuser='test6' | ||
| + | snmpv='3' | ||
| + | authprot='MD5' | ||
| + | authpass='myauthpassword' | ||
| + | privprot='DES' | ||
| + | privpass='myprivpassword' | ||
| + | |||
| + | prog=/usr/lib64/nagios/plugins/centreon_brocade.pl | ||
| + | |||
| + | if [[ "${element}" == "cpu" ]] | ||
| + | then | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=${element} --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} --warning=60 --critical=90 | ||
| + | else | ||
| + | if [[ "${element}" == "hardware" ]] | ||
| + | then | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=${element} --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} | ||
| + | else | ||
| + | if [[ "${element}" == "memory" ]] | ||
| + | then | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=${element} --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} --warning=60 --critical=90 | ||
| + | else | ||
| + | if [[ "${element}" == "list-interfaces" ]] | ||
| + | then | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=${element} --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=interfaces --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} --name --warning-status='' --critical-status='' --add-optical --add-status | sed 's/laser_temp_FC\ /#FC_/g' | tr '#' '\n' | ||
| + | else | ||
| + | if [[ "${element}" == "interfaces" ]] | ||
| + | then | ||
| + | perl ${prog} --plugin=network::brocade::snmp::plugin --mode=${element} --hostname=${host} --snmp-version=${snmpv} --snmp-username=${snmpuser} --authprotocol=${authprot} --authpassphrase=${authpass} --privprotocol=${privprot} --privpassphrase=${privpass} | sed 's/FC\ port\ /FC_/g' | sed 's/\ //g' | sed 's/\]//g'| sed 's/\[/;/g' | sed "s/'//g" | sed "s/$/;$(date '+%s')/" | ||
| + | fi | ||
| + | fi | ||
| + | fi | ||
| + | fi | ||
| + | fi | ||
| + | </code> | ||