├── check_cifs ├── README └── nagios-okplugin-cifs.spec ├── check_dataprotector ├── README ├── nrpe.d │ └── check_dataprotector.cfg ├── check_dp_services ├── check_dp_idb ├── check_dp_tablespace.sh ├── check_dp_pool ├── check_dp_mountrequest ├── nagios-okplugin-check_dataprotector.spec └── check_dp_backups ├── check_brocade ├── README ├── examples │ ├── servicegroups.cfg │ ├── commands.cfg │ ├── hostgroups.cfg │ ├── contactgroups.cfg │ ├── hosts.cfg │ └── services.cfg └── nagios-okplugin-brocade.spec ├── check_emc_clariion ├── capacity.cli ├── status.cli └── checkcommands.cfg ├── rel-eng ├── packages │ ├── nagios-okplugin-bond │ ├── nagios-okplugin-check_eva │ ├── nagios-okplugin-check_rhcs │ ├── nagios-okplugin-check_snmp │ ├── nagios-okplugin-check_yum │ ├── nagios-okplugin-cifs │ ├── nagios-okplugin-ipa │ ├── nagios-plugins-check_cpu │ ├── nagios-okplugin-apc │ ├── nagios-okplugin-brocade │ ├── nagios-okplugin-check_drbd │ ├── nagios-okplugin-check_time │ ├── nagios-okplugin-crit2warn │ ├── nagios-okplugin-mailblacklist │ ├── nagios-okplugin-check_disks │ ├── nagios-okplugin-check_hpacucli │ ├── nagios-okplugin-check_hpasm │ ├── nagios-okplugin-check_ironport │ ├── nagios-okplugin-check_nagios │ ├── nagios-okplugin-check_updates │ ├── nagios-okplugin-check_uptime │ ├── nagios-okplugin-mssql │ ├── nagios-plugins-check_selinux │ ├── nagios-okplugin-check_multipath │ ├── nagios-okplugin-check_smssend │ ├── nagios-okplugin-check_vmware_wbem │ ├── nagios-okplugin-check_dataprotector │ ├── nagios-okplugin-check_http_multi │ ├── nagios-okplugin-check_ifoperstate │ ├── nagios-okplugin-check_xroad_token │ ├── nagios-okplugin-get_network_stat │ ├── nagios-okplugin-check_ibm_bladecenter │ ├── nagios-okplugin-check_msa_hardware │ ├── nagios-okplugin-check_linux_modules │ ├── nagios-okplugin-check_package_updates │ └── .readme ├── tito.props └── releasers.conf ├── check_apcext.pl ├── README └── nagios-okplugin-apc.spec ├── check_cpu.sh ├── nrpe.d │ └── check_cpu.cfg └── nagios-plugins-check_cpu.spec ├── check_smssend ├── README ├── nrpe.d │ └── check_smssend.cfg ├── nagios-okplugin-check_smssend.spec └── check_smssend ├── check_bond ├── README ├── nrpe.d │ └── check_bond.cfg ├── nagios-okplugin-bond.spec └── check_bond ├── check_drbd ├── nrpe.d │ └── check_drbd.cfg └── nagios-okplugin-check_drbd.spec ├── check_msa_hardware-pl ├── README.md ├── nrpe.d │ └── check_msa_hardware.cfg └── nagios-okplugin-check_msa.spec ├── check_uptime ├── nrpe.d │ └── check_uptime.cfg ├── nagios-okplugin-check_uptime.spec └── check_uptime.sh ├── check_hpasm ├── check_hpasm ├── nrpe.d │ └── check_hpasm.cfg ├── sudoers.d │ └── check_hpasm └── nagios-okplugin-check_hpasm.spec ├── check_yum ├── nrpe.d │ └── check_yum.cfg ├── sudoers.d │ └── check_yum └── nagios-okplugin-check_yum.spec ├── check_service.sh ├── nrpe.d │ └── check_service.cfg └── nagios-plugins-check_service.spec ├── check_cpu.py ├── nrpe.d │ └── okplugin_check_cpu.cfg ├── nagios-okplugin-check_cpu.spec └── okplugin_check_cpu ├── check_hpacucli ├── nrpe.d │ └── check_hpacucli.cfg ├── sudoers.d │ └── check_hpacucli ├── README └── nagios-okplugin-check_hpacucli.spec ├── check_hpssacli ├── nrpe.d │ └── check_hpssacli.cfg ├── sudoers.d │ └── check_hpssacli ├── nagios-okplugin-check_hpssacli.spec └── README ├── check_multipath ├── nrpe.d │ └── check_multipath.cfg ├── nagios-okplugin-check_multipath-0.0.3-1.el6.src.rpm ├── nagios-okplugin-check_multipath-0.0.3-1.el6.x86_64.rpm ├── README └── nagios-okplugin-check_multipath.spec ├── README.md ├── .gitignore ├── check_ipa ├── nrpe.d │ └── check_ipa.cfg ├── grant_anonymous_replication_view.ldif ├── README.md ├── nagios-okplugin-ipa.spec └── check_ipa_replication ├── check_ifoperstate ├── README.md ├── nagios-okplugin-check_ifoperstate.spec └── check_ifoperstate ├── check_firewall_active ├── nrpe.d │ └── check_firewall_active.cfg ├── sudoers.d │ └── check_firewall_active ├── check_firewall_active.sh └── nagios-okplugin-check_firewall_active.spec ├── check_eva ├── nrpe.d │ └── check_eva.cfg └── nagios-okplugin-check_eva.spec ├── check_xroad_token ├── nrpe.d │ └── check_xroad_token.cfg ├── sudoers.d │ └── check_xroad_token ├── readme.md ├── check_xroad_token.sh └── nagios-okplugin-check_xroad_token.spec ├── check_ibm_bladecenter ├── check_ibm_bladecenter_screenshot.png └── nagios-okplugin-check_ibm_bladecenter.spec ├── check_proc └── check_procs.sh ├── check_time ├── nrpe.d │ └── check_time.cfg ├── nagios-okplugin-check_time.spec └── check_time.sh ├── check_linux_modules.pl ├── nrpe.d │ └── check_module.cfg ├── check_linux_modules.spec └── check_linux_modules.pl ├── check_nagios ├── check_nagios_plugin_existance ├── nrpe.d │ └── check_nagios.cfg ├── check_nagios_needs_reload ├── check_nagios_configuration ├── check_nagios_ghostservices └── nagios-okplugin-check_nagios.spec ├── misc ├── check_ports ├── nagios_autodiscover ├── check_snmp_tcpconnection.sh ├── check_mssql_query.py └── check_oracle_query.py ├── check_kerb.sh ├── README └── check_kerb.sh ├── check_rhcs ├── check_rhcs_fence ├── nrpe.d │ └── check_rhcs.cfg ├── check_rhcs_manualfencing.sh ├── nagios-okplugin-check_rhcs.spec └── check_rhcs_cman_group.sh ├── check_package_updates ├── nrpe.d │ └── check_package_updates.cfg ├── nagios-okplugin-check_package_updates.spec ├── check_package_updates └── README.md ├── check_hparray └── check_hparray.cfg ├── check_other ├── README └── check_other ├── check_storwize ├── test.sh ├── nagios-okplugin-check_storwize.spec └── README.md ├── check_http_multi ├── README.md ├── nagios-okplugin-check_http_multi.spec └── check_http_multi ├── crit2warn.sh ├── nagios-okplugin-crit2warn.spec └── crit2warn.sh ├── nagios-okplugin-common └── nagios-okplugin-common.spec ├── check_cisco_qos └── check_cisco_qos.sh ├── okc-get_network_stat ├── nagios-okplugin-get_network_stat.spec └── okc-get_network_stat ├── check_vmware └── nagios-okplugin-check_vmware_wbem.spec ├── check_selinux ├── nagios-plugins-check_selinux.spec └── check_selinux ├── check_bl ├── README └── nagios-okplugin-mailblacklist.spec ├── check_ironport └── nagios-okplugin-check_ironport.spec ├── check_mtr └── check_mtr ├── check_disks.pl └── nagios-okplugin-check_disks.spec ├── check_snmp ├── nagios-okplugin-check_snmp.spec └── check_snmp_connectivity ├── check_http_ntlm └── check_http_ntlm.pl ├── check_exchange └── check_exchange_storagegroups.pl ├── check_windows_dfs.pl └── check_windows_dfs.pl ├── check_squid └── check_squid.pl └── check_lvm_mirror └── check_lvm_mirror.py /check_cifs/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /check_dataprotector/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /check_brocade/README: -------------------------------------------------------------------------------- 1 | check_brocade_env 2 | 3 | 4 | -------------------------------------------------------------------------------- /check_emc_clariion/capacity.cli: -------------------------------------------------------------------------------- 1 | show pool capacity 2 | quit 3 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-bond: -------------------------------------------------------------------------------- 1 | 0.0.4-1 check_bond/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_eva: -------------------------------------------------------------------------------- 1 | 2-1 check_eva/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_rhcs: -------------------------------------------------------------------------------- 1 | 1-1 check_rhcs/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_snmp: -------------------------------------------------------------------------------- 1 | 2-1 check_snmp/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_yum: -------------------------------------------------------------------------------- 1 | 1-1 check_yum/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-cifs: -------------------------------------------------------------------------------- 1 | 1.1-1 check_cifs/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-ipa: -------------------------------------------------------------------------------- 1 | 0.0.4-1 check_ipa/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-plugins-check_cpu: -------------------------------------------------------------------------------- 1 | 2-1 check_cpu.sh/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-apc: -------------------------------------------------------------------------------- 1 | 2.1.2-1 check_apcext.pl/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-brocade: -------------------------------------------------------------------------------- 1 | 0.0.5-1 check_brocade/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_drbd: -------------------------------------------------------------------------------- 1 | 0.0.4-1 check_drbd/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_time: -------------------------------------------------------------------------------- 1 | 1.0.3-1 check_time/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-crit2warn: -------------------------------------------------------------------------------- 1 | 0.0.2-1 crit2warn.sh/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-mailblacklist: -------------------------------------------------------------------------------- 1 | 1.1-1 check_bl/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_disks: -------------------------------------------------------------------------------- 1 | 1.0.7-1 check_disks.pl/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_hpacucli: -------------------------------------------------------------------------------- 1 | 2-1 check_hpacucli/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_hpasm: -------------------------------------------------------------------------------- 1 | 4.1.4-1 check_hpasm/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_ironport: -------------------------------------------------------------------------------- 1 | 2-1 check_ironport/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_nagios: -------------------------------------------------------------------------------- 1 | 1.2-1 check_nagios/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_updates: -------------------------------------------------------------------------------- 1 | 0.0.3-1 check_updates/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_uptime: -------------------------------------------------------------------------------- 1 | 1.0.3-1 check_uptime/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-mssql: -------------------------------------------------------------------------------- 1 | 0.0.7-1 check_mssql_health/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-plugins-check_selinux: -------------------------------------------------------------------------------- 1 | 1.3-1 check_selinux/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_multipath: -------------------------------------------------------------------------------- 1 | 0.0.3-1 check_multipath/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_smssend: -------------------------------------------------------------------------------- 1 | 0.0.11-1 check_smssend/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_vmware_wbem: -------------------------------------------------------------------------------- 1 | 1.0.1-1 check_vmware/ 2 | -------------------------------------------------------------------------------- /check_apcext.pl/README: -------------------------------------------------------------------------------- 1 | check_apcext.pl - APC Extra gear checks (netbotz/pdus) 2 | -------------------------------------------------------------------------------- /check_emc_clariion/status.cli: -------------------------------------------------------------------------------- 1 | show node detail all 2 | yes 3 | yes 4 | quit 5 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_dataprotector: -------------------------------------------------------------------------------- 1 | 2-1 check_dataprotector/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_http_multi: -------------------------------------------------------------------------------- 1 | 0.1.1-1 check_http_multi/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_ifoperstate: -------------------------------------------------------------------------------- 1 | 0.0.3-1 check_ifoperstate/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_xroad_token: -------------------------------------------------------------------------------- 1 | 1.2-1 check_xroad_token/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-get_network_stat: -------------------------------------------------------------------------------- 1 | 1.0.1-1 okc-get_network_stat/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_ibm_bladecenter: -------------------------------------------------------------------------------- 1 | 4-1 check_ibm_bladecenter/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_msa_hardware: -------------------------------------------------------------------------------- 1 | 1.0.5-1 check_msa_hardware-pl/ 2 | -------------------------------------------------------------------------------- /check_cpu.sh/nrpe.d/check_cpu.cfg: -------------------------------------------------------------------------------- 1 | command[check_cpu]=/usr/lib/nagios/plugins/check_cpu.sh 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_linux_modules: -------------------------------------------------------------------------------- 1 | 0.0.13-1 check_linux_modules.pl/ 2 | -------------------------------------------------------------------------------- /rel-eng/packages/nagios-okplugin-check_package_updates: -------------------------------------------------------------------------------- 1 | 0.0.7-1 check_package_updates/ 2 | -------------------------------------------------------------------------------- /check_smssend/README: -------------------------------------------------------------------------------- 1 | Few handy scripts to check if your modem is working properly with smssend 2 | -------------------------------------------------------------------------------- /check_bond/README: -------------------------------------------------------------------------------- 1 | check_bond 2 | 3 | Simple Nagios plugin that checks the status of bond devices 4 | -------------------------------------------------------------------------------- /check_drbd/nrpe.d/check_drbd.cfg: -------------------------------------------------------------------------------- 1 | command[check_drdb]=/usr/lib64/nagios/plugins/check_drbd -d All 2 | -------------------------------------------------------------------------------- /check_msa_hardware-pl/README.md: -------------------------------------------------------------------------------- 1 | Checks hardware status of MSA disk arrays also known as HP P2000 2 | -------------------------------------------------------------------------------- /check_uptime/nrpe.d/check_uptime.cfg: -------------------------------------------------------------------------------- 1 | command[check_uptime]=/usr/lib/nagios/plugins/check_uptime 2 | -------------------------------------------------------------------------------- /check_hpasm/check_hpasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opinkerfi/nagios-plugins/HEAD/check_hpasm/check_hpasm -------------------------------------------------------------------------------- /check_smssend/nrpe.d/check_smssend.cfg: -------------------------------------------------------------------------------- 1 | command[check_smssend]=/usr/lib64/nagios/plugins/check_smssend 2 | -------------------------------------------------------------------------------- /check_yum/nrpe.d/check_yum.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | command[check_updates]=sudo /usr/lib/nagios/plugins/check_yum 4 | -------------------------------------------------------------------------------- /check_hpasm/nrpe.d/check_hpasm.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | command[check_hpasm]=sudo /usr/lib/nagios/plugins/check_hpasm 4 | -------------------------------------------------------------------------------- /check_service.sh/nrpe.d/check_service.cfg: -------------------------------------------------------------------------------- 1 | command[check_service]=/usr/lib/nagios/plugins/check_service.sh 2 | -------------------------------------------------------------------------------- /check_cpu.py/nrpe.d/okplugin_check_cpu.cfg: -------------------------------------------------------------------------------- 1 | command[okplugin_check_cpu]=/usr/lib/nagios/plugins/okplugin_check_cpu 2 | -------------------------------------------------------------------------------- /check_hpacucli/nrpe.d/check_hpacucli.cfg: -------------------------------------------------------------------------------- 1 | command[check_hpacucli]=sudo /usr/lib/nagios/plugins/check_hpacucli.py 2 | 3 | -------------------------------------------------------------------------------- /check_hpssacli/nrpe.d/check_hpssacli.cfg: -------------------------------------------------------------------------------- 1 | command[check_hpssacli]=sudo /usr/lib/nagios/plugins/check_hpssacli.py 2 | 3 | -------------------------------------------------------------------------------- /check_multipath/nrpe.d/check_multipath.cfg: -------------------------------------------------------------------------------- 1 | command[check_multipath]=/usr/lib/nagios/plugins/check_multipath -n '$ARG1$' 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | nagios-plugins 2 | ============== 3 | 4 | Small army of nagios-plugins either made or maintained by opinkerfi 5 | -------------------------------------------------------------------------------- /check_msa_hardware-pl/nrpe.d/check_msa_hardware.cfg: -------------------------------------------------------------------------------- 1 | command[check_msa_hardware]=/usr/lib64/nagios/plugins/check_msa_hardware 2 | -------------------------------------------------------------------------------- /check_yum/sudoers.d/check_yum: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL = (root) NOPASSWD: /usr/lib/nagios/plugins/check_yum 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | .project 4 | .pydevproject 5 | .settings 6 | pagekite* 7 | .idea 8 | MANIFEST 9 | dist 10 | -------------------------------------------------------------------------------- /check_hpasm/sudoers.d/check_hpasm: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL = (root) NOPASSWD: /usr/lib/nagios/plugins/check_hpasm 3 | -------------------------------------------------------------------------------- /check_ipa/nrpe.d/check_ipa.cfg: -------------------------------------------------------------------------------- 1 | command[check_ipa_replication]=/usr/lib64/nagios/plugins/check_ipa_replication -u 'ldap://localhost' 2 | -------------------------------------------------------------------------------- /check_ifoperstate/README.md: -------------------------------------------------------------------------------- 1 | Checks the operator status of network interfaces 2 | 3 | Requires: 4 | 5 | The get_ifoperstate.sh script 6 | -------------------------------------------------------------------------------- /check_firewall_active/nrpe.d/check_firewall_active.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | command[check_firewall_active]=sudo /usr/lib64/nagios/plugins/check_firewall_active.sh 4 | -------------------------------------------------------------------------------- /check_hpacucli/sudoers.d/check_hpacucli: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpacucli.py 3 | -------------------------------------------------------------------------------- /check_hpssacli/sudoers.d/check_hpssacli: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_hpssacli.py 3 | -------------------------------------------------------------------------------- /check_brocade/examples/servicegroups.cfg: -------------------------------------------------------------------------------- 1 | define servicegroup { 2 | servicegroup_name brocade-san-switch-health 3 | alias Brocade SAN Switches - HEALTH 4 | } 5 | -------------------------------------------------------------------------------- /check_firewall_active/sudoers.d/check_firewall_active: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL = (root) NOPASSWD: /usr/lib64/nagios/plugins/check_firewall_active.sh 3 | -------------------------------------------------------------------------------- /check_eva/nrpe.d/check_eva.cfg: -------------------------------------------------------------------------------- 1 | command[check_eva]=python /usr/lib/nagios/plugins/check_eva.py --host "$ARG1$" --username "$ARG2$" --password "$ARG3$" --mode "$ARG4$" 2 | -------------------------------------------------------------------------------- /check_xroad_token/nrpe.d/check_xroad_token.cfg: -------------------------------------------------------------------------------- 1 | # xroad plugin to check for tokens 2 | command[check_xroad_token]=sudo -u xroad /usr/lib64/nagios/plugins/check_xroad_token.sh -------------------------------------------------------------------------------- /check_brocade/examples/commands.cfg: -------------------------------------------------------------------------------- 1 | define command { 2 | command_name check_brocade_san_env 3 | command_line $USER1$/check_brocade_env -H $HOSTADDRESS$ -c public -l 4 | } 5 | -------------------------------------------------------------------------------- /check_ibm_bladecenter/check_ibm_bladecenter_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opinkerfi/nagios-plugins/HEAD/check_ibm_bladecenter/check_ibm_bladecenter_screenshot.png -------------------------------------------------------------------------------- /check_bond/nrpe.d/check_bond.cfg: -------------------------------------------------------------------------------- 1 | command[check_bond]=/usr/lib64/nagios/plugins/check_bond -i '$ARG1$' 2 | 3 | command[check_bond_bond0]=/usr/lib64/nagios/plugins/check_bond -i bond0 4 | -------------------------------------------------------------------------------- /check_proc/check_procs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LINE=`/usr/lib64/nagios/plugins/check_procs $*` 3 | RC=$? 4 | COUNT=`echo $LINE | awk '{print $3}'` 5 | echo $LINE \| procs=$COUNT 6 | exit $RC 7 | -------------------------------------------------------------------------------- /check_multipath/nagios-okplugin-check_multipath-0.0.3-1.el6.src.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opinkerfi/nagios-plugins/HEAD/check_multipath/nagios-okplugin-check_multipath-0.0.3-1.el6.src.rpm -------------------------------------------------------------------------------- /rel-eng/packages/.readme: -------------------------------------------------------------------------------- 1 | the rel-eng/packages directory contains metadata files 2 | named after their packages. Each file has the latest tagged 3 | version and the project's relative directory. 4 | -------------------------------------------------------------------------------- /check_multipath/nagios-okplugin-check_multipath-0.0.3-1.el6.x86_64.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opinkerfi/nagios-plugins/HEAD/check_multipath/nagios-okplugin-check_multipath-0.0.3-1.el6.x86_64.rpm -------------------------------------------------------------------------------- /rel-eng/tito.props: -------------------------------------------------------------------------------- 1 | [globalconfig] 2 | default_builder = tito.builder.Builder 3 | default_tagger = tito.tagger.VersionTagger 4 | changelog_do_not_remove_cherrypick = 0 5 | changelog_format = %s (%ae) 6 | -------------------------------------------------------------------------------- /check_xroad_token/sudoers.d/check_xroad_token: -------------------------------------------------------------------------------- 1 | Defaults:nrpe !requiretty 2 | nrpe ALL = (xroad) NOPASSWD: /usr/bin/signer-console list-tokens, /usr/lib64/nagios/plugins/check_xroad_token.sh 3 | -------------------------------------------------------------------------------- /check_time/nrpe.d/check_time.cfg: -------------------------------------------------------------------------------- 1 | 2 | # Connect to a remote host via nrpe and check time 3 | # warning and critical are in seconds 4 | command[check_time]=/usr/lib/nagios/plugins/check_time.sh -H '$ARG1$' -w '$ARG2$' -c '$ARG3$' 5 | -------------------------------------------------------------------------------- /check_linux_modules.pl/nrpe.d/check_module.cfg: -------------------------------------------------------------------------------- 1 | command[check_module]=/usr/lib64/nagios/plugins/check_linux_modules.pl '$ARG1$' 2 | 3 | command[check_module_qla2xxx]=/usr/lib64/nagios/plugins/check_linux_modules.pl kernel/drivers/scsi/qla2xxx/qla2xxx.ko 4 | -------------------------------------------------------------------------------- /check_nagios/check_nagios_plugin_existance: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys,os 4 | sys.path.append('/opt/pynag') 5 | from pynag import Model 6 | 7 | all_commands = Model.Command.objects.all 8 | for c in all_commands: 9 | print c.command_line 10 | 11 | -------------------------------------------------------------------------------- /check_xroad_token/readme.md: -------------------------------------------------------------------------------- 1 | # Required steps to use this check 2 | 3 | ```shell 4 | # On RHEL/Centos 5 | sudo semanage permissive -a nrpe_t 6 | sudo setsebool -P nagios_run_sudo 1 7 | sudo yum install nagios-okplugin-check_xroad_token -y 8 | sudo systemctl restart nrpe 9 | ``` 10 | -------------------------------------------------------------------------------- /misc/check_ports: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | HOST=$1 4 | 5 | 6 | PORTS="3389 22 80 445 5666 1433"; 7 | 8 | for i in $PORTS; do 9 | check_tcp -H $HOST -p $i >/dev/null 2>&1 && echo Port $i=yes || echo Port $i=no 10 | done 11 | echo -n "Checking NRPE Connectivity: " 12 | check_nrpe -H $HOST 13 | -------------------------------------------------------------------------------- /check_multipath/README: -------------------------------------------------------------------------------- 1 | = check_multipath = 2 | Checks the status of Linux Devicemapper Multipath devices 3 | 4 | == Download == 5 | You can get check_multipath directly from our subversion repo [http://opensource.is/trac/browser/nagios-plugins/check_multipath here] 6 | 7 | == Blame == 8 | Rikki. 9 | 10 | -------------------------------------------------------------------------------- /check_kerb.sh/README: -------------------------------------------------------------------------------- 1 | check_kerb.sh is a simple way of checking kerberos login using a configured 2 | kerberos host (/etc/krb5.conf) 3 | 4 | Usage: check_kerb.sh 5 | 6 | Can use default realm like this: 7 | check_kerb.sh tommi mypass 8 | 9 | or with realm: 10 | check_kerb.sh tommi@OK mypass 11 | -------------------------------------------------------------------------------- /check_ipa/grant_anonymous_replication_view.ldif: -------------------------------------------------------------------------------- 1 | dn: cn="dc=mr,dc=lan",cn=mapping tree,cn=config 2 | changetype: modify 3 | add: aci 4 | aci: (targetattr=*)(targetfilter="(|(objectclass=nsds5replicationagreement)(objectclass=nsDSWindowsReplicationAgreement))")(version 3.0; aci "permission:Read Replication Agreements"; allow (read, search, compare) groupdn = "ldap:///anyone";) 5 | -------------------------------------------------------------------------------- /check_rhcs/check_rhcs_fence: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | 5 | OK=0 6 | WARNING=1 7 | CRITICAL=2 8 | UNKNOWN=3 9 | 10 | STATUS=$UNKNOWN 11 | 12 | OUTPUT=`fence_tool ls | grep "wait state" | awk '{ print $3}' ` 13 | 14 | if [ "$OUTPUT" = "none" ]; then 15 | STATUS=$OK 16 | fi 17 | 18 | 19 | echo "Fence wait state (fence_tool ls) is: $OUTPUT" 20 | exit $STATUS 21 | 22 | 23 | -------------------------------------------------------------------------------- /check_package_updates/nrpe.d/check_package_updates.cfg: -------------------------------------------------------------------------------- 1 | # Critical on security updates, warning if 40 or more total updates 2 | command[check_package_updates]=/usr/lib64/nagios/plugins/check_package_updates --legacy 3 | 4 | # Critical on security updates 5 | command[check_package_updates_security]=/usr/lib64/nagios/plugins/check_package_updates --th "metric=security,critical=1..inf" --legacy 6 | -------------------------------------------------------------------------------- /check_hparray/check_hparray.cfg: -------------------------------------------------------------------------------- 1 | command[check_hpraid_slot1]=/usr/lib64/nagios/plugins/check_hparray -s 1 2 | command[check_hpraid_slot2]=/usr/lib64/nagios/plugins/check_hparray -s 2 3 | command[check_hpraid_slot3]=/usr/lib64/nagios/plugins/check_hparray -s 3 4 | command[check_hpraid_slot4]=/usr/lib64/nagios/plugins/check_hparray -s 4 5 | command[check_hpraid]=/usr/lib64/nagios/plugins/check_hparray --all 6 | -------------------------------------------------------------------------------- /check_nagios/nrpe.d/check_nagios.cfg: -------------------------------------------------------------------------------- 1 | command[check_nagios_configuration]=/usr/lib64/nagios/plugins/check_nagios_configuration 2 | command[check_nagios_ghostservices]=/usr/lib64/nagios/plugins/check_nagios_ghostservices 3 | command[check_nagios_needs_reload]=/usr/lib64/nagios/plugins/check_nagios_needs_reload 4 | command[check_nagios_plugin_existance]=/usr/lib64/nagios/plugins/check_nagios_plugin_existance 5 | -------------------------------------------------------------------------------- /check_dataprotector/nrpe.d/check_dataprotector.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | command[check_dp_pool]=/usr/lib/nagios/plugins/check_dp_pool "$ARG1$" 4 | command[check_dp_tablespace]=/usr/lib/nagios/plugins/check_dp_tablespace 5 | command[check_dp_services]=/usr/lib/nagios/plugins/check_dp_services 6 | command[check_dp_mountrequest]=/usr/lib/nagios/plugins/check_dp_mountrequest 7 | command[check_dp_idb]=/usr/lib/nagios/plugins/check_dp_idb 8 | command[check_dp_backups]=/usr/lib/nagios/plugins/check_dp_backups 9 | -------------------------------------------------------------------------------- /check_xroad_token/check_xroad_token.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | xroad_list_tokens=$(signer-console list-tokens) 3 | 4 | if [[ $xroad_list_tokens == "Token: 0 (OK, writable, available, active)" ]] 5 | then 6 | echo "OK - $xroad_list_tokens" 7 | exit 0 8 | elif [[ $xroad_list_tokens != "Token: 0 (OK, writable, available, active)" ]] 9 | then 10 | echo "Critical - $xroad_list_tokens" 11 | exit 2 12 | else 13 | echo "Unknown - $xroad_list_tokens" 14 | exit 3 15 | fi -------------------------------------------------------------------------------- /check_firewall_active/check_firewall_active.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | EXIT_OK=0 4 | EXIT_WARN=1 5 | EXIT_CRIT=2 6 | 7 | PATH=/sbin:/usr/sbin:$PATH 8 | 9 | if [ "$(id -u)" != "0" ]; then 10 | echo "This script must be run as root" 1>&2 11 | exit $EXIT_CRIT 12 | fi 13 | 14 | blocks=$(iptables -L -v -n | egrep 'REJECT|DROP' | wc -l) 15 | 16 | if [ $blocks -eq 0 ]; then 17 | echo "CRITICAL: No firewall detected" 18 | exit $EXIT_CRIT 19 | fi 20 | 21 | echo "OK: Firewall is active" 22 | exit $EXIT_OK 23 | 24 | -------------------------------------------------------------------------------- /check_emc_clariion/checkcommands.cfg: -------------------------------------------------------------------------------- 1 | define command{ 2 | command_name check_emc_sp 3 | command_line $USER1$/check_emc_clariion.pl -H $HOSTADDRESS$ -t sp --sp $ARG1$ 4 | } 5 | define command{ 6 | command_name check_emc_disk 7 | command_line $USER1$/check_emc_clariion.pl -H $HOSTADDRESS$ -t disk 8 | } 9 | define command{ 10 | command_name check_emc_port 11 | command_line $USER1$/check_emc_clariion.pl -H $HOSTADDRESS$ -t portstate --port $ARG1$ 12 | } 13 | -------------------------------------------------------------------------------- /check_other/README: -------------------------------------------------------------------------------- 1 | check_other 2 | =========== 3 | 4 | This plugin is designed to execute another plugin that is given as an argument. 5 | 6 | Usually you want this to use the perfdata parsing of pynag and you want to alert on specific thresholds in the other plugin. 7 | 8 | Usage: 9 | ``` 10 | check_other -- check_nrpe -H localhost -c check_load 11 | 12 | # Same as above, but alert on performance metric load1 13 | check_other --threshold metric=load1,warn=2..inf -- check_nrpe -H localhost -c check_load 14 | ``` 15 | -------------------------------------------------------------------------------- /check_nagios/check_nagios_needs_reload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Checks if nagios service needs a reload 3 | 4 | import sys 5 | try: 6 | from pynag.Parsers import config 7 | 8 | c = config(cfg_file='/etc/nagios/nagios.cfg') 9 | c.parse() 10 | result = c.needs_reload() 11 | 12 | if result == True: 13 | print "Warning - Nagios configuration has changed since last restart" 14 | sys.exit(1) 15 | else: 16 | print "OK - Nagios service has been restarted since last config change" 17 | sys.exit(0) 18 | except Exception, e: 19 | print "Unknown - Error running script: %s" % e 20 | sys.exit(3) 21 | -------------------------------------------------------------------------------- /check_brocade/examples/hostgroups.cfg: -------------------------------------------------------------------------------- 1 | define hostgroup { 2 | hostgroup_name brocade-san-switches 3 | alias Brocade SAN Switches 4 | } 5 | 6 | define hostgroup { 7 | hostgroup_name brocade-dev-san-switches 8 | alias Brocade Development SAN Switches 9 | } 10 | 11 | define hostgroup { 12 | hostgroup_name brocade-test-san-switches 13 | alias Brocade Test SAN Switches 14 | } 15 | 16 | define hostgroup { 17 | hostgroup_name brocade-prod-san-switches 18 | alias Brocade Production SAN Switches 19 | } 20 | 21 | -------------------------------------------------------------------------------- /check_ipa/README.md: -------------------------------------------------------------------------------- 1 | check_ipa_replication 2 | ===================== 3 | You need some configuration for this plugin to have access to replication 4 | information. 5 | 6 | Allow anonymous read to replication information 7 | ----------------------------------------------- 8 | You will need to do this for every IPA server, masters and replicas 9 | 10 | ``` 11 | ldapmodify -x -D "cn=directory manager" -W -f grant_anonymous_replication_view.ldif -h ipa-host.example.com 12 | ``` 13 | 14 | Configure the directory manager credentials 15 | ------------------------------------------- 16 | NOT RECOMENDED, you can use -D and -w with the directory manager credentials 17 | and the plugin will work as expected. 18 | 19 | 20 | -------------------------------------------------------------------------------- /check_brocade/examples/contactgroups.cfg: -------------------------------------------------------------------------------- 1 | define contactgroup { 2 | contactgroup_name brocade-prod-contacts 3 | alias Brocade Production Contacts 4 | } 5 | 6 | define contactgroup { 7 | contactgroup_name brocade-dev-contacts 8 | alias Brocade Development Contacts 9 | } 10 | 11 | define contactgroup { 12 | contactgroup_name brocade-test-contacts 13 | alias Brocade Test Contacts 14 | } 15 | 16 | define contactgroup { 17 | contactgroup_name brocade-contacts 18 | alias Brocade Development Contacts 19 | } 20 | 21 | -------------------------------------------------------------------------------- /check_storwize/test.sh: -------------------------------------------------------------------------------- 1 | CURRENT_PATH=`pwd` 2 | cd $CURRENT_PATH/tests/ok 3 | tests=`echo * | sed 's/.txt//g'` 4 | for i in $tests ; do 5 | command="python $CURRENT_PATH/check_storwize.py --test -H testhost -U nagios -Q $i" 6 | $command > /dev/null 2>&1 7 | RESULT=$? 8 | if [ $RESULT -ne 0 ]; then 9 | echo "FAIL" 10 | echo "cd `pwd`" 11 | echo "Command: $command" 12 | else 13 | echo "$i working as expected" 14 | fi 15 | done 16 | 17 | 18 | cd $CURRENT_PATH/tests/critical 19 | tests=`echo * | sed 's/.txt//g'` 20 | for i in $tests ; do 21 | command="python $CURRENT_PATH/check_storwize.py --test -H testhost -U nagios -Q $i" 22 | $command > /dev/null 2>&1 23 | RESULT=$? 24 | if [ $RESULT -ne 2 ]; then 25 | echo "FAIL" 26 | echo "cd `pwd`" 27 | echo "Command: $command" 28 | else 29 | echo "$i working as expected" 30 | fi 31 | done 32 | 33 | 34 | -------------------------------------------------------------------------------- /check_brocade/examples/hosts.cfg: -------------------------------------------------------------------------------- 1 | define host { 2 | name generic-brocade-dev-san-switch 3 | 4 | use generic-server 5 | 6 | statusmap_image base/switch40.gd2 7 | icon_image base/switch40.png 8 | 9 | contact_groups +brocade-dev-contacts 10 | hostgroups +brocade-san-switches,brocade-dev-san-switches 11 | } 12 | 13 | define host { 14 | name generic-brocade-prod-san-switch 15 | 16 | use generic-server 17 | 18 | statusmap_image base/switch40.gd2 19 | icon_image base/switch40.png 20 | 21 | contact_groups +brocade-prod-contacts 22 | hostgroups +brocade-san-switches,brocade-prod-san-switches 23 | } 24 | 25 | define host { 26 | name generic-brocade-test-san-switch 27 | 28 | use generic-server 29 | 30 | statusmap_image base/switch40.gd2 31 | icon_image base/switch40.png 32 | 33 | contact_groups +brocade-test-contacts 34 | hostgroups +brocade-san-switches,brocade-test-san-switches 35 | } 36 | 37 | -------------------------------------------------------------------------------- /check_nagios/check_nagios_configuration: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | PERFDATA="" 5 | MESSAGE="Nagios configuration is valid" 6 | EXIT_CODE=3 7 | 8 | TMPFILE=`mktemp` 9 | trap "rm -f $TMPFILE" EXIT 10 | nagios -v /etc/nagios/nagios.cfg > $TMPFILE 11 | RESULT=$? 12 | 13 | # grep -E '^\s+Checked' 14 | warnings=`grep -c -E "^Warning:" "$TMPFILE"` 15 | errors=`grep -c -E "^Error:" "$TMPFILE"` 16 | PERFDATA="warnings=$warnings errors=$errors" 17 | 18 | 19 | # If there are any warnings 20 | if [ $warnings -gt 0 ]; then 21 | MESSAGE="nagios.cfg has $warnings warnings" 22 | EXIT_CODE=1 23 | fi 24 | 25 | 26 | # If nagios -v fails. Config is invalid 27 | if [ $RESULT -gt 0 ]; then 28 | MESSAGE="Could not validate Nagios configuration." 29 | EXIT_CODE=2 30 | fi 31 | 32 | if [ $EXIT_CODE -eq "3" ]; then 33 | EXIT_CODE=0 34 | fi 35 | 36 | echo "$MESSAGE | $PERFDATA" 37 | grep -E "^Error|^Warning" "$TMPFILE" 38 | rm -f $TMPFILE 39 | exit $EXIT_CODE 40 | -------------------------------------------------------------------------------- /check_rhcs/nrpe.d/check_rhcs.cfg: -------------------------------------------------------------------------------- 1 | command[check_rhcs]=sudo /usr/lib64/nagios/plugins/check_rhcs -c 2 | command[check_rhcs_service]=sudo /usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$' 3 | command[check_rhcs_service_frozen]=sudo /usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$' -Z 4 | 5 | command[get_rhcs_fencing]=test ! -p /tmp/fence_manual.fifo 6 | command[check_rhcs_fencing]=/usr/lib64/nagios/plugins/check_rhcs_manualfencing.sh 7 | 8 | 9 | command[get_rhcs_cman_group]=/sbin/group_tool ls '$ARG1$' '$ARG2$' 10 | command[get_rhcs_cman_group_default]=/sbin/group_tool ls 0 default 11 | command[get_rhcs_cman_group_rgmanager]=/sbin/group_tool ls 1 rgmanager 12 | 13 | 14 | command[check_rhcs_cman_group]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level '$ARG1$' --group '$ARG2$' 15 | command[check_rhcs_cman_group_default]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level 0 --group default 16 | command[check_rhcs_cman_group_rgmanager]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level 1 --group rgmanager 17 | 18 | 19 | # RHEL 6 specific 20 | command[check_rhcs6_fencing]=/usr/lib64/nagios/plugins/check_rhcs_fence 21 | 22 | -------------------------------------------------------------------------------- /check_http_multi/README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | Check http multi was created to check multiple websites in one plugin. You can check the following: 4 | 5 | * Latency per website 6 | * Overall runtime of http requests (serial) 7 | * Number of failed websites 8 | * Percentage of failed websites 9 | 10 | 11 | How 12 | === 13 | 14 | Check Percentage Failed 15 | ----------------------- 16 | Here we check http://www.google.com and http://adagios.org 17 | 18 | Failure rates of 19 | * 0%-30% are ok 20 | * 30%-60% are warning 21 | * everything above is critical 22 | 23 | ``` 24 | $ check_http_multi -u http://www.google.com -u http://adagios.org/ \ 25 | --th metric=failed_percentage,warning=30..60,critical=60..inf 26 | Checked 2 uris, 0 failed | 'http://www.google.com'=0.24s;;;; 'http://adagios.org/'=0.47s;;;; 'failed'=0;;;; 'failed_percentage'=0.0%;30..60;60..inf;; 'runtime'=0.711745977402s;;;; 27 | http://www.google.com fetched in 0.24 seconds 28 | http://adagios.org/ fetched in 0.47 seconds 29 | ``` 30 | 31 | 32 | 33 | Author 34 | ====== 35 | Tomas Edwardsson 36 | 37 | 38 | License 39 | ======= 40 | GPLv3 or later 41 | -------------------------------------------------------------------------------- /check_kerb.sh/check_kerb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2010, Tomas Edwardsson 4 | # 5 | # check_kerb.sh is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # check_kerb.sh is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | 19 | KRBUSER=$1 20 | KRBPASS=$2 21 | 22 | if [ -z $KRBPASS ]; then 23 | echo "Usage $0 " 24 | exit 3 25 | fi 26 | 27 | OUT=`echo $KRBPASS | kinit "$KRBUSER" 2>&1` 28 | if [ $? -gt 0 ]; then 29 | echo "Unable to initiate kerberos session: $OUT" 30 | exit 2 31 | else 32 | echo "Kerberos session initiated: $OUT" 33 | /usr/kerberos/bin/kdestroy &> /dev/null 34 | exit 0 35 | fi 36 | 37 | 38 | -------------------------------------------------------------------------------- /crit2warn.sh/nagios-okplugin-crit2warn.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin wrapper that changes critical to warnings 4 | Name: nagios-okplugin-crit2warn 5 | Version: 0.0.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Crit2warn 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/crit2warn/releases/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | 15 | 16 | %description 17 | Modifies critical return code of plugins to warning 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 crit2warn.sh %{buildroot}%{_libdir}/nagios/plugins/crit2warn.sh 28 | 29 | %clean 30 | rm -rf %{buildroot} 31 | 32 | %files 33 | %defattr(-,root,root,-) 34 | %{_libdir}/nagios/plugins/* 35 | 36 | %changelog 37 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 38 | - new package built with tito 39 | 40 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 41 | - Initial packaging 42 | -------------------------------------------------------------------------------- /crit2warn.sh/crit2warn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2010, Tomas Edwardsson 4 | # 5 | # crit2warn.sh is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # crit2warn.sh is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # crit2warn.sh is a wrapper for Nagios checks that changes the return 19 | # code for checks from CRITICAL to WARNING 20 | CMD="" 21 | 22 | # Quote arguments 23 | while (( "$#" > 0 )); do 24 | ARG=$1 25 | shift 26 | CMD="$CMD $(echo "$ARG" | awk '{gsub(".", "\\\\&");print}')" 27 | done 28 | 29 | # Run command 30 | eval "$CMD" 31 | ret=$? 32 | 33 | 34 | # Change return CRITICAL to WARNING 35 | if [ $ret == 2 ]; then 36 | ret=1 37 | fi 38 | 39 | exit $ret 40 | 41 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_services: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # This process checks if HP Dataprotector is up and running with the 21 | # omnisv command. Issues a warning if not all services are up 22 | 23 | /opt/omni/sbin/omnisv -status | grep "Status: All Data Protector relevant processes/services up and running." 24 | 25 | RESULT=$? 26 | 27 | if [ $RESULT -gt 0 ]; then 28 | echo "Critical, some Data Protector services are in stopped state" 29 | exit 1 30 | fi 31 | 32 | 33 | -------------------------------------------------------------------------------- /nagios-okplugin-common/nagios-okplugin-common.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A common package for the okplugin suite 4 | Name: nagios-okplugin-common 5 | Version: 1.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/ 10 | Source0: https://github.com/opinkerfi/nagios-plugins/archive/%{name}-%{version}-%{release}.tar.gz 11 | Requires: nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | %description 17 | Common utilities for okplugins 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | mkdir -m 0770 -p %{buildroot}%{_sharedstatedir}/nagios-okplugin 28 | 29 | %clean 30 | rm -rf %{buildroot} 31 | 32 | %post 33 | 34 | %files 35 | %defattr(-,root,root,-) 36 | %dir %attr(0770, nrpe, nrpe) %{_sharedstatedir}/nagios-okplugin 37 | 38 | %changelog 39 | * Mon Jan 20 2014 Tomas Edwardsson 1.2-1 40 | - 41 | 42 | * Mon Jan 20 2014 Tomas Edwardsson 1.1-1 43 | - new package built with tito 44 | 45 | * Mon Jan 20 2014 Tomas Edwardsson 1.0-1 46 | - Initial build 47 | -------------------------------------------------------------------------------- /misc/nagios_autodiscover: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | IPS=`fping -a -g $1 2>/dev/null` 5 | if [ $? -gt 2 ]; then 6 | echo failed to run fping 7 | exit 1 8 | fi 9 | 10 | #addgroup --group misc --alias "Misc hosts" 11 | 12 | check_port() { 13 | hostname=$1 14 | port=$2 15 | check_tcp -H $hostname -p $port > /dev/null 2>&1 16 | if [ $? -eq 0 ]; then 17 | return 0 18 | fi 19 | return 1 20 | } 21 | 22 | is_windows() { 23 | hostname=$1 24 | check_port $hostname 3389 > /dev/null 2>&1 25 | return $? 26 | } 27 | 28 | is_linux() { 29 | hostname=$1 30 | check_port $hostname 22 31 | return $? 32 | } 33 | 34 | 35 | for ip in $IPS; do 36 | 37 | # Check if ip is just fping garbage output 38 | echo $ip | grep -Eq '\[|\]' 39 | if [ $? -eq 0 ]; then 40 | continue 41 | fi 42 | # Check if this host already exists 43 | 44 | grep -qw "$ip" /var/log/nagios/objects.cache > /dev/null 2>&1 45 | if [ $? -eq 0 ]; then 46 | continue 47 | fi 48 | RES=`host $ip` 49 | if [ $? -gt 0 ]; then 50 | HOSTN=$ip 51 | else 52 | HOSTN=`echo $RES | head -n 1 | sed 's/.*name pointer //' | sed 's/\.$//'` 53 | fi 54 | echo $ip = $HOSTN `is_windows $HOSTN` `is_linux $HOSTN` 55 | #addhost --host $HOSTN --ip $ip --group misc --templates autodiscover 56 | done 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /check_cisco_qos/check_cisco_qos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ./check_cisco_qos.pl -H 10.18.0.114 -C KB816af -w 10 -c 20 -i ALL -m Call_Signaling 4 | 5 | PATH=$PATH:/usr/lib/nagios/plugins/:/usr/lib64/nagios/plugins/:/nagios/usr/lib/nagios/plugins 6 | which check_cisco_qos.pl > /dev/null 7 | if [ $? -gt 0 ]; then 8 | echo "Unknown check_cisco_qos.pl not found in path" 9 | exit 3 10 | fi 11 | 12 | CLASSES=`check_cisco_qos.pl $@ -i ALL -m ALL -d | grep qos-class| awk '{ print $6 }'` 13 | NUM_CLASSES=`echo $CLASSES |wc -w` 14 | if [ $NUM_CLASSES -lt 1 ]; then 15 | echo "Error running check_cisco_qos.pl" 16 | echo "Command was: check_cisco_qos.pl $@ -i ALL -m ALL -d" 17 | exit 3 18 | fi 19 | 20 | EXIT_CODE=0 21 | for i in $CLASSES ; do 22 | TMP=`check_cisco_qos.pl $@ -i ALL -m $i` 23 | STATUS=$? 24 | if [ $STATUS -gt $EXIT_CODE ]; then 25 | EXIT_CODE=$STATUS 26 | fi 27 | SUMMARY="$SUMMARY $i" 28 | PERF=`echo $TMP | awk -F \| '{print $2 }' | sed "s/Sent/${i}_Sent/" | sed "s/Dropped/${i}_Dropped/"` 29 | PERFDATA="$PERFDATA $PERF" 30 | done 31 | 32 | 33 | test $EXIT_CODE == 0 && SUMMARY="OK - $SUMMARY" 34 | test $EXIT_CODE == 1 && SUMMARY="WARNING - $SUMMARY" 35 | test $EXIT_CODE == 2 && SUMMARY="CRITICAL - $SUMMARY" 36 | echo "$SUMMARY | $PERFDATA" 37 | exit $EXIT_CODE 38 | -------------------------------------------------------------------------------- /check_http_multi/nagios-okplugin-check_http_multi.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin check_http_multi 3 | 4 | Summary: A Nagios plugin to check multiple websites 5 | Name: nagios-okplugin-%{plugin} 6 | Version: 0.1.1 7 | Release: 1%{?dist} 8 | License: GPLv3+ 9 | Group: Applications/System 10 | URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin} 11 | Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz 12 | Requires: nagios-okconfig-nrpe >= 0.0.4 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Tomas Edwardsson 15 | BuildArch: noarch 16 | 17 | 18 | %description 19 | Checks multiple websites for latency and failures. You can specify how many 20 | of them will fail to return warning or critical state. 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 31 | 32 | %clean 33 | rm -rf %{buildroot} 34 | 35 | %files 36 | %defattr(-,root,root,-) 37 | %doc README.md 38 | %{_libdir}/nagios/plugins/* 39 | 40 | %changelog 41 | * Thu Jun 06 2013 Tomas Edwardsson 0.1.1-1 42 | - new package built with tito 43 | 44 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_idb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # This script checks for the latest IDB backup of HP Dataprotector 21 | # If latest backup is more than $WARNING days old, issue a warning 22 | 23 | WARNING=5 24 | CRITICAL=2 25 | 26 | 27 | /opt/omni/bin/omnirpt -tab -report obj_lastbackup -days -$WARNING | grep -w IDB > /dev/null 28 | RESULT=$? 29 | 30 | 31 | if [ $RESULT -gt 0 ]; then 32 | echo "Warning, Last Dataprotector backup is more than $WARNING days old" 33 | exit 1 34 | fi 35 | 36 | echo "Last Dataprotector backup is less than $WARNING days old" 37 | 38 | -------------------------------------------------------------------------------- /okc-get_network_stat/nagios-okplugin-get_network_stat.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to get network statistics over NRPE 4 | Name: nagios-okplugin-get_network_stat 5 | Version: 1.0.1 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/okc-get_network_stat 10 | Source0: https://github.com/opinkerfi/nagios-plugins/okc-get_network_stat/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins-nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to get network statistics over NRPE 20 | 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 okc-get_network_stat %{buildroot}%{_libdir}/nagios/plugins/okc-get_network_stat 31 | 32 | %clean 33 | rm -rf %{buildroot} 34 | 35 | %files 36 | %defattr(-,root,root,-) 37 | #%doc README LICENSE 38 | #%{_libdir}/nagios/plugins/* 39 | %{_libdir}/nagios/plugins/okc-get_network_stat 40 | 41 | %changelog 42 | * Wed Apr 02 2014 Tomas Edwardsson 1.0.1-1 43 | - new package built with tito 44 | 45 | * Wed Apr 2 2014 Tomas Edwardsson 1.0.0-1 46 | - Initial release 47 | -------------------------------------------------------------------------------- /check_ifoperstate/nagios-okplugin-check_ifoperstate.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin check_ifoperstate 3 | 4 | Summary: A Nagios plugin to check interface operator status 5 | Name: nagios-okplugin-%{plugin} 6 | Version: 0.0.3 7 | Release: 1%{?dist} 8 | License: GPLv2+ 9 | Group: Applications/System 10 | URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin} 11 | Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz 12 | Requires: nagios-okconfig-nrpe >= 0.0.4 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Tomas Edwardsson 15 | BuildArch: noarch 16 | 17 | 18 | %description 19 | Checks the operator status of network interfaces 20 | 21 | %prep 22 | %setup -q 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 30 | 31 | %clean 32 | rm -rf %{buildroot} 33 | 34 | %files 35 | %defattr(-,root,root,-) 36 | %doc README.md 37 | %{_libdir}/nagios/plugins/* 38 | 39 | %changelog 40 | * Wed Jun 05 2013 Tomas Edwardsson 0.0.3-1 41 | - Rename ifoperstate (tommi@tommi.org) 42 | 43 | * Wed Jun 05 2013 Tomas Edwardsson 0.0.2-1 44 | - new package built with tito 45 | 46 | -------------------------------------------------------------------------------- /check_vmware/nagios-okplugin-check_vmware_wbem.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check VMWare 3.x or 4.x via WBEM 4 | Name: nagios-okplugin-check_vmware_wbem 5 | Version: 1.0.1 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_vmware_wbem 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpacucli/releases/nagios-okplugin-check_vmware_wbem-%{version}.tar.gz 11 | Requires: pywbem 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | 15 | 16 | %description 17 | A Nagios plugin to check VMWare 3.x or 4.x via WBEM 18 | 19 | %prep 20 | %setup -q 21 | #perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg 22 | 23 | %build 24 | 25 | 26 | %install 27 | rm -rf %{buildroot} 28 | install -D -p -m 0755 check_vmware_wbem %{buildroot}%{_libdir}/nagios/plugins/check_vmware_wbem 29 | 30 | %clean 31 | rm -rf %{buildroot} 32 | 33 | %files 34 | %defattr(-,root,root,-) 35 | #%doc README LICENSE 36 | %{_libdir}/nagios/plugins/* 37 | #/etc/nrpe.d/check_hpacucli.cfg 38 | 39 | %changelog 40 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 41 | - new package built with tito 42 | 43 | * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 44 | - Initial packaging 45 | -------------------------------------------------------------------------------- /check_nagios/check_nagios_ghostservices: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | TMP=`mktemp` 3 | EPOCH_HOUR_AGO=$(( $(date +%s) - 3600 )) 4 | 5 | exit_unknown() { 6 | msg="$1" 7 | 8 | echo "${msg}" 9 | exit 3 10 | } 11 | 12 | find_nagios_log() { 13 | # Try to locate the nagios log, fallback to messages log 14 | for log in /var/log/nagios/nagios.log /var/log/nagios3/nagios.log /var/spool/nagios/nagios.log \ 15 | /usr/local/nagios/var/nagios.log 16 | do 17 | if [ -e "${log}" ]; then 18 | echo ${log} 19 | return 0 20 | fi 21 | done 22 | return 3 23 | } 24 | 25 | LOG=$(find_nagios_log) || exit_unknown "Unable to locate logfile for parsing" 26 | 27 | tail -n 1 ${LOG} &> ${TMP} || exit_unknown "Unable to parse logfile: $(cat ${TMP})" 28 | tail -n 2000 ${LOG} | \ 29 | awk "BEGIN { FS=\"[\\\\[\\\\]]\" } \$2 > ${EPOCH_HOUR_AGO} {print \$0}" | \ 30 | grep "Passive check result was received" | \ 31 | grep -i "could not be found" | \ 32 | sed 's/.*Passive check result was received for service //' | \ 33 | sed 's/, but the host could not be found.*//' | \ 34 | sort | uniq > $TMP 35 | 36 | 37 | LINES=`cat $TMP | wc -l` 38 | PERFDATA="'ghost_services'=$LINES" 39 | if [ $LINES -gt 0 ]; then 40 | echo "$LINES ghost services found in Nagios log files | $PERFDATA" 41 | echo "" 42 | cat $TMP 43 | rm -f $TMP 44 | exit 1 45 | fi 46 | 47 | echo "No ghost services found in Nagios log files | $PERFDATA" 48 | rm -f $TMP 49 | exit 0 50 | 51 | -------------------------------------------------------------------------------- /check_selinux/nagios-plugins-check_selinux.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check SELinux status on Linux servers 4 | Name: nagios-plugins-check_selinux 5 | Version: 1.3 6 | Release: 1%{?dist} 7 | License: GPLv3+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/tree/master/check_selinux 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_selinux/releases/nagios-plugins-check_selinux-%{version}.tar.gz 11 | Requires: nagios-plugins-nrpe libselinux-utils 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | %description 17 | This plugin check the enforcing selinux status of a specified host, using NRPE 18 | if the host is remote. 19 | 20 | %prep 21 | %setup -q 22 | 23 | %build 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 check_selinux %{buildroot}%{_libdir}/nagios/plugins/check_selinux 28 | 29 | %clean 30 | rm -rf %{buildroot} 31 | 32 | %files 33 | %defattr(-,root,root,-) 34 | %{_libdir}/nagios/plugins/* 35 | 36 | 37 | %changelog 38 | * Thu Feb 20 2014 Pall Sigurdsson 1.3-1 39 | - 40 | 41 | * Thu Feb 20 2014 Pall Sigurdsson 42 | - 43 | 44 | * Wed May 22 2013 Tomas Edwardsson 1.1-1 45 | - new package built with tito 46 | 47 | * Wed May 22 2013 Tomas Edwardsson 1.0-1 48 | - Initial packaging 49 | -------------------------------------------------------------------------------- /check_service.sh/nagios-plugins-check_service.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check services on Linux servers 4 | Name: nagios-plugins-check_service 5 | Version: 0 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/jonschipp/nagios-plugins/blob/master/check_service.sh 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_service/releases/nagios-plugins-check_service-%{version}.tar.gz 11 | Requires: nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Gardar Thorsteinsson 14 | BuildArch: noarch 15 | 16 | %description 17 | Check status of system services for Linux, FreeBSD, OSX, and AIX. 18 | 19 | %prep 20 | %setup -q 21 | perl -pi -e "s|/usr/lib/|%{_libdir}/|g" nrpe.d/check_service.cfg 22 | perl -pi -e "s|/usr/lib64/|%{_libdir}/|g" nrpe.d/check_service.cfg 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_service.sh %{buildroot}%{_libdir}/nagios/plugins/check_service.sh 30 | install -D -p -m 0755 nrpe.d/check_service.cfg %{buildroot}/etc/nrpe.d/check_service.cfg 31 | 32 | %clean 33 | rm -rf %{buildroot} 34 | 35 | %post 36 | /sbin/service nrpe reload 37 | 38 | %files 39 | %defattr(-,root,root,-) 40 | #%doc README LICENSE 41 | %{_libdir}/nagios/plugins/* 42 | /etc/nrpe.d/check_service.cfg 43 | 44 | 45 | %changelog 46 | * Tue Apr 21 2020 0.1-1 47 | - Initial packaging 48 | 49 | -------------------------------------------------------------------------------- /check_hpssacli/nagios-okplugin-check_hpssacli.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check HP Array with hpssacli 4 | Name: nagios-okplugin-check_hpssacli 5 | Version: 1.1 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_hpssacli 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpssacli/releases/nagios-okplugin-check_hpssacli-%{version}.tar.gz 11 | Requires: hpssacli 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Gardar Thorsteinsson 14 | 15 | 16 | %description 17 | Checks HP Array with hpssacli 18 | 19 | %prep 20 | %setup -q 21 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpssacli.cfg 22 | perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/* 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_hpssacli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpssacli.py 30 | install -D -p -m 0755 nrpe.d/check_hpssacli.cfg %{buildroot}/etc/nrpe.d/check_hpssacli.cfg 31 | install -D -p -m 0440 sudoers.d/check_hpssacli %{buildroot}/etc/sudoers.d/check_hpssacli 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc README LICENSE 39 | %{_libdir}/nagios/plugins/* 40 | /etc/nrpe.d/check_hpssacli.cfg 41 | /etc/sudoers.d/check_hpssacli 42 | 43 | %changelog 44 | * Fri Jun 14 2019 Gardar Thorsteinsson 1.1 45 | - Initial packaging 46 | -------------------------------------------------------------------------------- /check_multipath/nagios-okplugin-check_multipath.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check Linux Devicemapper Multipathing 4 | Name: nagios-okplugin-check_multipath 5 | Version: 0.0.3 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_multipath 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_multipath/releases/nagios-okplugin-check_multipath-%{version}.tar.gz 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 12 | Packager: Richard Allen 13 | 14 | 15 | %description 16 | Checks Linux Devicemapper Multipath devices 17 | 18 | %prep 19 | %setup -q 20 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_multipath.cfg 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 check_multipath %{buildroot}%{_libdir}/nagios/plugins/check_multipath 28 | install -D -p -m 0755 nrpe.d/check_multipath.cfg %{buildroot}/etc/nrpe.d/check_multipath.cfg 29 | 30 | %clean 31 | rm -rf %{buildroot} 32 | 33 | %files 34 | %defattr(-,root,root,-) 35 | %doc README LICENSE 36 | %{_libdir}/nagios/plugins/* 37 | /etc/nrpe.d/check_multipath.cfg 38 | 39 | %changelog 40 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.3-1 41 | - 42 | 43 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 44 | - new package built with tito 45 | 46 | * Wed Feb 22 2012 Richard Allen 0.1-1 47 | - Initial packaging 48 | -------------------------------------------------------------------------------- /check_smssend/nagios-okplugin-check_smssend.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugins to check if /var/spool/smssend/incoming has any new messages 4 | Name: nagios-okplugin-check_smssend 5 | Version: 0.0.11 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_smssend 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{name}-%{version}.tar.gz 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 12 | Packager: Pall Sigurdsson 13 | 14 | 15 | %description 16 | A Nagios plugins to check if /var/spool/smssend/incoming has any new messages 17 | 18 | %prep 19 | %setup -q 20 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_smssend.cfg 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 check_smssend %{buildroot}%{_libdir}/nagios/plugins/check_smssend 28 | install -D -p -m 0755 nrpe.d/check_smssend.cfg %{buildroot}/etc/nrpe.d/check_smssend.cfg 29 | 30 | %clean 31 | rm -rf %{buildroot} 32 | 33 | %files 34 | %defattr(-,root,root,-) 35 | %doc LICENSE 36 | %{_libdir}/nagios/plugins/* 37 | /etc/nrpe.d/check_smssend.cfg 38 | 39 | %changelog 40 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.11-1 41 | - license added (palli@opensource.is) 42 | 43 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.10-1 44 | - 45 | 46 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.9-1 47 | - new package built with tito 48 | 49 | -------------------------------------------------------------------------------- /check_bl/README: -------------------------------------------------------------------------------- 1 | Nagios check_bl plugin (C)Copyright 2005 Bashton Ltd 2 | ---------------------------------------------------- 3 | 4 | A Nagios plugin to check whether a server is in any known anti-spam 5 | blocklists. Licensed under the GNU GPL v2.0 or later (at your option). For 6 | full copyright and warranty details, please see the COPYING file included in 7 | this package. 8 | 9 | By Sam Bashton, Bashton Ltd - sam@bashton.com www.bashton.com 10 | 11 | Comments, bug reports etc are welcome. 12 | 13 | Pre-Requisites 14 | -------------- 15 | 16 | - Working Nagios install 17 | - Perl 5 (tested with Perl 5.6.1 and 5.8) 18 | - Net::DNS Perl library and associated dependencies 19 | 20 | Installation 21 | ------------ 22 | 23 | - Copy to your nagios plugins directory (possibly /usr/lib/nagios/plugins) 24 | - Add the following to your checkcommands.cfg: 25 | 26 | define command{ 27 | command_name check_bl 28 | command_line $USER1$/check_bl -H $HOSTADDRESS$ -B sbl-xbl.spamhaus.or 29 | g,bl.spamcop.net,t1.dnsbl.net.au 30 | } 31 | 32 | - Alter your services.cfg to include a check against the check_bl command 33 | 34 | Variables 35 | --------- 36 | 37 | check_bl requires the following variables: 38 | 39 | -H host : Hostname to check 40 | -B blacklist1,blacklist2 : Comma separated list of blacklists to check against 41 | 42 | The following optional variable is also available: 43 | 44 | -c critnum : Number of blacklists the server must be listed in before the status is 'critical'. By default, any listing is regarded as critical. 45 | -------------------------------------------------------------------------------- /check_brocade/nagios-okplugin-brocade.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check Brocade devices 4 | Name: nagios-okplugin-brocade 5 | Version: 0.0.5 6 | Release: 2%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_brocade/releases/nagios-okplugin-brocade-%{version}.tar.gz 11 | Requires: perl-Nagios-Plugin 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Gardar Thorsteinsson 14 | 15 | 16 | %description 17 | Checks Brocade devices 18 | 19 | %prep 20 | %setup -q 21 | perl -pi -e "s|/usr/lib|%{_libdir}|g" check_brocade_env 22 | 23 | %global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\) 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_brocade_env %{buildroot}%{_libdir}/nagios/plugins/check_brocade_env 31 | 32 | %clean 33 | rm -rf %{buildroot} 34 | 35 | %files 36 | %defattr(-,root,root,-) 37 | %doc README LICENSE 38 | %{_libdir}/nagios/plugins/* 39 | 40 | %changelog 41 | * Fri May 09 2018 Gardar Thorsteinsson 0.0.5-2 42 | - filter out perl-utils dep 43 | 44 | * Thu Feb 20 2014 Pall Sigurdsson 0.0.5-1 45 | - 46 | 47 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.4-1 48 | - new package built with tito 49 | 50 | * Mon Nov 21 2010 Tomas Edwardsson 0.0.3-1 51 | - Initial packaging 52 | -------------------------------------------------------------------------------- /check_ironport/nagios-okplugin-check_ironport.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check Cisco Ironport 4 | Name: nagios-okplugin-check_ironport 5 | Version: 2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/ 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_ironport/releases/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | BuildArch: noarch 15 | Requires: nrpe 16 | 17 | 18 | %description 19 | Checks the health status of a Cisco Ironport 20 | 21 | %prep 22 | %setup -q 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_ironport.py %{buildroot}%{_libdir}/nagios/plugins/check_ironport.py 30 | 31 | %clean 32 | rm -rf %{buildroot} 33 | 34 | %files 35 | %defattr(-,root,root,-) 36 | %{_libdir}/nagios/plugins/* 37 | #%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg 38 | 39 | %changelog 40 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 41 | - Merge branch 'master' of https://opensource.ok.is/git/misc 42 | (palli@opensource.is) 43 | 44 | * Tue Jul 31 2012 Pall Sigurdsson 1.1.4-1 45 | - initial packaging for nagios-okplugin-check_ironport (palli@opensource.is) 46 | 47 | * Tue Jul 31 2012 Pall Sigurdsson 1.1.3-1 48 | - new package built with tito 49 | 50 | 51 | * Tue Jul 31 2012 Pall Sigurdsson 1.0.0-1 52 | - Initial packaging 53 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_tablespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # This script checks the tablespaces of HP dataprotector with the 21 | # omnirpt -report db_size command. Issues a warning if database 22 | # free space is running out 23 | 24 | 25 | #/opt/omni/bin/omnirpt -report db_size 26 | 27 | echo $USER > /tmp/check_dp_tablespace.debug 28 | echo $@ >> /tmp/check_dp_tablespace.debug 29 | 30 | 31 | OUTPUT=$(/opt/omni/bin/omnirpt -report db_size) 32 | RESULT=$? 33 | 34 | if [ $RESULT -gt 0 ]; then 35 | echo -n $OUTPUT 36 | exit 1 37 | fi 38 | echo $OUTPUT | grep -q "No database devices with low disk space." 39 | 40 | RESULT=$? 41 | 42 | if [ $RESULT -gt 0 ]; then 43 | echo "Warning - Some dataprotector tablespaces are running low" 44 | exit 1 45 | else 46 | echo "OK - No database devices with low disk space." 47 | exit 0 48 | fi 49 | 50 | -------------------------------------------------------------------------------- /check_storwize/nagios-okplugin-check_storwize.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin check_storwize 3 | %define packager Pall Sigurdsson 4 | 5 | Summary: A Nagios plugin to check status of a storwize disk array 6 | Name: nagios-okplugin-%{plugin} 7 | Version: 1.0.0 8 | Release: 1%{?dist} 9 | License: GPLv3+ 10 | Group: Applications/System 11 | URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin} 12 | Source0: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}/releases/%{name}-%{version}.tar.gz 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: %{packager} 15 | BuildArch: noarch 16 | Requires: pynag 17 | 18 | 19 | %description 20 | Checks updates via PackageKit and can notify on various different situations 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 31 | mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 32 | sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/%{plugin}.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/%{plugin}.cfg 33 | # Temporary fix for selinux 34 | chcon system_u:object_r:nagios_unconfined_plugin_exec_t:s0 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 35 | 36 | %clean 37 | rm -rf %{buildroot} 38 | 39 | %post 40 | /sbin/service nrpe status &> /dev/null && /sbin/service nrpe reload || : 41 | 42 | %files 43 | %defattr(-,root,root,-) 44 | %doc README.md 45 | %{_libdir}/nagios/plugins/* 46 | %config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg 47 | 48 | %changelog 49 | * Fri Dec 6 2013 Pall Sigurdsson 1.0.0-1 50 | - Initial Packaging 51 | -------------------------------------------------------------------------------- /check_time/nagios-okplugin-check_time.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to compare time on remote host with localhost 4 | Name: nagios-okplugin-check_time 5 | Version: 1.0.3 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_time 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_time/releases/nagios-okplugin-check_time-%{version}.tar.gz 11 | Requires: nagios-nrpe 12 | Requires: bc 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Pall Sigurdsson 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to compare time on remote host with localhost 20 | 21 | 22 | %prep 23 | %setup -q 24 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_time.cfg 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_time.sh %{buildroot}%{_libdir}/nagios/plugins/check_time.sh 32 | install -D -p -m 0755 nrpe.d/check_time.cfg %{buildroot}/etc/nrpe.d/check_time.cfg 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | #%doc README LICENSE 40 | %{_libdir}/nagios/plugins/* 41 | /etc/nrpe.d/check_time.cfg 42 | 43 | %changelog 44 | * Fri Apr 04 2014 Tomas Edwardsson 1.0.3-1 45 | - check_time - Added requirement for bc (tommi@tommi.org) 46 | 47 | * Tue Mar 25 2014 Tomas Edwardsson 1.0.2-1 48 | - Bump version 49 | 50 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 51 | - new package built with tito 52 | 53 | * Thu Nov 25 2010 Pall Sigurdsson 0.1-1 54 | - Initial packaging 55 | -------------------------------------------------------------------------------- /check_bl/nagios-okplugin-mailblacklist.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check SMTP blacklists 4 | Name: nagios-okplugin-mailblacklist 5 | Version: 1.1 6 | Release: 2%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-MailBlacklist 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bl/releases/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | Requires: nagios-plugins-perl 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Gardar Thorsteinsson 15 | BuildArch: noarch 16 | 17 | 18 | %description 19 | Checks DNS Blacklists for existance of hosts 20 | 21 | %prep 22 | %setup -q 23 | perl -pi -e "s|/usr/lib|%{_libdir}|g" check_bl 24 | 25 | %global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\) 26 | 27 | %build 28 | 29 | 30 | %install 31 | rm -rf %{buildroot} 32 | install -D -p -m 0755 check_bl %{buildroot}%{_libdir}/nagios/plugins/check_bl 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | %doc README COPYING 40 | %{_libdir}/nagios/plugins/* 41 | 42 | %changelog 43 | * Fri May 04 2018 Richard Allen 1.1-2 44 | - Filter out perl-utils dependancy 45 | 46 | * Thu Feb 20 2014 Pall Sigurdsson 1.1-1 47 | - 48 | 49 | * Thu Aug 23 2012 Pall Sigurdsson 1.0-1 50 | - Updated buildarch to noarch (tommi@tommi.org) 51 | 52 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 53 | - new package built with tito 54 | 55 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 56 | - Initial packaging 57 | -------------------------------------------------------------------------------- /misc/check_snmp_tcpconnection.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2010, Pall Sigurdsson 3 | # 4 | # This script is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This script is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | # About this script 18 | # 19 | # This script will check for established TCP connection via SNMP 20 | 21 | 22 | 23 | 24 | LOCAL_HOST=$1 25 | LOCAL_PORT=$2 26 | COMMUNITY=$3 27 | REMOTE_HOST=$4 28 | REMOTE_PORT=$5 29 | 30 | if [ -z $REMOTE_HOST ]; then 31 | echo "Usage: $0 " 32 | exit 3 33 | fi 34 | 35 | OUTPUT=`/usr/bin/snmpwalk -v 2c -c $COMMUNITY $LOCAL_HOST TCP-MIB::tcpConnState.$LOCAL_HOST.$LOCAL_PORT.$REMOTE_HOST | grep -q established` 36 | RESULT=$? 37 | 38 | if [ $RESULT -gt 0 ]; then 39 | echo "TCP Connection from $REMOTE_HOST to $LOCAL_HOST:$LOCAL_PORT found" 40 | echo "command:" 41 | echo "/usr/bin/snmpwalk -v 2c -c $COMMUNITY $LOCAL_HOST TCP-MIB::tcpConnState.$LOCAL_HOST.$LOCAL_PORT.$REMOTE_HOST" 42 | echo "OUTPUT: " 43 | echo "$OUTPUT" 44 | exit 1 45 | fi 46 | 47 | echo "TCP Connection from $REMOTE_HOST to $LOCAL_HOST:$LOCAL_PORT found" 48 | exit 0 49 | -------------------------------------------------------------------------------- /check_uptime/nagios-okplugin-check_uptime.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check uptime of a remote host via NRPE 4 | Name: nagios-okplugin-check_uptime 5 | Version: 1.0.3 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_uptime 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_uptime/releases/nagios-okplugin-check_uptime-%{version}.tar.gz 11 | Requires: nagios-nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | 15 | 16 | 17 | %description 18 | A Nagios plugin to check uptime of a remote host via NRPE 19 | 20 | 21 | %prep 22 | %setup -q 23 | perl -pi -e "s|/usr/lib/|%{_libdir}/|g" nrpe.d/check_uptime.cfg 24 | perl -pi -e "s|/usr/lib64/|%{_libdir}/|g" nrpe.d/check_uptime.cfg 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_uptime.sh %{buildroot}%{_libdir}/nagios/plugins/check_uptime.sh 32 | install -D -p -m 0755 nrpe.d/check_uptime.cfg %{buildroot}/etc/nrpe.d/check_uptime.cfg 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | #%doc README LICENSE 40 | %{_libdir}/nagios/plugins/* 41 | /etc/nrpe.d/check_uptime.cfg 42 | 43 | %changelog 44 | * Sun Apr 13 2014 Tomas Edwardsson 1.0.3-1 45 | - Update tag 46 | 47 | * Mon Dec 30 2013 Tomas Edwardsson 1.0.2-1 48 | - Updated tag for build with newer tito 49 | 50 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 51 | - new package built with tito 52 | 53 | * Thu Nov 25 2010 Pall Sigurdsson 0.1-1 54 | - Initial packaging 55 | -------------------------------------------------------------------------------- /check_linux_modules.pl/check_linux_modules.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugins to check if a specific linux module exists 4 | Name: nagios-okplugin-check_linux_modules 5 | Version: 0.0.13 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_smssend 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{name}-%{version}.tar.gz 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 12 | Packager: Pall Sigurdsson 13 | 14 | 15 | %description 16 | A Nagios plugins to check if a specific linux module exists 17 | 18 | %prep 19 | %setup -q 20 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_module.cfg 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 check_linux_modules.pl %{buildroot}%{_libdir}/nagios/plugins/check_linux_modules.pl 28 | install -D -p -m 0755 nrpe.d/check_module.cfg %{buildroot}/etc/nrpe.d/check_module.cfg 29 | 30 | %clean 31 | rm -rf %{buildroot} 32 | 33 | %files 34 | %defattr(-,root,root,-) 35 | %doc LICENSE 36 | %{_libdir}/nagios/plugins/* 37 | /etc/nrpe.d/check_module.cfg 38 | 39 | %changelog 40 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.13-1 41 | - typo in plugin name fixed (palli@opensource.is) 42 | 43 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.12-1 44 | - new package built with tito 45 | 46 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.11-1 47 | - license added (palli@opensource.is) 48 | 49 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.10-1 50 | - 51 | 52 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.9-1 53 | - new package built with tito 54 | 55 | -------------------------------------------------------------------------------- /check_cpu.py/nagios-okplugin-check_cpu.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check CPU on Linux servers 4 | Name: nagios-okplugin-check_cpu 5 | Version: 1.1 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/ 10 | Source0: https://github.com/opinkerfi/nagios-plugins/archive/%{name}-%{version}-%{release}.tar.gz 11 | Requires: nagios-okplugin-common 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | %description 17 | Check cpu states on line machines 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 okplugin_check_cpu %{buildroot}%{_libdir}/nagios/plugins/okplugin_check_cpu 28 | install -D -p -m 0755 nrpe.d/okplugin_check_cpu.cfg %{buildroot}/etc/nrpe.d/okplugin_check_cpu.cfg 29 | 30 | 31 | %clean 32 | rm -rf %{buildroot} 33 | 34 | %post 35 | /sbin/service nrpe reload 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | %{_libdir}/nagios/plugins/* 40 | %{_sysconfdir}/nrpe.d/* 41 | 42 | 43 | 44 | %changelog 45 | * Mon Jan 20 2014 Tomas Edwardsson 1.1-1 46 | - new package built with tito 47 | 48 | * Thu Aug 23 2012 Pall Sigurdsson 1.0-1 49 | - Version number bumped 50 | - Updates buildarch to noarch (tommi@tommi.org) 51 | 52 | * Mon Mar 12 2012 Pall Sigurdsson 0.3-1 53 | - new package built with tito 54 | 55 | * Thu Nov 25 2010 Pall Sigurdsson 0.1-2 56 | - Nrpe config now ships with plugin by default 57 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 58 | - Initial packaging 59 | 60 | -------------------------------------------------------------------------------- /check_other/check_other: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # This script runs whatever command is printed on the command line 3 | # Usage: 4 | # ./check_other -- someotherplugin --arguments-for-the-other-plugin 5 | # 6 | # Example: 7 | # ./check_other -- check_nrpe -H localhost 8 | # 9 | # If you want to provide options to check_other (for example to enforce a threshold: 10 | # ./check_other --threshold=load1,warn=5..inf -- check_nrpe -H localhost check_load 11 | 12 | 13 | import subprocess 14 | import sys 15 | 16 | from pynag.Plugins import PluginHelper 17 | from pynag.Utils import runCommand, PluginOutput, PerfData 18 | 19 | p = PluginHelper() 20 | 21 | p.parser.add_option('--string', dest='string', help='run this command (will be shell expanded, use quotes)') 22 | p.parse_arguments() 23 | 24 | 25 | # --string was provided 26 | if p.options.string: 27 | return_code, stdout, stderr = runCommand(p.options.string) 28 | # No --string, and no arguments on the command line 29 | elif not p.arguments: 30 | p.parser.error("You need to provide an external command as an argument. Try: %s ls" % sys.argv[0]) 31 | # some arguments were provided 32 | else: 33 | try: 34 | proc = subprocess.Popen(p.arguments, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,) 35 | stdout, stderr = proc.communicate('through stdin to stdout') 36 | return_code = proc.returncode 37 | except Exception, e: 38 | p.set_summary("Failed to execute '%s': %s " % (p.arguments[0], e)) 39 | p.status(3) 40 | p.exit() 41 | 42 | p.status(return_code) 43 | other = PluginOutput(stdout) 44 | 45 | p.set_summary(other.summary) 46 | p.set_long_output(other.long_output) 47 | p._perfdata = PerfData(other.perfdata) 48 | 49 | p.check_all_metrics() 50 | p.exit() 51 | -------------------------------------------------------------------------------- /check_hpasm/nagios-okplugin-check_hpasm.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check HP Hardware Status 4 | Name: nagios-okplugin-check_hpasm 5 | Version: 4.1.4 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_hpasm 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpasm/releases/nagios-okplugin-check_hpasm-%{version}.tar.gz 11 | Requires: nagios-okconfig-nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | BuildArch: noarch 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to check HP Hardware Status 20 | 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | perl -pi -e "s|/usr/lib|%{_libdir}|g" sudoers.d/check_hpasm 27 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpasm.cfg 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_hpasm %{buildroot}%{_libdir}/nagios/plugins/check_hpasm 32 | install -D -p -m 0440 sudoers.d/check_hpasm %{buildroot}/etc/sudoers.d/check_hpasm 33 | install -D -p -m 0644 nrpe.d/check_hpasm.cfg %{buildroot}/etc/nrpe.d/check_hpasm.cfg 34 | 35 | 36 | %clean 37 | rm -rf %{buildroot} 38 | 39 | %files 40 | %defattr(-,root,root,-) 41 | #%doc README LICENSE 42 | #%{_libdir}/nagios/plugins/* 43 | %{_libdir}/nagios/plugins/check_hpasm 44 | /etc/sudoers.d/check_hpasm 45 | /etc/nrpe.d/check_hpasm.cfg 46 | 47 | %changelog 48 | * Fri Oct 03 2014 Tomas Edwardsson 4.1.4-1 49 | - hpasm invalid nrpe check command name (tommi@tommi.org) 50 | 51 | * Thu May 15 2014 Tomas Edwardsson 4.1.3-1 52 | - new package built with tito 53 | 54 | * Tue Jun 4 2013 Pall Sigurdsson 4.1.2-1 55 | - Initial packaging 56 | -------------------------------------------------------------------------------- /check_xroad_token/nagios-okplugin-check_xroad_token.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check status of XROAD soft-token 4 | Name: nagios-okplugin-check_xroad_token 5 | Version: 1.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/issues 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_xroad_token/releases/nagios-okplugin-check_xroad_token-%{version}.tar.gz 11 | Requires: nagios-nrpe 12 | Requires: xroad-signer 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Gardar Thorsteinsson 15 | 16 | 17 | %description 18 | A Nagios plugin to check status of XROAD soft-token 19 | 20 | 21 | %prep 22 | %setup -q 23 | #perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/check_xroad_token.cfg 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_xroad_token.sh %{buildroot}%{_libdir}/nagios/plugins/check_xroad_token.sh 31 | install -D -p -m 0755 nrpe.d/check_xroad_token.cfg %{buildroot}/etc/nrpe.d/check_xroad_token.cfg 32 | install -D -p -m 0644 sudoers.d/check_xroad_token %{buildroot}/etc/sudoers.d/check_xroad_token 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | #%doc README LICENSE 40 | %{_libdir}/nagios/plugins/* 41 | /etc/nrpe.d/check_xroad_token.cfg 42 | /etc/sudoers.d/check_xroad_token 43 | 44 | %post 45 | restorecon -v %{_libdir}/nagios/plugins/check_xroad_token.sh /etc/nrpe.d/check_xroad_token.cfg /etc/sudoers.d/check_xroad_token 46 | 47 | %changelog 48 | * Mon Sep 14 2020 Your Name 1.2-1 49 | - new package built with tito 50 | 51 | * Fri Sep 11 2020 Gardar Thorsteinsson 1.0.1-1 52 | - Initial packaging 53 | -------------------------------------------------------------------------------- /check_bond/nagios-okplugin-bond.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check network bond devices 4 | Name: nagios-okplugin-bond 5 | Version: 0.0.4 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Bond 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_bond/releases/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | Requires: nrpe 16 | 17 | 18 | %description 19 | Checks the network bond device on a Linux machine 20 | 21 | %prep 22 | %setup -q 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_bond %{buildroot}%{_libdir}/nagios/plugins/check_bond 30 | mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 31 | sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/check_bond.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/check_bond.cfg 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc README 39 | %{_libdir}/nagios/plugins/* 40 | %config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg 41 | 42 | %changelog 43 | * Thu Feb 20 2014 Pall Sigurdsson 0.0.4-1 44 | - Merge pull request #5 from pallvalmundsson/check_yum_security_patch (palli- 45 | github@minor.is) 46 | 47 | * Wed Mar 13 2013 Pall Sigurdsson 0.0.3-1 48 | - 49 | 50 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 51 | - new package built with tito 52 | 53 | * Sun Oct 16 2011 Tomas Edwardsson 0.1-2 54 | - Added configuration into package 55 | 56 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 57 | - Initial packaging 58 | -------------------------------------------------------------------------------- /check_hpacucli/README: -------------------------------------------------------------------------------- 1 | = check_hpacucli = 2 | Checks the raid status on a HP Array using hpacucli. to check the following: 3 | 4 | * Controller Status 5 | * Controller Cache Status 6 | * Logical disk health (raid status) 7 | * Physical disk health 8 | 9 | == Download == 10 | check_hpacucli.py depends on the hpacucli binary which comes with the HP Proliant Support Pack (PSP). The PSP can be downloaded [http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack here]. 11 | 12 | You can get check_hpacucly.py directly from our subversion repo [http://opensource.is/trac/browser/nagios-plugins/check_hpacucli/trunk here] 13 | 14 | == help page == 15 | {{{ 16 | # python check_hpacucli.py --help 17 | check_hpacucli version 1.0 18 | This plugin checks HP Array with the hpacucli command 19 | 20 | Usage: check_hpacucli.py 21 | Usage: check_hpacucli.py [--help] 22 | Usage: check_hpacucli.py [--version] 23 | Usage: check_hpacucli.py [--path ] 24 | Usage: check_hpacucli.py [--no-perfdata] 25 | Usage: check_hpacucli.py [--no-longoutput] 26 | 27 | 28 | }}} 29 | 30 | == Example output == 31 | {{{ 32 | # ./check_hparray --all 33 | OK - Found 1 controllers, 2 logicaldisks. 8 physicaldisks. | 34 | 35 | Smart Array P400 in Slot 1 36 | - Controller Status: OK (sn: P61620F9VV6FX2) 37 | - Cache Status: OK (sn: PA82C0H9VV4695) 38 | 39 | Checking logical Disks: 40 | - Logical Drive: 1 (/boot 101 MB) = OK 41 | - Logical Drive: 2 (None) = OK 42 | 43 | Checking Physical Disks: 44 | - physicaldrive 2I:1:1, SAS, 146 GB = OK 45 | - physicaldrive 2I:1:2, SAS, 146 GB = OK 46 | - physicaldrive 1I:1:5, SAS, 146 GB = OK 47 | - physicaldrive 1I:1:6, SAS, 146 GB = OK 48 | - physicaldrive 1I:1:7, SAS, 146 GB = OK 49 | - physicaldrive 1I:1:8, SAS, 146 GB = OK 50 | - physicaldrive 2I:1:3, SAS, 146 GB = OK 51 | - physicaldrive 2I:1:4, SAS, 146 GB = OK 52 | }}} 53 | 54 | -------------------------------------------------------------------------------- /check_hpssacli/README: -------------------------------------------------------------------------------- 1 | = check_hpssacli = 2 | Checks the raid status on a HP Array using hpssacli. to check the following: 3 | 4 | * Controller Status 5 | * Controller Cache Status 6 | * Logical disk health (raid status) 7 | * Physical disk health 8 | 9 | == Download == 10 | check_hpssacli.py depends on the hpssacli binary which comes with the HP Proliant Support Pack (PSP). The PSP can be downloaded [http://downloads.linux.hp.com/SDR/downloads/ProLiantSupportPack here]. 11 | 12 | You can get check_hpacucly.py directly from our subversion repo [http://opensource.is/trac/browser/nagios-plugins/check_hpssacli/trunk here] 13 | 14 | == help page == 15 | {{{ 16 | # python check_hpssacli.py --help 17 | check_hpssacli version 1.0 18 | This plugin checks HP Array with the hpssacli command 19 | 20 | Usage: check_hpssacli.py 21 | Usage: check_hpssacli.py [--help] 22 | Usage: check_hpssacli.py [--version] 23 | Usage: check_hpssacli.py [--path ] 24 | Usage: check_hpssacli.py [--no-perfdata] 25 | Usage: check_hpssacli.py [--no-longoutput] 26 | 27 | 28 | }}} 29 | 30 | == Example output == 31 | {{{ 32 | # ./check_hparray --all 33 | OK - Found 1 controllers, 2 logicaldisks. 8 physicaldisks. | 34 | 35 | Smart Array P400 in Slot 1 36 | - Controller Status: OK (sn: P61620F9VV6FX2) 37 | - Cache Status: OK (sn: PA82C0H9VV4695) 38 | 39 | Checking logical Disks: 40 | - Logical Drive: 1 (/boot 101 MB) = OK 41 | - Logical Drive: 2 (None) = OK 42 | 43 | Checking Physical Disks: 44 | - physicaldrive 2I:1:1, SAS, 146 GB = OK 45 | - physicaldrive 2I:1:2, SAS, 146 GB = OK 46 | - physicaldrive 1I:1:5, SAS, 146 GB = OK 47 | - physicaldrive 1I:1:6, SAS, 146 GB = OK 48 | - physicaldrive 1I:1:7, SAS, 146 GB = OK 49 | - physicaldrive 1I:1:8, SAS, 146 GB = OK 50 | - physicaldrive 2I:1:3, SAS, 146 GB = OK 51 | - physicaldrive 2I:1:4, SAS, 146 GB = OK 52 | }}} 53 | 54 | -------------------------------------------------------------------------------- /check_mtr/check_mtr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from pynag.Plugins import UNKNOWN, WARNING, CRITICAL, OK, simple as Plugin 4 | from subprocess import Popen, PIPE 5 | from pprint import pprint 6 | 7 | 8 | 9 | 10 | 11 | ## Create the plugin option 12 | np = Plugin() 13 | 14 | np.add_arg('l', 'long-output', 'Allows for long multiline output', required=0, action='store_true') 15 | 16 | # Parse the plugin options 17 | np.activate() 18 | 19 | 20 | p = Popen("mtr -c 4 --raw %s" % (np['host']), shell=True, stdout=PIPE, stderr=PIPE, close_fds=True) 21 | stdout, stderr = p.communicate('through stdin to stdout') 22 | if p.returncode > 0: 23 | if p.returncode == 127: # File not found, lets print path 24 | np.nagios_exit(UNKNOWN, "Unable to find mtr, check that it is installed") 25 | else: 26 | np.nagios_exit(UNKNOWN, "Unable to run mtr: %s" % (stderr.strip())) 27 | 28 | 29 | mtr_output = {} 30 | for line in stdout.split("\n"): 31 | if not line: 32 | continue 33 | line.strip() 34 | (l_type, l_id, l_data) = line.split(" ", 3) 35 | 36 | if mtr_output.has_key(l_id) == False: 37 | mtr_output[l_id] = { 'p': [] } 38 | 39 | if l_type == "p": 40 | mtr_output[l_id][l_type].append(int(l_data)) 41 | else: 42 | mtr_output[l_id][l_type] = l_data 43 | 44 | 45 | for k in range(0, len(mtr_output)): 46 | obj = str(k) 47 | avg = sum(mtr_output[obj]['p']) / len(mtr_output[obj]['p']) 48 | np.add_perfdata('hop%s' % (obj), avg) 49 | np.add_message(OK, "%s average %imsec" % (mtr_output[obj]['h'], float(avg / 1000))) 50 | 51 | 52 | if np['long-output']: 53 | (code, message) = np.check_messages(joinallstr = "\n") 54 | else: 55 | (code, message) = np.check_messages() 56 | 57 | # Exit with the relevant code 58 | np.nagios_exit( code, message ) 59 | 60 | #h 5 92.43.192.110 61 | #d 5 neumann.mbl.is 62 | #p 5 35334 63 | 64 | #p 4 22419 65 | #h 5 92.43.192.110 66 | #d 5 neumann.mbl.is 67 | 68 | 69 | -------------------------------------------------------------------------------- /check_cifs/nagios-okplugin-cifs.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check CIFS shares 4 | Name: nagios-okplugin-cifs 5 | Version: 1.1 6 | Release: 2%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-Brocade 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_cifs/releases/nagios-okplugin-cifs-%{version}.tar.gz 11 | Requires: perl-Nagios-Plugin 12 | Requires: samba-client, krb5-workstation 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Gardar Thorsteinsson 15 | BuildArch: noarch 16 | 17 | 18 | %description 19 | Checks CIFS fileshares, support writing and benchmarking, kerberos and 20 | NTML authentication 21 | 22 | %prep 23 | %setup -q 24 | perl -pi -e "s|/usr/lib|%{_libdir}|g" check_cifs 25 | 26 | %global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\) 27 | 28 | %build 29 | 30 | 31 | %install 32 | rm -rf %{buildroot} 33 | install -D -p -m 0755 check_cifs %{buildroot}%{_libdir}/nagios/plugins/check_cifs 34 | 35 | %clean 36 | rm -rf %{buildroot} 37 | 38 | %files 39 | %defattr(-,root,root,-) 40 | %doc README LICENSE 41 | %{_libdir}/nagios/plugins/* 42 | 43 | %changelog 44 | * Fri May 09 2018 Gardar Thorsteinsson 1.1-2 45 | - Filter out perl-utils dep 46 | 47 | * Thu Feb 20 2014 Pall Sigurdsson 1.1-1 48 | - Merge github.com:opinkerfi/misc (palli@opensource.is) 49 | 50 | * Thu Aug 23 2012 Pall Sigurdsson 1.0-1 51 | - version number of scripts bumped (palli@opensource.is) 52 | - Updates buildarch to noarch (tommi@tommi.org) 53 | 54 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.4-1 55 | - new package built with tito 56 | 57 | * Mon Nov 21 2010 Tomas Edwardsson 0.0.3-1 58 | - Initial packaging 59 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_pool: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # This script monitors a specified Media pool of HP Dataprotector 21 | # Issues a warning if free media in $pool are less than $warning 22 | 23 | POOL="$1" 24 | WARNING=5 25 | CRITICAL=2 26 | 27 | if [ "$POOL" = "" ]; then 28 | echo "Unknown - No Media pool specified" 29 | exit 3 30 | fi 31 | 32 | OUTPUT=$(/opt/omni/bin/omnimm -list_pool "$POOL") 33 | RESULT=$? 34 | 35 | if [ $RESULT -eq 3 ]; then 36 | echo "Unknown - Media pool '$POOL' was not found" 37 | exit 3 38 | fi 39 | 40 | if [ $RESULT -ne 0 ]; then 41 | echo "Unknown - exit code from omnimm=$RESULT, output: $OUTPUT" 42 | exit 3 43 | fi 44 | 45 | FREE_MEDIA=$(echo "$OUTPUT" | tail -n +4 | wc -l) 46 | 47 | PERFDATA="'$POOL'=$FREE_MEDIA" 48 | 49 | if [ $FREE_MEDIA -lt $CRITICAL ]; then 50 | echo "Critical: $FREE_MEDIA available media in pool $POOL | $PERFDATA" 51 | exit 2 52 | fi 53 | 54 | if [ $FREE_MEDIA -lt $WARNING ]; then 55 | echo "Warning: $FREE_MEDIA available media in pool $POOL | $PERFDATA" 56 | exit 1 57 | fi 58 | 59 | echo "OK: $FREE_MEDIA available media in pool $POOL | $PERFDATA" 60 | exit 0 61 | -------------------------------------------------------------------------------- /check_smssend/check_smssend: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | DIRECTORY=/var/spool/sms/incoming 5 | MAX_HOURS=24 6 | PURGE_OLD_FILES=no 7 | FROM_NUMBER="" 8 | VERSION=1.0 9 | 10 | OK=0 11 | WARNING=1 12 | CRITICAL=2 13 | UNKNOWN=3 14 | 15 | 16 | print_help() { 17 | echo "check_smsend version $VERSION" 18 | echo "This plugin checks sms incoming for new SMS" 19 | echo "" 20 | echo "Usage: $0 [--directory] [--max-age] [--purge-old-files] [--verbose]" 21 | echo "" 22 | } 23 | 24 | 25 | 26 | # Parse arguments 27 | while [ $# -gt 0 ] 28 | do 29 | case $1 30 | in 31 | -h) 32 | print_help 33 | shift 1 34 | exit $OK 35 | ;; 36 | 37 | --help) 38 | print_help 39 | shift 1 40 | exit $OK 41 | ;; 42 | --max-age) 43 | MAX_AGE=$2 44 | shift 2 45 | ;; 46 | --directory) 47 | DIRECTORY=$2 48 | shift 2 49 | ;; 50 | --purge-old-files) 51 | PURGE_OLD_FILES=yes 52 | shift 1 53 | ;; 54 | --verbose) 55 | VERBOSE=yes 56 | shift 1 57 | ;; 58 | *) 59 | echo "Invalid parameter: $1" 60 | print_help 61 | exit $UNKNOWN 62 | ;; 63 | esac 64 | done 65 | 66 | 67 | 68 | if [ ! -d "$DIRECTORY" ]; then 69 | echo "Unknown - $DIRECTORY not found or not readable" 70 | exit $UNKNOWN 71 | fi 72 | 73 | 74 | RESULT=`find $DIRECTORY -type f -mtime -${MAX_HOURS}` 75 | TMP=`echo $RESULT|wc -w` 76 | 77 | 78 | # Clean up old files if we are asked to 79 | if [ "$PURGE_OLD_FILES" = "YES" ]; then 80 | find $DIRECTORY -type f -mtime +${MAX_HOURS} -exec rm -f {} \; 81 | fi 82 | 83 | # Fail if we find no files 84 | if [ $TMP -lt 1 ]; then 85 | echo "Warning - No recent SMS found in $DIRECTORY" 86 | exit $WARNING 87 | fi 88 | 89 | 90 | echo "OK - $TMP files found in $DIRECTORY" 91 | if [ ! -z "$VERBOSE" ]; then 92 | for i in $RESULT; do echo $i; done 93 | fi 94 | exit $OK 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /check_firewall_active/nagios-okplugin-check_firewall_active.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check if iptables are actually enforcing rules 4 | Name: nagios-okplugin-check_firewall_active 5 | Version: 1.0.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: https://github.com/opinkerfi/nagios-plugins/issues 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_firewall_active/releases/nagios-okplugin-check_firewall_active-%{version}.tar.gz 11 | Requires: nagios-nrpe 12 | Requires: iptables 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Richard Allen 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to check if iptables are actually enforcing rules 20 | 21 | 22 | %prep 23 | %setup -q 24 | #perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/check_firewall_active.cfg 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_firewall_active.sh %{buildroot}%{_libdir}/nagios/plugins/check_firewall_active.sh 32 | install -D -p -m 0755 nrpe.d/check_firewall_active.cfg %{buildroot}/etc/nrpe.d/check_firewall_active.cfg 33 | install -D -p -m 0644 sudoers.d/check_firewall_active %{buildroot}/etc/sudoers.d/check_firewall_active 34 | 35 | %clean 36 | rm -rf %{buildroot} 37 | 38 | %files 39 | %defattr(-,root,root,-) 40 | #%doc README LICENSE 41 | %{_libdir}/nagios/plugins/* 42 | /etc/nrpe.d/check_firewall_active.cfg 43 | /etc/sudoers.d/check_firewall_active 44 | 45 | %post 46 | restorecon -v %{_libdir}/nagios/plugins/check_firewall_active.sh /etc/nrpe.d/check_firewall_active.cfg /etc/sudoers.d/check_firewall_active 47 | 48 | %changelog 49 | * Thu Dec 21 2016 Gardar Thorsteinsson 1.0.1-1 50 | * Thu Dec 21 2016 Gardar Thorsteinsson 1.0.0-3 51 | * Thu Dec 20 2016 Richard Allen 0.1-1 52 | - Initial packaging 53 | -------------------------------------------------------------------------------- /check_drbd/nagios-okplugin-check_drbd.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | %define plugin_name check_drbd 4 | 5 | 6 | Summary: A Nagios plugin to check Linux Devicemapper Multipathing 7 | Name: nagios-okplugin-%{plugin_name} 8 | Version: 0.0.4 9 | Release: 1%{?dist} 10 | License: GPLv2+ 11 | Group: Applications/System 12 | URL: http://opensource.is/trac/wiki/%{plugin_name} 13 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{plugin_name}/releases/%{name}-%{version}.tar.gz 14 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 15 | Packager: Pall Sigurdsson 16 | 17 | 18 | %description 19 | %{summary} 20 | 21 | %prep 22 | %setup -q 23 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/%{plugin_name}.cfg 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_drbd %{buildroot}%{_libdir}/nagios/plugins/check_drbd 31 | install -D -p -m 0755 nrpe.d/%{plugin_name}.cfg %{buildroot}/etc/nrpe.d/%{plugin_name}.cfg 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | #%doc README LICENSE 39 | %{_libdir}/nagios/plugins/* 40 | /etc/nrpe.d/%{plugin_name}.cfg 41 | 42 | %changelog 43 | * Wed Mar 14 2012 Pall Sigurdsson 0.0.4-1 44 | - licence and readme removed from specfile (palli@opensource.is) 45 | 46 | * Wed Mar 14 2012 Pall Sigurdsson 47 | - licence and readme removed from specfile (palli@opensource.is) 48 | 49 | * Wed Mar 14 2012 Pall Sigurdsson 50 | - licence and readme removed from specfile (palli@opensource.is) 51 | 52 | * Wed Mar 14 2012 Pall Sigurdsson 53 | - licence and readme removed from specfile (palli@opensource.is) 54 | 55 | * Wed Mar 14 2012 Pall Sigurdsson 0.0.3-1 56 | - new package built with tito 57 | 58 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 59 | - new package built with tito 60 | -------------------------------------------------------------------------------- /check_apcext.pl/nagios-okplugin-apc.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check APC devices 4 | Name: nagios-okplugin-apc 5 | Version: 2.1.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-APC 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_apcext.pl/releases/nagios-okplugin-apc-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | 17 | %description 18 | Checks APC devices, both netbotz and UPS 19 | 20 | %prep 21 | %setup -q 22 | #perl -pi -e "s|/usr/lib|%{_libdir}|g" check_sip 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_apcext.pl %{buildroot}%{_libdir}/nagios/plugins/check_apcext.pl 30 | install -D -p -m 0755 check_snmp_apc_ups %{buildroot}%{_libdir}/nagios/plugins/check_snmp_apc_ups 31 | 32 | %clean 33 | rm -rf %{buildroot} 34 | 35 | %files 36 | %defattr(-,root,root,-) 37 | %doc README 38 | %{_libdir}/nagios/plugins/* 39 | 40 | %changelog 41 | * Mon Jun 09 2014 Tomas Edwardsson 2.1.2-1 42 | - Disable embedded perl (tommi@tommi.org) 43 | 44 | * Thu Mar 20 2014 Tomas Edwardsson 2.1.1-1 45 | - Merge github.com:opinkerfi/misc (palli@opensource.is) 46 | - Use the right value for the job nbmstemp (tommi@tommi.org) 47 | - Fixed metric conversion for all mibs (tommi@opensource.is) 48 | - Added fahrenheit to celsius conversion (tommi@tommi.org) 49 | 50 | * Thu Aug 23 2012 Pall Sigurdsson 2.1.0-1 51 | - Version number bumped to 2.1.0 (palli@opensource.is) 52 | - Added noarch buildarch (tommi@tommi.org) 53 | 54 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.3-1 55 | - new package built with tito 56 | 57 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 58 | - Initial packaging 59 | -------------------------------------------------------------------------------- /check_ipa/nagios-okplugin-ipa.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin ipa 3 | 4 | Summary: A Nagios plugin to check IPA server status 5 | Name: nagios-okplugin-%{plugin} 6 | Version: 0.0.4 7 | Release: 1%{?dist} 8 | License: GPLv2+ 9 | Group: Applications/System 10 | URL: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin} 11 | Source0: https://github.com/opinkerfi/misc/tree/master/nagios-plugins/check_%{plugin}/releases/%{name}-%{version}.tar.gz 12 | Requires: python-ldap 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: Tomas Edwardsson 15 | BuildArch: noarch 16 | Requires: nrpe 17 | 18 | 19 | %description 20 | Checks IPA server status 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_ipa_replication %{buildroot}%{_libdir}/nagios/plugins/check_ipa_replication 31 | mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 32 | sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/check_ipa.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/check_ipa.cfg 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %files 38 | %defattr(-,root,root,-) 39 | %doc README 40 | %doc grant_anonymous_replication_view.ldif 41 | %{_libdir}/nagios/plugins/* 42 | %config(noreplace) %{_sysconfdir}/nrpe.d/check_ipa.cfg 43 | 44 | %changelog 45 | * Fri Apr 04 2014 Tomas Edwardsson 0.0.4-1 46 | - Renamed to markdown (tommi@tommi.org) 47 | - Added examples and documentation (tommi@tommi.org) 48 | - Missing colon (tommi@tommi.org) 49 | - Added missing OK when things worked out (tommi@tommi.org) 50 | 51 | * Thu Apr 25 2013 Tomas Edwardsson 0.0.3-1 52 | - Preliminary testing done, released 53 | - Various errors in syntax fixed (tommi@tommi.org) 54 | - Detection for no configured replicas (tommi@tommi.org) 55 | 56 | * Thu Apr 25 2013 Tomas Edwardsson 0.0.2-1 57 | - Tagged new release 58 | 59 | * Wed Apr 25 2013 Tomas Edwardss 0.0.1-1 60 | - Initial Packaging 61 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_mountrequest: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # This script monitors active sessions of HP Dataprotector 21 | # Warns if there are any active mount requests. Additionally 22 | # displays some perfdata of total active sessions and queueud sessions 23 | 24 | TEMPFILE=`mktemp` 25 | omnistat=/opt/omni/bin/omnistat 26 | 27 | if [ ! -x $omnistat ]; then 28 | echo "UNKNOWN - Cant find $omnistat" 29 | exit 3 30 | fi 31 | 32 | $omnistat > $TEMPFILE 33 | RESULT=$? 34 | 35 | 36 | # Collect some performance data 37 | RUNNING_SESSIONS=`grep ^2 $TEMPFILE | wc -l` 38 | QUEUED_SESSIONS=`grep Queuing $TEMPFILE | wc -l` 39 | MOUNT_REQUESTS=`grep Mount $TEMPFILE | wc -l` 40 | PERFDATA="'active sessions'=$RUNNING_SESSIONS 'queued'=$QUEUED_SESSIONS 'mount requests'=$MOUNT_REQUESTS" 41 | 42 | grep -q "No currently running sessions." $TEMPFILE 43 | RESULT=$? 44 | 45 | grep -q "Mount" $TEMPFILE 46 | MOUNTREQUESTS=$? 47 | 48 | rm -f $TEMPFILE 49 | 50 | if [ $RESULT -eq 0 ]; then 51 | echo "OK - No running sessions | $PERFDATA" 52 | exit 0 53 | fi 54 | 55 | 56 | if [ $MOUNTREQUESTS -eq 0 ]; then 57 | echo "Warning, $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA" 58 | exit 1 59 | fi 60 | 61 | #cat $TEMPFILE 62 | echo "OK - $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA" 63 | exit 0 64 | -------------------------------------------------------------------------------- /okc-get_network_stat/okc-get_network_stat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from pynag.Plugins import PluginHelper, ok, warning, critical, unknown 4 | from pynag.Utils import runCommand 5 | import re 6 | 7 | helper = PluginHelper() 8 | 9 | helper.parser.add_option("-H", help="Host to connect to", dest="host", default='localhost') 10 | 11 | helper.parse_arguments() 12 | 13 | if helper.options.host == "localhost": 14 | command="cat /proc/net/dev|sed 's/ */ /g'" 15 | else: 16 | command="/usr/lib64/nagios/plugins/check_nrpe -H '%s' -c get_network_interfaces_stat" % helper.options.host 17 | 18 | return_code, stdout, stderr = runCommand(command) 19 | 20 | try: 21 | receive, transmit = stdout.split("\n")[1].split("|")[1:] 22 | receive = receive.split() 23 | transmit = transmit.split() 24 | 25 | interfaces = [] 26 | 27 | for int_line in stdout.split("\n")[2:]: 28 | int_line = int_line.strip() 29 | if not int_line: 30 | continue 31 | 32 | int_arr = re.split("[: ]+", int_line.strip()) 33 | 34 | interface = int_arr.pop(0) 35 | 36 | if interface == "lo" or interface.startswith('sit'): 37 | continue 38 | 39 | interfaces.append(interface) 40 | for i in range(0, len(receive)): 41 | helper.add_metric( 42 | label="%s_rx_%s" % (interface, receive[i]), 43 | value=int_arr.pop(0), 44 | uom="c") 45 | for i in range(0, len(transmit)): 46 | helper.add_metric( 47 | label="%s_tx_%s" % (interface, transmit[i]), 48 | value=int_arr.pop(0), 49 | uom="c") 50 | 51 | helper.add_summary("Network interfaces %s" % ", ".join(interfaces)) 52 | 53 | # Here all metrics will be checked against thresholds that are either 54 | # built-in or added via --threshold from the command-line 55 | helper.check_all_metrics() 56 | 57 | # Print out plugin information and exit nagios-style 58 | helper.exit(ok) 59 | except Exception, error: 60 | helper.status(unknown) 61 | helper.add_summary(stdout + stderr) 62 | helper.exit(unknown) 63 | 64 | # vim: sts=4 expandtab autoindent 65 | 66 | -------------------------------------------------------------------------------- /check_cpu.sh/nagios-plugins-check_cpu.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check CPU on Linux servers 4 | Name: nagios-plugins-check_cpu 5 | Version: 2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://www.matejunkie.com/cpu-check-plugin-for-nagios/ 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_cpu/releases/nagios-plugins-check_cpu-%{version}.tar.gz 11 | Requires: nrpe bc 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | %description 17 | This shell script checks cpu utilization (user,system,iowait,idle in %) 18 | through /proc/stat accepting seperate threshholds and returning the data in a 19 | format suitable for performance data processing 20 | 21 | %prep 22 | %setup -q 23 | perl -pi -e "s|/usr/lib/|%{_libdir}/|g" nrpe.d/check_cpu.cfg 24 | perl -pi -e "s|/usr/lib64/|%{_libdir}/|g" nrpe.d/check_cpu.cfg 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_cpu.sh %{buildroot}%{_libdir}/nagios/plugins/check_cpu.sh 32 | install -D -p -m 0755 nrpe.d/check_cpu.cfg %{buildroot}/etc/nrpe.d/check_cpu.cfg 33 | 34 | %clean 35 | rm -rf %{buildroot} 36 | 37 | %post 38 | /sbin/service nrpe reload 39 | 40 | %files 41 | %defattr(-,root,root,-) 42 | #%doc README LICENSE 43 | %{_libdir}/nagios/plugins/* 44 | /etc/nrpe.d/check_cpu.cfg 45 | 46 | 47 | %changelog 48 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 49 | - Added nrpe reload to post section (tommi@tommi.org) 50 | - Merge github.com:opinkerfi/misc (palli@opensource.is) 51 | - Added dependency on bc (palli@opensource.is) 52 | 53 | * Thu Aug 23 2012 Pall Sigurdsson 1.0-1 54 | - Version number bumped 55 | - Updates buildarch to noarch (tommi@tommi.org) 56 | 57 | * Mon Mar 12 2012 Pall Sigurdsson 0.3-1 58 | - new package built with tito 59 | 60 | * Thu Nov 25 2010 Pall Sigurdsson 0.1-2 61 | - Nrpe config now ships with plugin by default 62 | * Mon Mar 1 2010 Tomas Edwardsson 0.1-1 63 | - Initial packaging 64 | 65 | -------------------------------------------------------------------------------- /check_dataprotector/nagios-okplugin-check_dataprotector.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: Nagios Plugins to monitor HP Dataprotector 4 | Name: nagios-okplugin-check_dataprotector 5 | Version: 2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_dataprotector 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_dataprotector/releases/nagios-okplugin-check_dataprotector-%{version}.tar.gz 11 | Requires: OB2-DA,OB2-CC 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | 15 | 16 | 17 | %description 18 | Nagios Plugins to monitor HP Dataprotector 19 | 20 | %prep 21 | %setup -q 22 | perl -pi -e "s|/usr/lib/|%{_libdir}/|g" nrpe.d/check_dataprotector.cfg 23 | perl -pi -e "s|/usr/lib64/|%{_libdir}/|g" nrpe.d/check_dataprotector.cfg 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_dp_backups %{buildroot}%{_libdir}/nagios/plugins/check_dp_backups 31 | install -D -p -m 0755 check_dp_idb %{buildroot}%{_libdir}/nagios/plugins/check_dp_idb 32 | install -D -p -m 0755 check_dp_mountrequest %{buildroot}%{_libdir}/nagios/plugins/check_dp_mountrequest 33 | install -D -p -m 0755 check_dp_pool %{buildroot}%{_libdir}/nagios/plugins/check_dp_pool 34 | install -D -p -m 0755 check_dp_services %{buildroot}%{_libdir}/nagios/plugins/check_dp_services 35 | install -D -p -m 0755 check_dp_tablespace %{buildroot}%{_libdir}/nagios/plugins/check_dp_tablespace 36 | install -D -p -m 0755 nrpe.d/check_dataprotector.cfg %{buildroot}/etc/nrpe.d/check_dataprotector.cfg 37 | 38 | %clean 39 | rm -rf %{buildroot} 40 | 41 | %files 42 | %defattr(-,root,root,-) 43 | %doc README LICENSE 44 | %{_libdir}/nagios/plugins/* 45 | /etc/nrpe.d/check_dataprotector.cfg 46 | 47 | %changelog 48 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 49 | - removed warning threshold of 60 (palli@opensource.is) 50 | - contrib removed from plugin path (palli@opensource.is) 51 | 52 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 53 | - new package built with tito 54 | 55 | * Mon Sep 15 2010 Pall Sigurdsson 0.1-1 56 | - Initial packaging 57 | -------------------------------------------------------------------------------- /check_time/check_time.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | export PATH=$PATH:/usr/lib/nagios/plugins/:/usr/lib64/nagios/plugins/ 5 | 6 | 7 | # Nagios exit codes 8 | OK=0 9 | WARN=1 10 | CRIT=2 11 | UNKNOWN=3 12 | 13 | # Default warning thresholds 14 | warning=60 15 | critical=86400 16 | 17 | 18 | print_help() { 19 | echo "check_time version $VERSION" 20 | echo "This plugin checks the time of a remote host via NRPE" 21 | echo "" 22 | echo "Usage: $0 -H [-w seconds] [-c seconds]" 23 | echo "" 24 | echo "Example: check time of host examplehost, warn if time difference is" 25 | echo "more than 60 seconds, critical if difference is more than 86400 seconds" 26 | echo "# check_time -H examplehost -w 60 -c 86400" 27 | } 28 | 29 | if [ $# -eq 0 ]; then 30 | print_help ; 31 | exit $UNKNOWN 32 | fi 33 | 34 | 35 | # Parse arguments 36 | while [ $# -gt 0 ] 37 | do 38 | case $1 39 | in 40 | -H) 41 | hostaddress=$2 42 | shift 2 43 | ;; 44 | 45 | 46 | -w) 47 | warning=$2 48 | shift 2 49 | ;; 50 | 51 | -c) 52 | critical=$2 53 | shift 2 54 | ;; 55 | 56 | *) 57 | print_help ; 58 | exit $UNKNOWN 59 | ;; 60 | esac 61 | done 62 | 63 | LOCALTIME=`/bin/date +%s` 64 | REMOTETIME=`check_nrpe -H $hostaddress -c get_time 2>&1` 65 | RESULT=$? 66 | 67 | if [ $RESULT -gt 0 ]; then 68 | echo "Unknown - Could not execute check_nrpe" 69 | echo "Error was:" 70 | echo $REMOTETIME 71 | exit 3 72 | fi 73 | 74 | for i in $warning $critical ; do 75 | if [ ! $i -ge 0 ]; then 76 | echo "$i is not a valid value. Should be in seconds. See --help for usage." 77 | exit $UNKNOWN 78 | fi 79 | done 80 | 81 | 82 | 83 | DIFF=$(echo $LOCALTIME-$REMOTETIME | bc ) 84 | 85 | if [ $DIFF -lt 0 ]; then 86 | DIFF=$(echo $DIFF*-1|bc) 87 | fi 88 | 89 | RESULT="timedrift=$DIFF seconds | timedrift=${DIFF}s;$warning;$critical" 90 | 91 | if [ $DIFF -gt $critical ]; then 92 | echo "CRITICAL - $RESULT" 93 | exit $CRIT 94 | fi 95 | 96 | if [ $DIFF -gt $warning ]; then 97 | echo "WARNING - $RESULT" 98 | exit $WARN 99 | fi 100 | 101 | 102 | echo "OK - $RESULT" 103 | exit 0 104 | -------------------------------------------------------------------------------- /check_disks.pl/nagios-okplugin-check_disks.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check disks via NRPE 4 | Name: nagios-okplugin-check_disks 5 | Version: 1.0.7 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_disks 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_eva/releases/nagios-okplugin-check_disks-%{version}.tar.gz 11 | Requires: nagios-plugins-nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | BuildArch: noarch 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to check disks via NRPE 20 | 21 | 22 | %prep 23 | %setup -q 24 | perl -pi -e "s|/usr/lib|%{_libdir}|g" check_disks.pl 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_disks.pl %{buildroot}%{_libdir}/nagios/plugins/check_disks.pl 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | #%doc README LICENSE 39 | #%{_libdir}/nagios/plugins/* 40 | %{_libdir}/nagios/plugins/check_disks.pl 41 | 42 | %changelog 43 | * Wed Oct 29 2014 Tomas Edwardsson 1.0.7-1 44 | - Fix invalid regex if mountpoint has . in path (tommi@tommi.org) 45 | - Regex filtering broke disk checks (tommi@tommi.org) 46 | 47 | * Tue Mar 25 2014 Tomas Edwardsson 1.0.6-1 48 | - Bumped version 49 | 50 | * Tue Mar 25 2014 Tomas Edwardsson 1.0.5-1 51 | - Added support for inodes (tryggvi@linux.is) 52 | 53 | * Sat Mar 02 2013 Tryggvi Farestveit 1.0.4-1 54 | - Added support for inodes 55 | 56 | * Wed May 16 2012 Tomas Edwardsson 1.0.3-1 57 | - Updated version of nagios-okplugin-check_disks (tommi@tommi.org) 58 | - Issue #56, temporary fix for selinux and disk checks (tommi@tommi.org) 59 | 60 | * Mon May 16 2012 Tomas Edwardsson 1.0.2-1 61 | - Ignore warning states from nrpe 62 | 63 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 64 | - new package built with tito 65 | 66 | * Sun Oct 16 2011 Tomas Edwardsson 0.1-2 67 | - Fixed dependencies and build arch 68 | 69 | * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 70 | - Initial packaging 71 | -------------------------------------------------------------------------------- /check_ibm_bladecenter/nagios-okplugin-check_ibm_bladecenter.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check IBM Bladecenters 4 | Name: nagios-okplugin-check_ibm_bladecenter 5 | Version: 4 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.ok.is/trac/wiki/Nagios-OKPlugin-check_ibm_bladecenter 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_ibm_bladecenter/releases/%{name}-%{version}.tar.gz 11 | Requires: nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | BuildArch: noarch 15 | Requires: nrpe 16 | 17 | 18 | %description 19 | Checks the health status of an IBM Bladecenter via SNMP 20 | 21 | %prep 22 | %setup -q 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_ibm_bladecenter.py %{buildroot}%{_libdir}/nagios/plugins/check_ibm_bladecenter.py 30 | #mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 31 | #sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/check_bond.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/check_bond.cfg 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc README 39 | %{_libdir}/nagios/plugins/* 40 | #%config(noreplace) %{_sysconfdir}/nrpe.d/check_bond.cfg 41 | 42 | %changelog 43 | * Fri Feb 21 2014 Pall Sigurdsson 4-1 44 | - 45 | 46 | * Fri Feb 21 2014 Unknown name 3-1 47 | - Merge branch 'master' of github.com:opinkerfi/nagios-plugins 48 | (palli@opensource.is) 49 | - ibm_bladecenter - another firmware bug workaround (palli@opensource.is) 50 | - pep8 fixes (palli@opensource.is) 51 | - Fix workaround for firmware bug (palli@opensource.is) 52 | 53 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 54 | - Merge branch 'master' of github.com:opinkerfi/misc (palli@opensource.is) 55 | - --exclude option added. Added workaround around false positives 56 | (palli@opensource.is) 57 | 58 | * Thu Aug 23 2012 Pall Sigurdsson 1.1.2-3 59 | - version number of scripts bumped (palli@opensource.is) 60 | 61 | * Thu Aug 23 2012 Pall Sigurdsson 1.1.2-2 62 | - rpm spec file added. version number bumped (palli@opensource.is) 63 | 64 | 65 | * Tue Jul 17 2012 Pall Sigurdsson 1.0.0-1 66 | - Initial packaging 67 | -------------------------------------------------------------------------------- /check_yum/nagios-okplugin-check_yum.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check yum updates via NRPE 4 | Name: nagios-okplugin-check_yum 5 | Version: 1 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_yum 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_yum/releases/nagios-okplugin-check_yum-%{version}.tar.gz 11 | Requires: nagios-okconfig-nrpe 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | 16 | 17 | 18 | %description 19 | A Nagios plugin to check for updates using yum via NRPE 20 | 21 | 22 | %prep 23 | %setup -q 24 | 25 | %build 26 | perl -pi -e "s|/usr/lib|%{_libdir}|g" sudoers.d/check_yum 27 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_yum.cfg 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_yum %{buildroot}%{_libdir}/nagios/plugins/check_yum 32 | install -D -p -m 0440 sudoers.d/check_yum %{buildroot}/etc/sudoers.d/check_yum 33 | install -D -p -m 0644 nrpe.d/check_yum.cfg %{buildroot}/etc/nrpe.d/check_yum.cfg 34 | 35 | 36 | %clean 37 | rm -rf %{buildroot} 38 | 39 | %files 40 | %defattr(-,root,root,-) 41 | #%doc README LICENSE 42 | #%{_libdir}/nagios/plugins/* 43 | %{_libdir}/nagios/plugins/check_yum 44 | /etc/sudoers.d/check_yum 45 | /etc/nrpe.d/check_yum.cfg 46 | 47 | %changelog 48 | * Thu Feb 20 2014 Pall Sigurdsson 1-1 49 | - Merge branch 'master' of github.com:opinkerfi/nagios-plugins 50 | (palli@opensource.is) 51 | 52 | * Mon May 27 2013 Tomas Edwardsson 0.8.2-1 53 | - Fixed nrpe with invalid libdir (tommi@tommi.org) 54 | 55 | * Mon May 27 2013 Tomas Edwardsson 0.8.1-1 56 | - Added missing nrpe config (tommi@tommi.org) 57 | - Initial rpm packaging (tommi@tommi.org) 58 | - fix for changed output in list-security query (pall.valmundsson@gmail.com) 59 | - Merge branch 'master' of github.com:opinkerfi/misc (palli@opensource.is) 60 | - Added perfdata and longoutput with ERRATA IDs (tommi@tommi.org) 61 | - Added perfdata and longoutput with ERRATA IDs (tommi@tommi.org) 62 | - Updated to new upstream release (tommi@tommi.org) 63 | 64 | * Tue Apr 16 2013 Tomas Edwardsson 0.8.0-2 65 | - Initial packaging 66 | -------------------------------------------------------------------------------- /misc/check_mssql_query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import pynag.Plugins 4 | import pymssql 5 | 6 | helper = pynag.Plugins.PluginHelper() 7 | 8 | 9 | helper.parser.add_option('--host', help="MSSQL Server to connect to", dest="host") 10 | helper.parser.add_option('--username', help="MSSQL Username to connect with", dest="username") 11 | helper.parser.add_option('--password', help="MSSQL Server to connect to", dest="password") 12 | helper.parser.add_option('--database', help="MSSQL Database", dest="database") 13 | helper.parser.add_option('--query', help="MSSQL Query to execute", dest="query") 14 | 15 | # When parse_arguments is called some default options like --threshold and --no-longoutput are automatically added 16 | helper.parse_arguments() 17 | 18 | 19 | host = helper.options.host 20 | username = helper.options.username 21 | password = helper.options.password 22 | database = helper.options.database 23 | query = helper.options.query 24 | #enable_debugging = helper.options.debug 25 | enable_debugging = helper.options.verbose 26 | 27 | def debug(message): 28 | if enable_debugging: 29 | print "debug: %s" % str(message) 30 | 31 | 32 | if not host: 33 | helper.parser.error('--host is required') 34 | if not username: 35 | helper.parser.error('--username is required') 36 | if not password: 37 | helper.parser.error('--password is required') 38 | if not database: 39 | helper.parser.error('--database is required') 40 | 41 | 42 | 43 | # Actual coding logic starts 44 | 45 | conn = pymssql.connect(host=host, user=username, password=password, database=database) 46 | debug("connecting to host") 47 | cur = conn.cursor() 48 | debug("Executing sql query: %s" % query) 49 | cur.execute(query) 50 | 51 | status,text = None,None 52 | for row in cur: 53 | debug(row) 54 | status, text = row[0], row[1] 55 | if text == '': 56 | text = "No text in this field" 57 | if status not in pynag.Plugins.state_text: 58 | helper.add_summary("Invalid status: %s" % status) 59 | status = pynag.Plugins.unknown 60 | 61 | helper.status(status) 62 | helper.add_long_output("%s: %s" % (pynag.Plugins.state_text.get(status,'unknown'), text) ) 63 | 64 | 65 | if not helper.get_summary(): 66 | if not text: 67 | helper.add_summary("Hey! Af hverju er enginn texti?") 68 | else: 69 | helper.add_summary(text) 70 | 71 | helper.check_all_metrics() 72 | helper.exit() 73 | -------------------------------------------------------------------------------- /check_nagios/nagios-okplugin-check_nagios.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A set of Nagios plugins to check the health of a nagios host 4 | Name: nagios-okplugin-check_nagios 5 | Version: 1.2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_nagios 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_multipath/releases/%{name}-%{version}.tar.gz 11 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 12 | Packager: Pall Sigurdsson 13 | 14 | 15 | %description 16 | Checks health of Nagios service 17 | 18 | %prep 19 | %setup -q 20 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_nagios.cfg 21 | 22 | %build 23 | 24 | 25 | %install 26 | rm -rf %{buildroot} 27 | install -D -p -m 0755 check_nagios_configuration %{buildroot}%{_libdir}/nagios/plugins/check_nagios_configuration 28 | install -D -p -m 0755 check_nagios_ghostservices %{buildroot}%{_libdir}/nagios/plugins/check_nagios_ghostservices 29 | install -D -p -m 0755 check_nagios_needs_reload %{buildroot}%{_libdir}/nagios/plugins/check_nagios_needs_reload 30 | install -D -p -m 0755 check_nagios_plugin_existance %{buildroot}%{_libdir}/nagios/plugins/check_nagios_plugin_existance 31 | install -D -p -m 0755 nrpe.d/check_nagios.cfg %{buildroot}/etc/nrpe.d/check_nagios.cfg 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc LICENSE 39 | %{_libdir}/nagios/plugins/* 40 | /etc/nrpe.d/check_nagios.cfg 41 | 42 | %changelog 43 | * Wed May 22 2013 Tomas Edwardsson 1.2-1 44 | - Modified to parse on epoch rather that syslog date (tommi@tommi.org) 45 | - Emit unknown if unable to open the logfile and detect location 46 | (tommi@tommi.org) 47 | - Fix tmp file cleanup (palli@opensource.is) 48 | 49 | * Thu Aug 23 2012 Pall Sigurdsson 1.1-1 50 | - Version number bumped 51 | - bugfix, check_nagios_needs_reload check for reload instead of reparse 52 | (palli@opensource.is) 53 | - fixed missing tempfile cleanup (root@manage.tr.is) 54 | 55 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.8-1 56 | - LICENSE file added (palli@opensource.is) 57 | 58 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.7-1 59 | - 60 | 61 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.6-1 62 | - new package built with tito 63 | 64 | -------------------------------------------------------------------------------- /check_hpacucli/nagios-okplugin-check_hpacucli.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check HP Array with hpacucli 4 | Name: nagios-okplugin-check_hpacucli 5 | Version: 2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_hpacucli 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_hpacucli/releases/nagios-okplugin-check_hpacucli-%{version}.tar.gz 11 | Requires: hpacucli 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | 15 | 16 | %description 17 | Checks HP Array with hpacucli 18 | 19 | %prep 20 | %setup -q 21 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg 22 | perl -pi -e "s|/usr/lib64|%{_libdir}|g" sudoers.d/* 23 | 24 | %build 25 | 26 | 27 | %install 28 | rm -rf %{buildroot} 29 | install -D -p -m 0755 check_hpacucli.py %{buildroot}%{_libdir}/nagios/plugins/check_hpacucli.py 30 | install -D -p -m 0755 nrpe.d/check_hpacucli.cfg %{buildroot}/etc/nrpe.d/check_hpacucli.cfg 31 | install -D -p -m 0440 sudoers.d/check_hpacucli %{buildroot}/etc/sudoers.d/check_hpacucli 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc README LICENSE 39 | %{_libdir}/nagios/plugins/* 40 | /etc/nrpe.d/check_hpacucli.cfg 41 | /etc/sudoers.d/check_hpacucli 42 | 43 | %changelog 44 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 45 | - check_hpacucli.py - fix typo in hpacucli command (palli@opensource.is) 46 | - check_hpacucli.py: pep8 cleanup (palli@opensource.is) 47 | - check_hpacucli - fix tab indentation (palli@opensource.is) 48 | - check_hpacucli: ignore hpacucli output that starts with "Note:" 49 | (palli@opensource.is) 50 | - sudoers.d added to install (you@example.com) 51 | - dummy commit (you@example.com) 52 | - dummy commit (you@example.com) 53 | - Add sudoers support to check_hpacucli (palli@opensource.is) 54 | 55 | * Thu Aug 23 2012 Pall Sigurdsson 1.2-2 56 | - version number of scripts bumped (palli@opensource.is) 57 | 58 | * Thu Aug 23 2012 Pall Sigurdsson 1.2-1 59 | - check_command is now sudo'ed (palli@opensource.is) 60 | 61 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.3-1 62 | - new package built with tito 63 | 64 | * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 65 | - Initial packaging 66 | -------------------------------------------------------------------------------- /check_ipa/check_ipa_replication: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2013, Tomas Edwardsson 3 | # 4 | # This script is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This script is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | import ldap 18 | from pynag.Plugins import PluginHelper, critical, warning, ok 19 | 20 | plugin = PluginHelper() 21 | 22 | plugin.parser.add_option('-u', help="ldap uri", dest="uri") 23 | plugin.parser.add_option('-D', help="bind DN", dest="binddn") 24 | plugin.parser.add_option('-w', help="bind password", dest="bindpw") 25 | plugin.parse_arguments() 26 | 27 | if not plugin.options.uri: 28 | plugin.parser.error('-u (uri) argument is required') 29 | 30 | try: 31 | l = ldap.initialize(plugin.options.uri) 32 | 33 | if plugin.options.binddn: 34 | l.bind_s(plugin.options.binddn, plugin.options.bindpw) 35 | 36 | replication = l.search_s('cn=config', 37 | ldap.SCOPE_SUBTREE, 38 | '(objectclass=nsds5replicationagreement)', 39 | ['nsDS5ReplicaHost', 'nsds5replicaLastUpdateStatus']) 40 | except Exception, e: 41 | plugin.status(critical) 42 | plugin.add_summary("Unable to initialize ldap connection: %s" % (e)) 43 | plugin.exit() 44 | 45 | 46 | # Loop through replication agreements 47 | for rhost in replication: 48 | plugin.add_summary("Replica %s Status: %s" % (rhost[1]['nsDS5ReplicaHost'][0], rhost[1]['nsds5replicaLastUpdateStatus'][0])) 49 | if rhost[1]['nsds5replicaLastUpdateStatus'][0][7:8] == "0": 50 | plugin.status(ok) 51 | elif rhost[1]['nsds5replicaLastUpdateStatus'][0][7:8] == "1": 52 | # Busy Replica is not an error, its "unknown" (but its "ok" for now) 53 | plugin.status(ok) 54 | else: 55 | plugin.status(critical) 56 | 57 | if not len(replication): 58 | plugin.add_summary("Warning: No replicas found") 59 | plugin.status(warning) 60 | 61 | plugin.exit() 62 | -------------------------------------------------------------------------------- /check_msa_hardware-pl/nagios-okplugin-check_msa.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin check_msa_hardware 3 | %define packager Gardar Thorsteinsson 4 | 5 | Summary: A Nagios plugin to check status of an MSA (HP P2000) disk array 6 | Name: nagios-okplugin-%{plugin} 7 | Version: 1.0.5 8 | Release: 2%{?dist} 9 | License: GPLv3+ 10 | Group: Applications/System 11 | URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin} 12 | Source0: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}/releases/%{name}-%{version}.tar.gz 13 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 14 | Packager: %{packager} 15 | BuildArch: noarch 16 | Requires: pynag 17 | 18 | 19 | %description 20 | Checks status of a remote MSA disk array, also known as HP P2000 21 | %prep 22 | %setup -q 23 | 24 | %global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\) 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 32 | mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 33 | sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/%{plugin}.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/%{plugin}.cfg 34 | 35 | # Temporary fix for selinux 36 | chcon system_u:object_r:nagios_unconfined_plugin_exec_t:s0 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 37 | 38 | %clean 39 | rm -rf %{buildroot} 40 | 41 | %post 42 | /sbin/service nrpe status &> /dev/null && /sbin/service nrpe reload || : 43 | 44 | %files 45 | %defattr(-,root,root,-) 46 | %doc README.md 47 | %{_libdir}/nagios/plugins/* 48 | %config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg 49 | 50 | %changelog 51 | * Fri May 09 2018 Gardar Thorsteinsson 1.0.5-2 52 | - Filter out perl-utils dep 53 | 54 | * Thu Jan 30 2014 Pall Sigurdsson 1.0.5-1 55 | - 56 | 57 | * Thu Jan 30 2014 Pall Sigurdsson 1.0.4-1 58 | - README.md added (you@example.com) 59 | - nrpe.d added to check_msa (you@example.com) 60 | - rename check_msa_hardware-pl (you@example.com) 61 | 62 | * Thu Jan 30 2014 Pall Sigurdsson 1.0.3-1 63 | - new package built with tito 64 | 65 | * Thu Jan 30 2014 Pall Sigurdsson 1.0.2-1 66 | - new package built with tito 67 | 68 | * Thu Jan 30 2014 Unknown name 1.0.1-1 69 | - new package built with tito 70 | 71 | * Fri Jan 27 2014 Pall Sigurdsson 1.0.0-1 72 | - Initial Packaging 73 | -------------------------------------------------------------------------------- /check_uptime/check_uptime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # Checks uptime of a specified host, using NRPE is host is remote 21 | 22 | HOSTN="localhost" # By default check localhost 23 | CHECK_COMMAND="uptime" # Default command to check uptime 24 | 25 | print_help() { 26 | echo "$0 version $VERSION" 27 | echo "This plugin checks uptime of local or remote host" 28 | echo "" 29 | echo "Usage: $0 [-H ]" 30 | echo "" 31 | echo "Example: Check uptime of a remote host" 32 | echo "# $0 -H remotehost -s Enforcing" 33 | } 34 | 35 | # Parse arguments 36 | while [ $# -gt 0 ] 37 | do 38 | case $1 39 | in 40 | -H) 41 | HOSTN=$2 42 | shift 2 43 | ;; 44 | 45 | *) 46 | print_help ; 47 | exit $UNKNOWN 48 | ;; 49 | esac 50 | done 51 | 52 | 53 | 54 | 55 | # We we are not checking localhost, lets get remote uptime via NRPE 56 | if [ "$HOSTN" != "localhost" ]; then 57 | export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/nagios/usr/lib/nagios/plugins 58 | CHECK_COMMAND="check_nrpe -H $HOSTN -c get_uptime" 59 | fi 60 | 61 | 62 | 63 | 64 | 65 | # Get the uptime, raise error if we are unsuccessful 66 | OUTPUT=`$CHECK_COMMAND` 67 | RESULT=$? 68 | 69 | if [ $RESULT -gt 0 ]; then 70 | echo "Error - Could not run command $CHECK_COMMAND" 71 | echo "Error was: $OUTPUT" 72 | exit 3 73 | fi 74 | 75 | # Parse the output from uptime command 76 | set -- $OUTPUT 77 | if [ $4 == 'min(s),' ]; then 78 | echo "Warning, $HOSTN uptime is $OUTPUT" 79 | exit 1 80 | elif [ `echo $3 | grep -c :` -gt 0 ]; then 81 | echo "Ok, ${HOSTN} uptime is $OUTPUT" 82 | exit 0 83 | else 84 | echo "Ok, ${HOSTN} uptime is $OUTPUT" 85 | exit 0 86 | fi 87 | 88 | 89 | -------------------------------------------------------------------------------- /check_eva/nagios-okplugin-check_eva.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: A Nagios plugin to check HP EVA Disk Systems 4 | Name: nagios-okplugin-check_eva 5 | Version: 2 6 | Release: 1%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_eva 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_eva/releases/nagios-okplugin-check_eva-%{version}.tar.gz 11 | Requires: sssu,nagios-plugins 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Pall Sigurdsson 14 | 15 | 16 | 17 | %description 18 | Checks HP EVA Disk Systems with the sssu binary 19 | 20 | 21 | %prep 22 | %setup -q 23 | perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_eva.cfg 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_eva.py %{buildroot}%{_libdir}/nagios/plugins/check_eva.py 31 | install -D -p -m 0755 nrpe.d/check_eva.cfg %{buildroot}/etc/nrpe.d/check_eva.cfg 32 | 33 | %clean 34 | rm -rf %{buildroot} 35 | 36 | %files 37 | %defattr(-,root,root,-) 38 | %doc README LICENSE 39 | %{_libdir}/nagios/plugins/* 40 | /etc/nrpe.d/check_eva.cfg 41 | 42 | %changelog 43 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 44 | - Merge pull request #10 from gitmopp/patch-2 (palli-github@minor.is) 45 | - bug in for loop. Looped only once (mopp@gmx.net) 46 | - Fixed output to be more compatible (mopp@gmx.net) 47 | - check_eva new Make sure --timeout is an integer (palli@opensource.is) 48 | - check_eva new command line option --timeout (palli@opensource.is) 49 | - check_eva Fix undefined fix typos (palli@opensource.is) 50 | - PEP8 cleanup (palli@opensource.is) 51 | - merged (palli@opensource.is) 52 | - check_eva - minor bugfixes (palli@opensource.is) 53 | - check_eva.py more code cleanup with pycharm inspections (palli@opensource.is) 54 | - check_eva.py - Make code more readable (palli@opensource.is) 55 | - convert from tabs to spaces (palli@opensource.is) 56 | - check_eva - fix mixed tab/spaces (palli@opensource.is) 57 | - Update check_eva.py (sander.grendelman@gmail.com) 58 | 59 | * Thu Aug 23 2012 Pall Sigurdsson 1.0.2-1 60 | - changed sssu subcommands from being singlequoted to doublequoted for windows 61 | compatibility (palli@opensource.is) 62 | 63 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 64 | - new package built with tito 65 | 66 | * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 67 | - Initial packaging 68 | -------------------------------------------------------------------------------- /check_snmp/nagios-okplugin-check_snmp.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | Summary: Various nagios plugins to check cpu,memory,interfaces via SNMP 4 | Name: nagios-okplugin-check_snmp 5 | Version: 2 6 | Release: 2%{?dist} 7 | License: GPLv2+ 8 | Group: Applications/System 9 | URL: http://opensource.is/trac/wiki/check_snmp 10 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_snmp/releases/nagios-okplugin-check_snmp-%{version}.tar.gz 11 | Requires: perl-Net-SNMP 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Gardar Thorsteinsson 14 | 15 | 16 | %description 17 | Various nagios plugins to check cpu,memory,interfaces via SNMP 18 | 19 | %prep 20 | %setup -q 21 | #perl -pi -e "s|/usr/lib|%{_libdir}|g" nrpe.d/check_hpacucli.cfg 22 | 23 | %global __requires_exclude %{?__requires_exclude:%__requires_exclude}|}^perl\\(utils\\) 24 | 25 | %build 26 | 27 | 28 | %install 29 | rm -rf %{buildroot} 30 | install -D -p -m 0755 check_snmp_connectivity %{buildroot}%{_libdir}/nagios/plugins/check_snmp_connectivity 31 | install -D -p -m 0755 check_snmp_cpfw.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_cpfw.pl 32 | install -D -p -m 0755 check_snmp_env.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_env.pl 33 | install -D -p -m 0755 check_snmp_interfaces %{buildroot}%{_libdir}/nagios/plugins/check_snmp_interfaces 34 | install -D -p -m 0755 check_snmp_int.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_int.pl 35 | install -D -p -m 0755 check_snmp_load.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_load.pl 36 | install -D -p -m 0755 check_snmp_mem.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_mem.pl 37 | install -D -p -m 0755 check_snmp_patchlevel.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_patchlevel.pl 38 | install -D -p -m 0755 check_snmp_temperature.pl %{buildroot}%{_libdir}/nagios/plugins/check_snmp_temperature.pl 39 | 40 | 41 | %clean 42 | rm -rf %{buildroot} 43 | 44 | %files 45 | %defattr(-,root,root,-) 46 | #%doc README LICENSE 47 | %{_libdir}/nagios/plugins/* 48 | 49 | %changelog 50 | * Fri May 09 2018 Gardar Thorsteinsson 2-2 51 | - Filter out perl-utils dep 52 | 53 | * Thu Feb 20 2014 Pall Sigurdsson 2-1 54 | - make sure nagios does not run us in embedded perl (palli@opensource.is) 55 | 56 | * Mon Mar 12 2012 Pall Sigurdsson 1.0.1-1 57 | - new package built with tito 58 | 59 | * Mon Mar 1 2010 Pall Sigurdsson 0.1-1 60 | - Initial packaging 61 | -------------------------------------------------------------------------------- /misc/check_oracle_query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import pynag.Plugins 4 | import cx_Oracle 5 | 6 | helper = pynag.Plugins.PluginHelper() 7 | 8 | 9 | helper.parser.add_option('--username', help="Username to the database", dest="username") 10 | helper.parser.add_option('--password', help="Log in with this password", dest="password") 11 | helper.parser.add_option('--tns', help="TNS name to use", dest="tns") 12 | helper.parser.add_option('--query', help="MSSQL Query to execute", dest="query") 13 | helper.parser.add_option('--oracle_home', help="Set $ORACLE_HOME to this", dest="oracle_home") 14 | 15 | # When parse_arguments is called some default options like --threshold and --no-longoutput are automatically added 16 | helper.parse_arguments() 17 | 18 | 19 | username = helper.options.username 20 | password = helper.options.password 21 | tns = helper.options.tns 22 | query = helper.options.query 23 | 24 | enable_debugging = helper.options.verbose 25 | 26 | def debug(message): 27 | if enable_debugging: 28 | print "debug: %s" % str(message) 29 | 30 | 31 | if not username: 32 | helper.parser.error('--username is required') 33 | if not password: 34 | helper.parser.error('--password is required') 35 | if not tns: 36 | helper.parser.error('--tns is required') 37 | #if not oracle_home is None: 38 | 39 | 40 | 41 | 42 | 43 | # Actual coding logic starts 44 | 45 | conn = cx_Oracle.connect(username, password, tns) 46 | debug("connecting to host") 47 | cur = conn.cursor() 48 | debug("Executing sql query: %s" % query) 49 | cur.execute(query) 50 | 51 | status,text = None,None 52 | problem_items = 0 53 | total_items = 0 54 | for row in cur: 55 | total_items += 1 56 | debug(row) 57 | if len(row) > 0: 58 | status = row[0] 59 | if len(row) > 1: 60 | text = row[1] 61 | else: 62 | text = "" 63 | if text == '': 64 | text = "No text in this field" 65 | if status not in pynag.Plugins.state_text: 66 | helper.add_summary("Invalid status: %s" % status) 67 | status = pynag.Plugins.unknown 68 | if status > 0: 69 | problem_items += 1 70 | helper.add_summary(text) 71 | 72 | helper.status(status) 73 | helper.add_long_output("%s: %s" % (pynag.Plugins.state_text.get(status,'unknown'), text) ) 74 | 75 | if total_items == 0: 76 | helper.add_summary("SQL Query returned 0 rows") 77 | helper.status(pynag.Plugins.unknown) 78 | if not helper.get_summary(): 79 | helper.add_summary("%s items checked. %s problems" % (total_items, problem_items)) 80 | 81 | helper.check_all_metrics() 82 | helper.exit() 83 | -------------------------------------------------------------------------------- /check_rhcs/check_rhcs_manualfencing.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # Checks uptime of a specified host, using NRPE is host is remote 21 | 22 | HOSTN="localhost" # By default check localhost 23 | CHECK_COMMAND="test ! -p /tmp/fence_manual.fifo" # Default command to check selinux status 24 | 25 | print_help() { 26 | echo "check_rhcs_fencing version $VERSION" 27 | echo "This plugin checks if there is Manual ACK is required for RHCS fencing" 28 | echo "" 29 | echo "Usage: $0 [-H ]" 30 | echo "" 31 | echo "Example: Check if fencing is required on localhost" 32 | echo "# check_rhcs_fencing.sh" 33 | } 34 | 35 | #if [ $# -eq 0 ]; then 36 | # print_help ; 37 | # exit $UNKNOWN 38 | #fi 39 | 40 | 41 | # Parse arguments 42 | while [ $# -gt 0 ] 43 | do 44 | case $1 45 | in 46 | -H) 47 | HOSTN=$2 48 | shift 2 49 | ;; 50 | 51 | *) 52 | print_help ; 53 | exit $UNKNOWN 54 | ;; 55 | esac 56 | done 57 | 58 | 59 | 60 | # We we are not checking localhost, lets get remote uptime via NRPE 61 | if [ "$HOSTN" != "localhost" ]; then 62 | export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/nagios/usr/lib/nagios/plugins 63 | CHECK_COMMAND="check_nrpe -H $HOSTN -c check_rhcs_fencing" 64 | fi 65 | 66 | 67 | # Get the uptime, raise error if we are unsuccessful 68 | OUTPUT=`$CHECK_COMMAND` 69 | RESULT=$? 70 | 71 | if [ $RESULT -eq 2 ]; then 72 | echo "Error, could not run command $CHECK_COMMAND" 73 | echo "output:" 74 | echo "$OUTPUT" 75 | exit 3 76 | fi 77 | 78 | if [ $RESULT -gt 0 ]; then 79 | echo "Warning, /tmp/fence_manual.fifo exists on host $HOSTN. Manual fencing is required" 80 | exit 1 81 | else 82 | echo "Ok, No fencing required on host $HOSTN" 83 | exit 0 84 | fi 85 | -------------------------------------------------------------------------------- /check_storwize/README.md: -------------------------------------------------------------------------------- 1 | check_storwize.py 2 | ================= 3 | 4 | Nagios plugin to check the status of a remote Storwize disk array. 5 | 6 | This plugin is designed to be syntactically compatible with check_storwize.sh from nagios exchange 7 | with the following differences: 8 | 9 | - Outputs performance data 10 | - GPL License 11 | - Written in python 12 | - More stable plugin results when disk array is broken 13 | 14 | 15 | USAGE 16 | ============= 17 | ``` 18 | python check_storwize.py --help 19 | Usage: check_storwize.py [options] 20 | 21 | Options: 22 | -h, --help show this help message and exit 23 | -H HOSTNAME, -M HOSTNAME, --hostname=HOSTNAME 24 | Hostname or ip address 25 | -U USER, --user=USER Log in as this user to storwize 26 | -Q QUERY, --query=QUERY 27 | Query to send to storwize (see also -L) 28 | -L, --list-queries List of valid queries 29 | --test Run this plugin in test mode 30 | 31 | Generic Options: 32 | --timeout=50 Exit plugin with unknown status after x seconds 33 | --threshold=range Thresholds in standard nagios threshold format 34 | --th=range Same as --threshold 35 | --extra-opts=@file Read options from an ini file. See 36 | http://nagiosplugins.org/extra-opts 37 | -d, --debug Print debug info 38 | 39 | Display Options: 40 | -v, --verbose Print more verbose info 41 | --no-perfdata Dont show any performance data 42 | --no-longoutput Hide longoutput from the plugin output (i.e. only 43 | display first line of the output) 44 | --no-summary Hide summary from plugin output 45 | --get-metrics Print all available metrics and exit (can be combined 46 | with --verbose) 47 | --legacy Deprecated, do not use 48 | ``` 49 | 50 | EXAMPLES 51 | ======== 52 | ``` 53 | # List array status 54 | python check_storwize -H remote_host -U username -Q lsarray 55 | 56 | # List vdisk status 57 | python check_storwize -H remote_host -U username -Q lsarray 58 | 59 | ``` 60 | 61 | 62 | Valid modes 63 | =========== 64 | The following is a list of valid modes (at the time of this writing). For an up-to-date list consult check_storwize -L 65 | 66 | * lsarray 67 | * lsdrive 68 | * lsenclosurebattery 69 | * lsenclosurecanister 70 | * lsenclosurepsu 71 | * lsenclosureslot 72 | * lsenclosure 73 | * lsmdiskgrp 74 | * lsmdskgrp 75 | * lsmgrp 76 | * lsrcrelationship 77 | * lsvdisk 78 | -------------------------------------------------------------------------------- /check_selinux/check_selinux: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # Checks selinux status of a specified host, using NRPE if the host is remote 21 | 22 | HOSTN="localhost" # By default check localhost 23 | CHECK_COMMAND="getenforce" # Default command to check selinux status 24 | 25 | print_help() { 26 | echo "check_selinux version $VERSION" 27 | echo "This plugin checks selinux status of a remote host" 28 | echo "" 29 | echo "Usage: $0 -H -s " 30 | echo "" 31 | echo "Example: Check if remote host is Enforcing" 32 | echo "# check_selinux -H remotehost -s Enforcing" 33 | } 34 | 35 | if [ $# -eq 0 ]; then 36 | print_help ; 37 | exit $UNKNOWN 38 | fi 39 | 40 | 41 | # Parse arguments 42 | while [ $# -gt 0 ] 43 | do 44 | case $1 45 | in 46 | -H) 47 | HOSTN=$2 48 | shift 2 49 | ;; 50 | 51 | -s) 52 | STATUS=$2 53 | shift 2 54 | ;; 55 | 56 | *) 57 | print_help ; 58 | exit $UNKNOWN 59 | ;; 60 | esac 61 | done 62 | 63 | 64 | 65 | # We we are not checking localhost, lets get remote selinux status via NRPE 66 | if [ "$HOSTN" != "localhost" ]; then 67 | export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/nagios/usr/lib/nagios/plugins 68 | CHECK_COMMAND="check_nrpe -H $HOSTN -c get_selinux" 69 | fi 70 | 71 | 72 | # Get the selinux status, raise error if we are unsuccessful 73 | OUTPUT=`$CHECK_COMMAND` 74 | RESULT=$? 75 | 76 | if [ $RESULT -gt 0 ]; then 77 | echo "UNKNOWN - Could not run command $CHECK_COMMAND" 78 | echo "Error was: $OUTPUT" 79 | exit 3 80 | fi 81 | 82 | # Parse the output from the command 83 | if [ "$OUTPUT" == "$STATUS" ]; then 84 | echo "OK - SELinux status is $OUTPUT" 85 | exit 0 86 | else 87 | echo "WARNING - SELinux status is $OUTPUT (supposed to be $STATUS)" 88 | exit 1 89 | fi 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /check_http_ntlm/check_http_ntlm.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # 02/Feb/10 nagios@sanxiago.com 4 | # check_http page for IIS servers with ntlm authentication 5 | # 6 | # this check receives a URL as a parameter, logins to the IIS server 7 | # using the curl binary, then it parses the output of the command 8 | # and captures the response code. Timeout pass and user values are currently hardcoded 9 | # script currently only has handlers for some response codes, but a switch was used to 10 | # add more in an easy way. Response code is found with regexp /HTTP\/1\.1 ([0-9]{3}) .*/ 11 | 12 | use Switch; 13 | use Time::HiRes; 14 | 15 | if (@ARGV < 3) { 16 | print "Usage $0 \n"; 17 | exit 2; 18 | } 19 | 20 | $uri=$ARGV[2]; # URL OF THE PAGE WE WANT TO CHEK 21 | $user=$ARGV[0]; # User 22 | $pass=$ARGV[1]; # Password 23 | $timeout=30; # Timeout in seconds 24 | 25 | $start = Time::HiRes::time(); 26 | run_command("curl -u $user:$pass --ntlm --stderr /dev/null $uri -i "); 27 | $time = sprintf("%.2f",Time::HiRes::time()-$start); 28 | 29 | switch ($http_code){ 30 | case 200 {print $time."s $http_code OK | \"response_time\"=$time" . "s\n"; exit(0);} 31 | case 302 {print $time."s $http_code PAGE MOVED | \"response_time\"=$time" . "s\n"; exit(1);} 32 | case 403 {print $time."s $http_code Forbidden | \"response_time\"=$time" . "s\n"; exit(1);} 33 | case 404 {print $time."s $http_code PAGE NOT FOUND | \"response_time\"=$time" . "s\n"; exit(2);} 34 | case 500 {print $time."s $http_code SERVER ERROR | \"response_time\"=$time" . "s\n"; exit(2);} 35 | case 401 {print $time."s $http_code UNAUTHORIZED | \"response_time\"=$time" . "s\n"; exit(1);} 36 | else {print $time."s $http_code ERROR $http_code $output | \"response_time\"=$time" . "s\n"; exit(2);} 37 | } 38 | 39 | sub run_command { 40 | $command=shift; 41 | $command_name=$command; 42 | $command_name=~ s/\n/\s/; 43 | $pid = open(PIPE, "$command |") or die $!; 44 | eval { 45 | $output=""; 46 | local $SIG{ALRM} = sub { die "TIMEDOUT" }; 47 | alarm($timeout); 48 | while () { 49 | print if ($ARGV[3]); 50 | if($_=~/HTTP\/1\.1 ([0-9]{3}) .*/ && $authentication_sent){ 51 | $http_code=$1; 52 | } 53 | if($_=~/WWW-Authenticate/){ 54 | $authentication_sent=1; 55 | } 56 | $output=$output.$_; 57 | } 58 | close(PIPE); 59 | }; 60 | if ($@) { 61 | die $@ unless $@ =~ /TIMEDOUT/; 62 | print "TIMEOUT"; 63 | kill 9, $pid; 64 | $? ||= 9; 65 | exit(2); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /check_rhcs/nagios-okplugin-check_rhcs.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | 3 | %define plugin_name check_rhcs 4 | %define version 0.0.4 5 | 6 | 7 | Summary: A Nagios plugin to check Red Hat Cluster suite (rhel5 and rhel6) 8 | Name: nagios-okplugin-%{plugin_name} 9 | Version: 1 10 | Release: 1%{?dist} 11 | License: GPLv2+ 12 | Group: Applications/System 13 | URL: http://opensource.is/trac/wiki/%{plugin_name} 14 | Source0: http://opensource.ok.is/trac/browser/nagios-plugins/%{plugin_name}/releases/%{name}-%{version}.tar.gz 15 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 16 | Packager: Pall Sigurdsson 17 | 18 | 19 | %description 20 | %{summary} 21 | 22 | %prep 23 | %setup -q 24 | perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/%{plugin_name}.cfg 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 check_rhcs %{buildroot}%{_libdir}/nagios/plugins/check_rhcs 32 | install -D -p -m 0755 check_rhcs_cman_group.sh %{buildroot}%{_libdir}/nagios/plugins/check_rhcs_cman_group.sh 33 | install -D -p -m 0755 check_rhcs_manualfencing.sh %{buildroot}%{_libdir}/nagios/plugins/check_rhcs_manualfencing.sh 34 | install -D -p -m 0755 check_rhcs_fence %{buildroot}%{_libdir}/nagios/plugins/check_rhcs_fence 35 | 36 | install -D -p -m 0755 nrpe.d/%{plugin_name}.cfg %{buildroot}/etc/nrpe.d/%{plugin_name}.cfg 37 | 38 | %clean 39 | rm -rf %{buildroot} 40 | 41 | %files 42 | %defattr(-,root,root,-) 43 | #%doc README LICENSE 44 | %{_libdir}/nagios/plugins/* 45 | /etc/nrpe.d/%{plugin_name}.cfg 46 | 47 | %changelog 48 | * Thu Feb 20 2014 Pall Sigurdsson 1-1 49 | - Updated rhcs nrpe config as well (tommi@tommi.org) 50 | - Added check for suspended services -Z (tommi@tommi.org) 51 | - Fix broken libdir on 64-bit platforms (palli@opensource.is) 52 | 53 | * Thu May 24 2012 Pall Sigurdsson 0.0.4-1 54 | - version bump of check_rhcs (palli@opensource.is) 55 | - check_rhcs_fence added for rhel6 compatibility (palli@opensource.is) 56 | - copy/paste error removed from spec file (palli@opensource.is) 57 | 58 | * Thu May 24 2012 Pall Sigurdsson 59 | - make sure plugin exits cleanly if unable to run clustat -fx command 60 | (palli@opensource.is) 61 | - check_rhcs_fence added for rhel6 compatibility (palli@opensource.is) 62 | - copy/paste error removed from spec file (palli@opensource.is) 63 | 64 | * Wed Mar 14 2012 Pall Sigurdsson 65 | - 66 | 67 | * Wed Mar 14 2012 Pall Sigurdsson 0.0.3-1 68 | - new package built with tito 69 | 70 | * Wed Mar 14 2012 Pall Sigurdsson 0.0.3-1 71 | - new package built with tito 72 | 73 | * Mon Mar 12 2012 Pall Sigurdsson 0.0.2-1 74 | - new package built with tito 75 | -------------------------------------------------------------------------------- /check_brocade/examples/services.cfg: -------------------------------------------------------------------------------- 1 | ########################################################### 2 | # Check Hardware Health on Brocade SAN Switches 3 | define service { 4 | name check-generic-brocade-health 5 | use generic-service 6 | 7 | service_description Hardware Health Status 8 | check_command check_brocade_san_env 9 | normal_check_interval 1 10 | retry_check_interval 1 11 | servicegroups brocade-san-switch-health 12 | 13 | action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$ 14 | 15 | register 0 16 | } 17 | 18 | # Development Load Average check 19 | define service { 20 | name check-generic-brocade-dev-health 21 | 22 | use check-generic-brocade-health 23 | 24 | 25 | contact_groups +brocade-dev-contacts 26 | register 0 27 | } 28 | 29 | # Test Load Average check 30 | define service { 31 | name check-generic-brocade-test-health 32 | 33 | use check-generic-brocade-health 34 | 35 | contact_groups +brocade-test-contacts 36 | register 0 37 | } 38 | 39 | # Production Load Average check 40 | define service { 41 | name check-generic-brocade-prod-health 42 | 43 | use check-generic-brocade-health 44 | 45 | contact_groups +brocade-prod-contacts 46 | register 0 47 | } 48 | 49 | 50 | ########################################################### 51 | # Check PING on a Brocade SAN Switch 52 | define service { 53 | name check-generic-brocade-ping 54 | use generic-service 55 | 56 | service_description PING 57 | check_command check_ping!200.0,20%!600.0,60% 58 | normal_check_interval 5 59 | retry_check_interval 1 60 | 61 | action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$ 62 | 63 | register 0 64 | } 65 | 66 | # Development service check 67 | define service { 68 | name check-generic-brocade-dev-ping 69 | 70 | use check-generic-brocade-ping 71 | 72 | contact_groups +brocade-dev-contacts 73 | register 0 74 | } 75 | 76 | # Test service check 77 | define service { 78 | name check-generic-brocade-test-ping 79 | 80 | use check-generic-brocade-ping 81 | 82 | contact_groups +brocade-test-contacts 83 | register 0 84 | } 85 | 86 | # Production service check 87 | define service { 88 | name check-generic-brocade-prod-ping 89 | 90 | use check-generic-brocade-ping 91 | 92 | contact_groups +brocade-prod-contacts 93 | register 0 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /check_package_updates/nagios-okplugin-check_package_updates.spec: -------------------------------------------------------------------------------- 1 | %define debug_package %{nil} 2 | %define plugin check_package_updates 3 | 4 | Summary: A Nagios plugin to check operating system updates 5 | Name: nagios-okplugin-%{plugin} 6 | Version: 0.0.7 7 | Release: 1%{?dist} 8 | License: GPLv3+ 9 | Group: Applications/System 10 | URL: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin} 11 | Source0: https://github.com/opinkerfi/nagios-plugins/tree/master/%{plugin}/releases/%{name}-%{version}.tar.gz 12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 13 | Packager: Tomas Edwardsson 14 | BuildArch: noarch 15 | Requires: nrpe 16 | Requires: pynag 17 | Requires: PackageKit 18 | 19 | 20 | %description 21 | Checks updates via PackageKit and can notify on various different situations 22 | 23 | %prep 24 | %setup -q 25 | 26 | %build 27 | 28 | 29 | %install 30 | rm -rf %{buildroot} 31 | install -D -p -m 0755 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 32 | mkdir -p %{buildroot}%{_sysconfdir}/nrpe.d 33 | sed "s^/usr/lib64^%{_libdir}^g" nrpe.d/%{plugin}.cfg > %{buildroot}%{_sysconfdir}/nrpe.d/%{plugin}.cfg 34 | # Temporary fix for selinux 35 | chcon system_u:object_r:nagios_unconfined_plugin_exec_t:s0 %{plugin} %{buildroot}%{_libdir}/nagios/plugins/%{plugin} 36 | 37 | %clean 38 | rm -rf %{buildroot} 39 | 40 | %post 41 | /sbin/service nrpe status &> /dev/null && /sbin/service nrpe reload || : 42 | 43 | %files 44 | %defattr(-,root,root,-) 45 | %doc README.md 46 | %{_libdir}/nagios/plugins/* 47 | %config(noreplace) %{_sysconfdir}/nrpe.d/%{plugin}.cfg 48 | 49 | %changelog 50 | * Fri Sep 13 2013 Tomas Edwardsson 0.0.7-1 51 | - check_package_updates - minor refactor (palli@opensource.is) 52 | - check_package_updates - fix inconsistent tab/space (palli@opensource.is) 53 | - Removed obsoletes and thresholds (tommi@tommi.org) 54 | - Removed Draft, should be working pretty good (tommi@tommi.org) 55 | - Added --legacy to default since that is the default format (tommi@tommi.org) 56 | - Added nrpe reload since moving from check_yum needs it (tommi@tommi.org) 57 | - Added obsolete for okplugin check_updates (tommi@tommi.org) 58 | 59 | * Tue Jul 16 2013 Tomas Edwardsson 0.0.6-1 60 | - Fix failure on a fully patched system (tommi@tommi.org) 61 | 62 | * Tue Jul 16 2013 Tomas Edwardsson 0.0.5-1 63 | - Known types always have a metric, even if 0 (tommi@tommi.org) 64 | 65 | * Tue Jul 16 2013 Tomas Edwardsson 0.0.4-1 66 | - new package built with tito 67 | 68 | * Tue Jul 16 2013 Tomas Edwardsson 0.0.3-1 69 | - Plugin should conflict with check_yum (tommi@tommi.org) 70 | - No obsolete (tommi@tommi.org) 71 | - Obsolete nagios-okplugin-check_yum (tommi@tommi.org) 72 | 73 | * Tue Jul 16 2013 Tomas Edwardsson 0.0.2-1 74 | - new package built with tito 75 | 76 | * Wed Jul 16 2013 Tomas Edwardsson 0.0.1-1 77 | - Initial Packaging 78 | -------------------------------------------------------------------------------- /check_linux_modules.pl/check_linux_modules.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | ## 3 | ## Copyright 2010, Tomas Edwardsson 4 | ## 5 | ## This script is free software: you can redistribute it and/or modify 6 | ## it under the terms of the GNU General Public License as published by 7 | ## the Free Software Foundation, either version 3 of the License, or 8 | ## (at your option) any later version. 9 | ## 10 | ## This script is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ## GNU General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU General Public License 16 | ## along with this program. If not, see . 17 | # 18 | use strict; 19 | 20 | if (!@ARGV) { 21 | print "CRITICAL usage, $0 [module module..]\n"; 22 | exit 2; 23 | } 24 | 25 | sub check_modules($@) { 26 | my $kernel = shift; 27 | my @modules = @_; 28 | 29 | my $failed_string = ''; 30 | foreach my $mod (@modules) { 31 | if (!-f "/lib/modules/$kernel/$mod") { 32 | $failed_string .= "/lib/modules/$kernel/$mod, "; 33 | } 34 | } 35 | chop($failed_string) for (0..1); 36 | if ($failed_string) { 37 | print "WARNING, missing modules for boot kernel, $failed_string\n"; 38 | exit 1; 39 | } 40 | print "OK, all modules in place\n"; 41 | exit 0; 42 | } 43 | 44 | 45 | sub get_latest_kernel() { 46 | 47 | 48 | unless (open GRUBCONF, ') { 63 | # Strip newline characters 64 | chomp($line); 65 | 66 | # Search for default=\d 67 | if ($default == -1) { 68 | if ($line =~ /^default=(\d+)$/) { 69 | $default = ($1 + 1); 70 | } 71 | # Search title 72 | } elsif (!$title) { 73 | if ($line =~ /^title /) { 74 | $titlenum++; 75 | } 76 | $title = $line if ($titlenum == $default); 77 | # Find the kernel 78 | } else { 79 | if ($line =~ /kernel.\/vmlinuz-(\S+) /) { 80 | $kernel = $1; 81 | last; 82 | } 83 | } 84 | } 85 | if ($default == -1) { 86 | print "WARNING, No default= found in grub.conf\n"; 87 | exit 1; 88 | } elsif (!$title) { 89 | print "WARNING, No title found for default=$default in grub.conf\n"; 90 | exit 1; 91 | } elsif (!$kernel) { 92 | print "WARNING, No kernel found for kernel title \"$title\"\n"; 93 | exit 1; 94 | } 95 | return $kernel; 96 | } 97 | 98 | 99 | my $kernel = get_latest_kernel(); 100 | check_modules($kernel, @ARGV); 101 | 102 | __END__ 103 | 104 | title Red Hat Enterprise Linux Server (2.6.18-128.1.6.el5PAE) 105 | root (hd0,0) 106 | kernel /vmlinuz-2.6.18-128.1.6.el5PAE ro root=/dev/vg00/LogVolRoot 107 | 108 | -------------------------------------------------------------------------------- /check_exchange/check_exchange_storagegroups.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # check_exchange.pl is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # check_exchange.pl is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | # This script will check Active Client Logons for every storagegroup in exchange of a given host (via NRPE) 19 | # Useful to find dismounted storagegroups 20 | # Author Pall Sigurdsson 21 | # 22 | 23 | $HOSTNAME=$ARGV[0]; 24 | $OK=0; 25 | $WARNING=1; 26 | $CRITICAL=2; 27 | $UNKNOWN=3; 28 | $EXIT_CODE=$UNKNOWN; 29 | 30 | $counter="MSExchangeIS Mailbox"; 31 | $field="Client Logons"; 32 | 33 | #$result = `/usr/lib/nagios/plugins/check_nrpe -H $HOSTNAME -c listCounterInstances -a $counter`; 34 | #$result="NL-AMERICA-02, NL-AFRICA-01, NL-AMERICA-03, Mailbox Database 0898192844, NL-AUSTRALASIA-02, IS-ICELAND-03, IS-ICELAND-01, NL-EAST-EUROPE-02, NL-EAST-EUROPE-01, IS-ICELAND-05, IS-ICELAND-02, IS-ICELAND-04, NL-AUSTRALASIA-01, NL-AMERICA-01, IS-ICELAND-06, NL-WEST-EUROPE-02, NL-WEST-EUROPE-01, IS-ICELAND-07, NL-WEST-EUROPE-03, _Total"; 35 | $result=$ARGV[1]; 36 | 37 | @instances = split(/\,/, $result); 38 | @instances = sort(@instances); 39 | @warning_instances =(); 40 | 41 | $minwarn=1; 42 | $longserviceoutput=""; 43 | $summary=""; 44 | 45 | #[root@nagios ~]# check_nrpe -H $HOSTNAME -c CheckCounter -a "Counter:Vanskilaskra=\SQLServer:Databases(Vanskilaskra)\Data File(s) Size (KB)"# OK all counters within bounds.|'Vanskilaskra'=30996480;0;0; 46 | $num_items = 0; 47 | $perfdata = ""; 48 | foreach $item (@instances) 49 | { 50 | # Strip whitespace 51 | $item =~ s/^\s*(.*?)\s*$/$1/; 52 | 53 | # Call check_nrpe 54 | $result = `/usr/lib/nagios/plugins/check_nrpe -H $HOSTNAME -c CheckCounter -a 'Counter:$item=\\$counter($item)\\$field' MinWarn=$minwarn ShowAll`; 55 | push(@warning_instances,$item) if $? > 0; 56 | 57 | # Strip everything but the performance data 58 | $result =~ /^(.*)\|(.*?)$/; 59 | $current_perfdata = $2; 60 | $current_result = $1; 61 | chomp($current_perfdata); 62 | $longserviceoutput = $longserviceoutput . $current_result . "\n"; 63 | $perfdata = $perfdata . " " . $current_perfdata; 64 | $num_databases = $num_databases + 1; 65 | 66 | 67 | } 68 | 69 | $num_instances=scalar(@instances); 70 | $summary="$num_instances databases found in $HOSTNAME"; 71 | $EXIT_CODE=$OK; 72 | if (scalar(@warning_instances) > 0) { 73 | $summary= "$summary (check @warning_instances)"; 74 | $EXIT_CODE=$WARNING; 75 | } 76 | 77 | print "$summary | $perfdata \n"; 78 | print $longserviceoutput; 79 | exit $EXIT_CODE; 80 | 81 | -------------------------------------------------------------------------------- /check_ifoperstate/check_ifoperstate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright 2013, Tomas Edwardsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # Enumerates interfaces and their operstate (up/down/unknown). 19 | 20 | __author__ = 'Tomas Edwardsson ' 21 | 22 | from subprocess import PIPE, Popen 23 | import os 24 | import sys 25 | from pynag.Plugins import PluginHelper, ok, critical, unknown 26 | 27 | helper = PluginHelper() 28 | 29 | helper.parser.add_option('-I', "--interface", help="Interface (eth0/bond/em/..) multiple supported with -I ... -I ...", 30 | dest="interfaces", action="append") 31 | helper.parser.add_option('-H', "--hostname", help="Check interface on remote host", dest="host_name") 32 | helper.parser.add_option('-l', "--list-interfaces", help="List interfaces", dest="list_interfaces", action="store_true") 33 | 34 | helper.parse_arguments() 35 | 36 | local_env = os.environ 37 | local_env["PATH"] += ":%s" % (":".join([ 38 | "/usr/lib/nagios/plugins", 39 | "/usr/lib64/nagios/plugins", 40 | "/usr/local/libexec", 41 | "/usr/libexec", 42 | "/usr/local/nagios/libexec"])) 43 | 44 | if helper.options.host_name: 45 | command = ("check_nrpe -H %s -c get_ifoperstate" % helper.options.host_name).split() 46 | else: 47 | command = ["get_ifoperstate.sh"] 48 | 49 | 50 | # List the interfaces and exit 51 | def get_interfaces(): 52 | interfaces = [] 53 | try: 54 | cmd = Popen(command, stdout=PIPE, shell=False) 55 | for line in cmd.stdout.readlines(): 56 | interface, status = line.strip().split(":") 57 | interfaces.append((interface, status)) 58 | 59 | except Exception, e: 60 | helper.add_summary("Unable to get interfaces \"%s\": %s" % (" ".join(command), e)) 61 | helper.status(unknown) 62 | helper.exit() 63 | return interfaces 64 | 65 | interface_state = get_interfaces() 66 | 67 | if helper.options.list_interfaces: 68 | for interface in interface_state: 69 | print "%-20s %s" % (interface[0], interface[1]) 70 | sys.exit(0) 71 | 72 | 73 | for interface in interface_state: 74 | if not helper.options.interfaces or interface[0] in helper.options.interfaces: 75 | if interface[1] == "unknown": 76 | helper.add_status(unknown) 77 | elif interface[1] == "up": 78 | helper.add_status(ok) 79 | else: 80 | helper.add_status(critical) 81 | helper.add_long_output("%s operstate is %s" % (interface[0], interface[1])) 82 | 83 | helper.check_all_metrics() 84 | helper.exit() 85 | -------------------------------------------------------------------------------- /check_http_multi/check_http_multi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright 2013, Tomas Edwardsson 3 | # 4 | # This script is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This script is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | 17 | from pynag.Plugins import PluginHelper, critical, warning, ok 18 | import requests 19 | import time 20 | import signal 21 | 22 | 23 | class TimeoutException(Exception): 24 | pass 25 | 26 | 27 | def signal_alarm(signo, frame): 28 | raise TimeoutException() 29 | 30 | 31 | def main(): 32 | plugin = PluginHelper() 33 | 34 | plugin.parser.add_option('-u', help="http uris", dest="uri", action="append") 35 | plugin.parse_arguments() 36 | 37 | if not plugin.options.uri: 38 | plugin.parser.error("-u (uri) argument is required") 39 | 40 | start_time = time.time() 41 | # Assign timeout handler 42 | signal.signal(signal.SIGALRM, signal_alarm) 43 | 44 | success = 0 45 | failed = 0 46 | for uri in plugin.options.uri: 47 | if not uri: continue 48 | webstate, status = check_website(uri) 49 | if webstate: 50 | success += 1 51 | plugin.add_long_output("%s fetched in %s seconds" % (uri, status)) 52 | plugin.add_metric(uri, status, uom="s") 53 | 54 | else: 55 | failed += 1 56 | plugin.add_long_output("%s failed, %s" % (uri, status)) 57 | 58 | plugin.add_summary("Checked %i uris, %i failed" % ((failed + success), failed)) 59 | plugin.status(ok) 60 | plugin.add_metric("failed", failed) 61 | plugin.add_metric("failed_percentage", (100 * failed / float(failed + success)), uom="%") 62 | plugin.add_metric("runtime", time.time() - start_time, uom="s") 63 | plugin.check_all_metrics() 64 | 65 | plugin.exit() 66 | 67 | 68 | 69 | def check_website(uri, timeout=10): 70 | """Tries fetching the uri specified 71 | returns (False, "Invalid status code ") on any failure and status code other than 2XX 72 | returns (None, "Timeout in %f seconds") on timeout 73 | returns (True, time (float)) it took to fetch the website on success""" 74 | 75 | start_time = time.time() 76 | signal.alarm(timeout) 77 | try: 78 | req = requests.get(uri) 79 | if str(req.status_code)[0] != "2": 80 | return False, "Invalid HTTP status: " + str(req.status_code) 81 | except TimeoutException: 82 | return None, "Timeout in %.2f seconds" % (time.time() - start_time) 83 | except Exception, e: 84 | return False, "Error encountered: " + e.message 85 | signal.alarm(0) 86 | return True, "%.2f" % (time.time() - start_time) 87 | 88 | 89 | if __name__ == "__main__": 90 | main() 91 | -------------------------------------------------------------------------------- /check_dataprotector/check_dp_backups: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Copyright 2010, Pall Sigurdsson 5 | # 6 | # This script is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This script is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | # About this script 20 | # 21 | # This script collects statistics about all Dataprotector sessions for today 22 | # Does not do any checking, only used for trending purposes 23 | 24 | 25 | import subprocess 26 | import datetime 27 | import sys 28 | now = datetime.datetime.now() 29 | 30 | 31 | # return code 3 = No sessions matching the search criteria were found. 32 | omnistat_returncode_no_sessions_found=3 33 | class GenericObject: 34 | def __init__(self): 35 | self.dict = {} 36 | 37 | def runCommand(command): 38 | proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE,) 39 | stdout, stderr = proc.communicate('through stdin to stdout') 40 | if proc.returncode > 0 and proc.returncode != omnistat_returncode_no_sessions_found: 41 | print "Error running '%s' command:\n %s" % (command, stderr) 42 | print proc.returncode 43 | print stderr, stdout 44 | sys.exit(1) 45 | else: 46 | return stdout 47 | 48 | def getSessions(): 49 | sessions = [] 50 | date = "%s/%s/%s" % ( now.year, now.month, now.day ) 51 | output = runCommand( '/opt/omni/bin/omnistat -previous -since %s' % date ) 52 | for line in output.split('\n')[1:]: 53 | tmp = line.split() 54 | if len(tmp) < 4: continue 55 | sessionID = tmp[0] 56 | sessions.append( sessionID ) 57 | #print sessionID 58 | return sessions 59 | 60 | def parseSessions(session_list): 61 | parsedSessions = [] 62 | for sessionID in session_list: 63 | output = runCommand('/opt/omni/bin/omnidb -rpt %s -detail' % sessionID ) 64 | session = GenericObject() 65 | parsedSessions.append ( session ) 66 | for line in output.split('\n'): 67 | tmp = line.split(':') 68 | if len(tmp) != 2: continue 69 | key,value = tmp 70 | key = key.strip() 71 | value = value.strip() 72 | session.dict[key] = value 73 | return parsedSessions 74 | 75 | sessions = getSessions() 76 | parsedSessions = parseSessions( sessions ) 77 | 78 | 79 | total_errors = 0 80 | total_warnings = 0 81 | total_size = 0 82 | total_sessions = 0 83 | for session in parsedSessions: 84 | errors = int( session.dict['Number of errors'] ) 85 | warnings = int( session.dict['Number of warnings'] ) 86 | try: 87 | size = 1024 * int( session.dict['Session size'].split()[0] ) 88 | except: 89 | size = 0 90 | total_errors = total_errors + errors 91 | total_warnings = total_warnings + warnings 92 | total_size = total_size + size 93 | total_sessions += 1 94 | 95 | print "Everything is ok | 'errors'=%d 'warnings'=%d 'size'=%dB 'num_sessions'=%dc" % (total_errors,total_warnings,total_size,total_sessions) 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /check_bond/check_bond: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2010, Tomas Edwardsson 4 | # 5 | # check_bond.py is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # check_bond.py is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | import pprint 19 | import re 20 | import sys 21 | import getopt 22 | 23 | 24 | 25 | def readbond( interface ): 26 | intfile = "/proc/net/bonding/%s" % interface 27 | 28 | # Read interface info 29 | try: 30 | bondfh = open (intfile, 'r') 31 | except IOError, (errno, strerror): 32 | print "Unable to open bond %s: %s" % (intfile, strerror) 33 | sys.exit(3) 34 | except: 35 | print "Unexpected error:", sys.exc_info()[0] 36 | sys.exit(3) 37 | 38 | # Initialize bond data 39 | bond = {} 40 | bond['slaves'] = [] 41 | 42 | # Which interface are we working with 43 | current_int = '' 44 | 45 | # Loop throught the file contents 46 | for line in bondfh.readlines(): 47 | # Remove newlines and split on colon, ignore other 48 | try: 49 | k, v = line.replace('\n', '').split(': ', 1) 50 | except: 51 | pass 52 | 53 | # Remove leading whitespaces 54 | k = re.sub('^\s*', '', k) 55 | # Bonding mode for the channel 56 | if k == "Bonding Mode": 57 | bond['bonding_mode'] = v 58 | # Record current slave interface 59 | elif k == "Slave Interface": 60 | current_int = v 61 | # Slave interface mii status 62 | elif current_int and k == "MII Status": 63 | bond['slaves'].append( { 'int' : current_int, 'mii_status' : v }) 64 | # Bond mii status 65 | elif k == "MII Status": 66 | bond['mii_status'] = v 67 | 68 | return bond 69 | 70 | def usage(): 71 | print "Usage: %s -i bond0" % sys.argv[0] 72 | sys.exit(3) 73 | 74 | def main(argv): 75 | # Set variables 76 | interface = '' 77 | outstring = '' 78 | retval = 0 79 | 80 | # Nagios return code states 81 | states = { 0 : 'OK', 1 : 'Warning', 2 : 'Critical', 3 : 'Unknown' } 82 | 83 | # Try to read the arguments 84 | try: 85 | opts, args = getopt.getopt(argv, "hi:", ["help", "interface="]) 86 | except getopt.GetoptError: 87 | usage() 88 | sys.exit(3) 89 | 90 | 91 | for opt, arg in opts: 92 | if opt in ("-h", "--help"): 93 | usage() 94 | sys.exit(3) 95 | elif opt in ("-i", "--interface"): 96 | interface = arg 97 | 98 | if (interface == ""): 99 | usage() 100 | sys.exit(3) 101 | 102 | bond = readbond(interface) 103 | 104 | # The whole bond is down 105 | if bond['mii_status'] != 'up': 106 | print "Critical: bonding device %s %s" % (interface, bond['mii_status']) 107 | sys.exit(2) 108 | 109 | # Some interface in the bond is down 110 | for slave in bond['slaves']: 111 | if slave['mii_status'] != 'up': 112 | outstring = "%s%s down " % (outstring, slave['int']) 113 | if retval < 1: 114 | retval = 1 115 | 116 | if retval: 117 | print "%s: %s%s %s" % (states[retval], outstring, "in bonding device", interface) 118 | sys.exit(retval) 119 | 120 | print "OK: bonding device %s up and running" % interface 121 | sys.exit(0) 122 | 123 | 124 | if __name__ == "__main__": 125 | main(sys.argv[1:]) 126 | -------------------------------------------------------------------------------- /check_windows_dfs.pl/check_windows_dfs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Copyright 2010, Tomas Edwardsson 4 | # 5 | # check_windows_dfs.pl is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # windows_dfs.pl is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | use Nagios::Plugin; 19 | use strict; 20 | 21 | 22 | # PATH to check_nrpe 23 | my $nrpepath = '/usr/lib64/nagios/plugins/check_nrpe'; 24 | 25 | 26 | # Create the Nagios plugin object 27 | my $np = Nagios::Plugin->new( 28 | usage => "Usage: %s -H -c ", 29 | version => "0.01", 30 | ); 31 | 32 | 33 | # Add valid arguments 34 | $np->add_arg( 35 | spec => 'hostname|H=s', 36 | help => '-H, --hostname=', 37 | required => 1, 38 | ); 39 | 40 | $np->add_arg( 41 | spec => 'longserviceoutput|l', 42 | help => '-l, --longserviceoutput', 43 | default => undef, 44 | required => 0, 45 | ); 46 | 47 | # Parse Arguments 48 | $np->getopts(); 49 | 50 | 51 | 52 | open NRPE, $nrpepath . " -H " . $np->opts->hostname . " -c get_dfsdiag_testdcs|" or 53 | nagios_exit(UNKNOWN, "Unable to execute NRPE: $!"); 54 | 55 | 56 | 57 | # Result 58 | my @results = (); 59 | 60 | # First line, for NRPE run problems 61 | my $first_line = ''; 62 | 63 | # Loop through each installed sensor 64 | while (my $line = ) { 65 | print "NRPE Output: $line" if ($np->opts->verbose); 66 | #NRPE Output: DFSDIAG_INFO - APPL - DFS Service on SMSADL5 is OK. 67 | 68 | $line =~ s/[\n\r]//g; 69 | $line =~ s/[\.,]$//g; 70 | $first_line = $line if (!$first_line); 71 | if ($line =~ /^\s*DFSDIAG_(\S+) - (.*) - (.*)$/) { 72 | next if ($1 eq 'ERROR' and $3 eq 'Access is denied'); 73 | push @results, { "state" => $1, "source" => $2, "message" => $3 }; 74 | } 75 | } 76 | 77 | close NRPE; 78 | my $err = $!; 79 | my $exit_code = $? >> 8; 80 | 81 | if ($exit_code) { 82 | $np->nagios_exit(UNKNOWN, "Unable to run nrpe: $first_line"); 83 | } 84 | 85 | # ANY Problems ? 86 | my $ok = 1; 87 | foreach my $m (@results) { 88 | $ok = 0 if ($m->{state} ne "INFO"); 89 | } 90 | 91 | if ($ok) { 92 | $np->add_message("OK", "DFS tests successfull"); 93 | } elsif ($np->opts->longserviceoutput) { 94 | $np->add_message("OK", "DFS some tests unsuccessfull"); 95 | } 96 | 97 | # Hack for multiline status output 98 | #$np->add_message( "OK", "" ) if ($np->opts->longserviceoutput); 99 | 100 | foreach my $m (@results) { 101 | if ($m->{state} eq 'INFO') { 102 | if ($np->opts->longserviceoutput) { 103 | $np->add_message( "OK", "$m->{state} - $m->{source} - $m->{message}" ); 104 | } 105 | } elsif ($m->{state} eq 'WARNING') { 106 | $np->add_message( "WARNING", "$m->{state} - $m->{source} - $m->{message}" ); 107 | } elsif ($m->{state} eq 'ERROR') { 108 | $np->add_message( "CRITICAL", "$m->{state} - $m->{source} - $m->{message}" ); 109 | } else { 110 | $np->add_message( "UNKNOWN", "state " . $m->{state} . " is unkown ? " . $m->{message} ); 111 | } 112 | } 113 | 114 | 115 | 116 | # Process messages and get return code 117 | my ($code, $message) = $np->check_messages("join" => ($np->opts->longserviceoutput ? "\n" : " - "), "join_all" => $np->opts->longserviceoutput); 118 | 119 | # We're done, return exit code, message and perfdata 120 | $np->nagios_exit( $code, $message ); 121 | 122 | 123 | -------------------------------------------------------------------------------- /rel-eng/releasers.conf: -------------------------------------------------------------------------------- 1 | # RHEL 7 Production 2 | [production-el7-x86_64] 3 | releaser = tito.release.YumRepoReleaser 4 | builder = tito.builder.MockBuilder 5 | builder.mock = epel-7-x86_64 6 | srpm_disttag = .el7 7 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel7/x86_64/ 8 | 9 | # RHEL 7 Test 10 | [test-el7-x86_64] 11 | releaser = tito.release.YumRepoReleaser 12 | builder = tito.builder.MockBuilder 13 | builder.mock = epel-7-x86_64 14 | srpm_disttag = .el7 15 | builder.test = 1 16 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel7/x86_64/ 17 | 18 | 19 | # RHEL 6 Production 20 | [production-el6-x86_64] 21 | releaser = tito.release.YumRepoReleaser 22 | builder = tito.builder.MockBuilder 23 | builder.mock = epel-6-x86_64 24 | srpm_disttag = .el6 25 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel6/x86_64/ 26 | 27 | [production-el6-i386] 28 | releaser = tito.release.YumRepoReleaser 29 | builder = tito.builder.MockBuilder 30 | builder.mock = epel-6-i386 31 | srpm_disttag = .el6 32 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel6/i386/ 33 | 34 | 35 | 36 | # RHEL 5 Production 37 | [production-el5-x86_64] 38 | releaser = tito.release.YumRepoReleaser 39 | builder = tito.builder.MockBuilder 40 | builder.mock = epel-5-x86_64 41 | srpm_disttag = .el5 42 | createrepo_command = createrepo -s sha1 . 43 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel5/x86_64/ 44 | 45 | 46 | [production-el5-i386] 47 | releaser = tito.release.YumRepoReleaser 48 | builder = tito.builder.MockBuilder 49 | builder.mock = epel-5-i386 50 | srpm_disttag = .el5 51 | createrepo_command = createrepo -s sha1 . 52 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/rhel5/i386/ 53 | 54 | # RHEL 6 Test 55 | [test-el6-x86_64] 56 | releaser = tito.release.YumRepoReleaser 57 | builder = tito.builder.MockBuilder 58 | builder.mock = epel-6-x86_64 59 | srpm_disttag = .el6 60 | builder.test = 1 61 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/x86_64/ 62 | 63 | [test-el6-i386] 64 | releaser = tito.release.YumRepoReleaser 65 | builder = tito.builder.MockBuilder 66 | builder.mock = epel-6-i386 67 | builder.test = 1 68 | srpm_disttag = .el6 69 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel6/i386/ 70 | 71 | 72 | # RHEL 5 Testing 73 | [test-el5-x86_64] 74 | releaser = tito.release.YumRepoReleaser 75 | builder = tito.builder.MockBuilder 76 | builder.mock = epel-5-x86_64 77 | srpm_disttag = .el5 78 | builder.test = 1 79 | createrepo_command = createrepo -s sha1 . 80 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel5/x86_64/ 81 | 82 | 83 | [test-el5-i386] 84 | releaser = tito.release.YumRepoReleaser 85 | builder = tito.builder.MockBuilder 86 | builder.mock = epel-5-i386 87 | srpm_disttag = .el5 88 | builder.test = 1 89 | createrepo_command = createrepo -s sha1 . 90 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/rhel5/i386/ 91 | 92 | 93 | 94 | # Fedora FC20 95 | [production-fc20-x86_64] 96 | releaser = tito.release.YumRepoReleaser 97 | builder = tito.builder.MockBuilder 98 | builder.mock = fedora-20-x86_64 99 | srpm_disttag = .fc20 100 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/fedora20/x86_64/ 101 | 102 | # Fedora FC20 103 | [test-fc20-x86_64] 104 | releaser = tito.release.YumRepoReleaser 105 | builder = tito.builder.MockBuilder 106 | builder.mock = fedora-20-x86_64 107 | srpm_disttag = .fc20 108 | builder.test = 1 109 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/testing/fedora20/x86_64/ 110 | 111 | 112 | 113 | 114 | # sources 115 | [production-tarballs] 116 | releaser = tito.release.RsyncReleaser 117 | builder = tito.builder.Builder 118 | filetypes = tgz 119 | rsync = tito@opensource.is:/var/www/sites/opensource.ok.is/repo/sources/ 120 | 121 | 122 | -------------------------------------------------------------------------------- /check_package_updates/check_package_updates: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright 2013, Tomas Edwardsson 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | from subprocess import Popen, PIPE 19 | from pynag.Plugins import PluginHelper, unknown, ok 20 | from collections import defaultdict 21 | known_types = ['Enhancement', 'Normal', 'Bug fix', 'Security'] 22 | 23 | 24 | def main(): 25 | p = PluginHelper() 26 | p.parse_arguments() 27 | p.status(ok) 28 | 29 | total_updates = 0 30 | pkg_updates = {} 31 | try: 32 | total_updates, pkg_updates = pkcon_get_updates() 33 | except Exception, e: 34 | p.add_summary("Error: " + e.message) 35 | p.status(unknown) 36 | p.exit() 37 | 38 | p.add_summary("Total: %i, " % total_updates + 39 | ", ".join(["%s: %i" % (x, len(pkg_updates[x])) for x in pkg_updates.keys()])) 40 | p.add_metric("total", total_updates) 41 | for update_type in pkg_updates: 42 | p.add_metric(update_type.lower(), len(pkg_updates[update_type])) 43 | if len(pkg_updates[update_type]): 44 | p.add_long_output(update_type) 45 | for pkg in pkg_updates[update_type]: 46 | p.add_long_output(" %s" % pkg) 47 | 48 | for m in known_types: 49 | m = m.lower() 50 | if not p.get_metric(m): 51 | p.add_metric(m, 0) 52 | 53 | p.check_all_metrics() 54 | p.exit() 55 | 56 | 57 | def pkcon_get_updates(): 58 | """ 59 | Fetches all package updates and returns a tuple containing: 60 | total_updates, 61 | dictionary where the type of update is the key and the value is a array of package names. 62 | 63 | :return: { "Bug fix": [ "pkg-1.0.1", "anthr-pkg-3.1.4" ], "Security": [ "pkg2-2.1.1" ], 64 | """ 65 | update_types = defaultdict(list) 66 | for t in known_types: 67 | update_types[t] = [] 68 | 69 | stdout = "" 70 | stderr = "" 71 | rc = 255 72 | try: 73 | p = Popen(["pkcon", "get-updates"], stdout=PIPE, stderr=PIPE) 74 | stdout, stderr = p.communicate() 75 | rc = p.wait() >> 8 76 | except OSError, e: 77 | if e.errno == 2: 78 | raise Exception("%s - PackageKit not installed?" % e.strerror) 79 | 80 | total_updates = 0 81 | results_section = False 82 | for line in stdout.splitlines(): 83 | if not line: 84 | continue 85 | if line.startswith("There are no updates"): 86 | continue 87 | if results_section is False and line == "Results:": 88 | results_section = True 89 | elif results_section: 90 | update_type = line[:13].strip() 91 | update_package = line[13:].strip() 92 | 93 | update_types[update_type].append(update_package) 94 | total_updates += 1 95 | 96 | if rc > 0: 97 | raise Exception( 98 | "pkcon returned non zero return code %i, output:\n%s\nstderr output:\n%s" % (rc, stdout, stderr)) 99 | if results_section is False: 100 | raise Exception("pkcon returned no 'Results:' section. Output of pkcon command:\n" + stdout) 101 | 102 | return total_updates, update_types 103 | 104 | 105 | if __name__ == "__main__": 106 | main() 107 | -------------------------------------------------------------------------------- /check_rhcs/check_rhcs_cman_group.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2010, Pall Sigurdsson 4 | # 5 | # This script is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This script is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | # About this script 19 | # 20 | # Checks uptime of a specified host, using NRPE is host is remote 21 | 22 | HOSTN="localhost" # By default check localhost 23 | CHECK_COMMAND="group_tool ls 0 default" # Default command to check selinux status 24 | ok=0 25 | warning=1 26 | critical=2 27 | unknown=3 28 | 29 | print_help() { 30 | echo "check_rhcs_cman version $VERSION" 31 | echo "This plugin checks cman groups" 32 | echo "" 33 | echo "Usage: $0 [-H ] <-l LEVEL> <--group GROUP>" 34 | echo "" 35 | echo "Examples:" 36 | echo "# check_rhcs_fencing.sh --level 0 --group default" 37 | echo "# check_rhcs_fencing.sh --level 1 --group rgmanager" 38 | } 39 | 40 | #if [ $# -eq 0 ]; then 41 | # print_help ; 42 | # exit $UNKNOWN 43 | #fi 44 | 45 | 46 | # Parse arguments 47 | while [ $# -gt 0 ] 48 | do 49 | case $1 50 | in 51 | -H) 52 | HOSTN=$2 53 | shift 2 54 | ;; 55 | --group) 56 | GROUP=$2 57 | shift 2 58 | ;; 59 | --level) 60 | LEVEL=$2 61 | shift 2 62 | ;; 63 | 64 | *) 65 | print_help ; 66 | exit $UNKNOWN 67 | ;; 68 | esac 69 | done 70 | 71 | if [ -z $GROUP ]; then 72 | echo "ERROR - --group not specified" 73 | print_help ; 74 | exit $UNKNOWN 75 | fi 76 | 77 | if [ -z $LEVEL ]; then 78 | echo "ERROR - --level not specified" 79 | print_help ; 80 | exit $UNKNOWN 81 | fi 82 | 83 | 84 | 85 | # We we are not checking localhost, lets get remote uptime via NRPE 86 | if [ "$HOSTN" != "localhost" ]; then 87 | export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/nagios/usr/lib/nagios/plugins 88 | CHECK_COMMAND="check_nrpe -H $HOSTN -c check_cman_group -a $LEVEL $GROUP" 89 | fi 90 | 91 | CHECK_COMMAND="group_tool ls $LEVEL $GROUP" 92 | 93 | # group_tool ls 94 | # type level name id state 95 | # fence 0 default 00020001 none 96 | # [1] 97 | # dlm 1 rgmanager 00030001 none 98 | #[1 2] 99 | 100 | # Get the uptime, raise error if we are unsuccessful 101 | OUTPUT=`$CHECK_COMMAND 2>&1` 102 | RESULT=$? 103 | SUMMARY="" 104 | 105 | 106 | # group_tool should only return status 0 or 1 107 | # if higher, then something unexpected occured 108 | if [ $RESULT -ge 2 ]; then 109 | echo "group_tool error: could not run command $CHECK_COMMAND" 110 | echo "output:" 111 | echo "$OUTPUT" 112 | exit $unknown 113 | fi 114 | 115 | set -- $OUTPUT 116 | type=$6 117 | level=$7 118 | name=$8 119 | id=$9 120 | state=${10} 121 | # Check if group_tool command ran successfully 122 | if [ $RESULT -ne 0 ]; then 123 | echo "group_tool error: group $GROUP level $LEVEL not found." 124 | echo "output:" 125 | echo "$OUTPUT" 126 | exit $critical 127 | else 128 | echo $OUTPUT | grep -qw "none" 129 | RESULT=$? 130 | if [ $RESULT -ne 0 ]; then 131 | echo "group_tool error: group is in abnormal state. name=$name type=$type level=$level state=$state" 132 | echo "output:" 133 | echo "$OUTPUT" 134 | exit $critical 135 | else 136 | echo "group_tool: group ok and in state 'none'. name=$name type=$type level=$level state=$state" 137 | echo "output:" 138 | echo "$OUTPUT" 139 | exit $ok 140 | fi 141 | fi 142 | -------------------------------------------------------------------------------- /check_package_updates/README.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | 4 | This Nagios plugin checks for available updates using PackageKit 5 | http://packagekit.org/ on Linux systems 6 | 7 | Why a new plugin? 8 | ================= 9 | 10 | There are already plugins out there like check_yum and check_apt which do 11 | check for updates but they are distribution specific. The main drivers are: 12 | 13 | * Can run unprivileged, for instance the nrpe user 14 | * No sudo/selinux problems 15 | * Non distribution specific, works on debian, ubuntu, fedora, centos, rhel... 16 | 17 | Usage 18 | ===== 19 | 20 | Critical Security 21 | ----------------- 22 | 23 | Critical on all security type updates 24 | ``` 25 | $ check_package_updates --no-longoutput --th "metric=security,critical=1..inf" 26 | Critical - Total: 67, Security: 15, Bug fix: 48, Enhancement: 0, Normal: 4. Critical on security | 'total'=67;;;; 'security'=15;;1..inf;; 'bug fix'=48;;;; 'normal'=4;;;; 27 | ``` 28 | 29 | Total Updates 30 | ------------- 31 | 32 | Critical on all security type updates and warning on many total updates 33 | ``` 34 | $ python check_package_updates --no-longoutput --th "metric=security,critical=1..inf" --th "metric=total,warning=40..inf" 35 | Critical - Total: 67, Security: 15, Bug fix: 48, Enhancement: 0, Normal: 4. Critical on security. Warning on total | 'total'=67;40..inf;;; 'security'=15;;1..inf;; 'bug fix'=48;;;; 'normal'=4;;;; 36 | ``` 37 | 38 | Long Output 39 | ----------- 40 | With long output (default) you also get the list of packages 41 | 42 | ``` 43 | $ python check_package_updates --th "metric=security,critical=1..inf" --th "metric=total,warning=40..inf" 44 | Critical - Total: 32, Security: 1, Bug fix: 31, Enhancement: 0, Normal: 0. Critical on security | 'total'=32;40..inf;;; 'security'=1;;1..inf;; 'bug fix'=31;;;; 45 | Security 46 | python-bugzilla-0.9.0-1.fc18.noarch 47 | Bug fix 48 | ibus-typing-booster-1.2.1-1.fc18.noarch 49 | nodejs-abbrev-1.0.4-6.fc18.noarch 50 | nodejs-archy-0.0.2-8.fc18.noarch 51 | nodejs-async-0.2.9-2.fc18.noarch 52 | nodejs-block-stream-0.0.6-7.fc18.noarch 53 | nodejs-chmodr-0.1.0-4.fc18.noarch 54 | nodejs-chownr-0.0.1-9.fc18.noarch 55 | nodejs-combined-stream-0.0.4-3.fc18.noarch 56 | nodejs-delayed-stream-0.0.5-5.fc18.noarch 57 | nodejs-fstream-0.1.22-3.fc18.noarch 58 | nodejs-ini-1.1.0-3.fc18.noarch 59 | nodejs-lru-cache-2.3.0-3.fc18.noarch 60 | nodejs-mime-1.2.9-3.fc18.noarch 61 | nodejs-minimatch-0.2.12-2.fc18.noarch 62 | nodejs-mkdirp-0.3.5-3.fc18.noarch 63 | nodejs-mute-stream-0.0.3-6.fc18.noarch 64 | nodejs-node-uuid-1.4.0-4.fc18.noarch 65 | nodejs-nopt-2.1.1-3.fc18.noarch 66 | nodejs-once-1.1.1-5.fc18.noarch 67 | nodejs-opener-1.3.0-7.fc18.noarch 68 | nodejs-osenv-0.0.3-5.fc18.noarch 69 | nodejs-promzard-0.2.0-6.fc18.noarch 70 | nodejs-proto-list-1.2.2-5.fc18.noarch 71 | nodejs-read-1.0.4-8.fc18.noarch 72 | nodejs-retry-0.6.0-5.fc18.noarch 73 | nodejs-sigmund-1.0.0-5.fc18.noarch 74 | nodejs-tar-0.1.17-3.fc18.noarch 75 | nodejs-uid-number-0.0.3-7.fc18.noarch 76 | nodejs-which-1.0.5-8.fc18.noarch 77 | python-virtinst-0.600.4-2.fc18.noarch 78 | vgabios-0.6c-9.fc18.noarch 79 | ``` 80 | 81 | 82 | 83 | Caveats 84 | ======= 85 | * PackageKit does draw in quite a few packages with it. 86 | * Does not work on older distros, like centos/rhel 5. 87 | 88 | Dependencies 89 | ============ 90 | 91 | * pynag-0.4.7+ 92 | * Known to work with PackageKit 0.7.6 or later 93 | 94 | Install 95 | ======= 96 | 97 | * Install pynag (available through your favorite package manager) 98 | * Install PackageKit (packagekit in Debian) 99 | 100 | ``` 101 | wget https://raw.github.com/opinkerfi/nagios-plugins/master/check_package_updates/check_package_updates 102 | ``` 103 | 104 | Room for improvement 105 | ==================== 106 | 107 | The plugin executes pkcon instead of using the API directly. I actually gave 108 | the API a whirl via "from gi.repository import PackageKitGlib as packagekit" 109 | but the documentation was very lacking so I ended up with pkcon. 110 | 111 | License 112 | ======= 113 | GPLv3 or newer, see LICENSE-GPL3 in the root of the project 114 | -------------------------------------------------------------------------------- /check_squid/check_squid.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # check_squid - Nagios check plugin for testing a Squid proxy 4 | # 5 | # Christoph Haas 6 | # Andre Osti 7 | # 8 | # License: GPL 2 9 | # 10 | # V0.2 11 | # 12 | 13 | require 5.004; 14 | use POSIX; 15 | use strict; 16 | use Getopt::Long; 17 | use vars qw($opt_V $opt_h $opt_t $opt_u $opt_n $opt_s 18 | $opt_p $opt_l $opt_o $opt_m $opt_e); 19 | use vars qw($PROGNAME); 20 | use lib "/usr/lib/nagios/plugins"; 21 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); 22 | use LWP::UserAgent; 23 | use HTTP::Request::Common qw(POST GET); 24 | use HTTP::Headers; 25 | use Time::HiRes qw(gettimeofday tv_interval); 26 | my ($url, $urluser, $urlpass, $proxy, $proxyport, 27 | $proxyuser, $proxypass, $expectstatus, $res, $req); 28 | 29 | $PROGNAME = "check_squid_lw.pl"; 30 | 31 | sub print_help(); 32 | sub print_usage(); 33 | 34 | Getopt::Long::Configure('bundling'); 35 | GetOptions("V" => \$opt_V, "version" => \$opt_V, 36 | "h" => \$opt_h, "help" => \$opt_h, 37 | "t=s" => \$opt_t, "timeout=i" => \$opt_t, 38 | "u=s" => \$opt_u, "url=s" => \$opt_u, 39 | "n=s" => \$opt_n, "urluser=s" => \$opt_n, 40 | "s=s" => \$opt_s, "urlpass=s" => \$opt_s, 41 | "p=s" => \$opt_p, "proxy=s" => \$opt_p, 42 | "l=s" => \$opt_l, "proxyport=s" => \$opt_l, 43 | "o=s" => \$opt_o, "proxyuser=s" => \$opt_o, 44 | "m=s" => \$opt_m, "proxypass=s" => \$opt_m, 45 | "e=i" => \$opt_e, "status=i" => \$opt_e); 46 | 47 | if ($opt_V) { 48 | print_revision($PROGNAME,'$Revision: 0.1 $'); #' 49 | exit $ERRORS{'OK'}; 50 | } 51 | 52 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} 53 | 54 | ($opt_u) || ($opt_u = shift) || usage("Use -h for more info\n"); 55 | $url = $opt_u; 56 | 57 | ($opt_p) || ($opt_p = shift) || usage("Use -h for more info\n"); 58 | $proxy = $opt_p; 59 | 60 | ($opt_l) || ($opt_l = shift) || usage("Use -h for more info\n"); 61 | $proxyport = $opt_l; 62 | 63 | ($opt_e) || ($opt_e = shift) || usage("Use -h for more info"); 64 | $expectstatus = $opt_e; 65 | 66 | if(defined($opt_n)) { $urluser = $opt_n; } 67 | 68 | if(defined($opt_s)) { $urlpass = $opt_s; } 69 | 70 | if(defined($opt_o)) { $proxyuser = $opt_o; } 71 | 72 | if(defined($opt_m)) { $proxypass = $opt_m; } 73 | 74 | my $ua = new LWP::UserAgent; 75 | my $h = HTTP::Headers->new(); 76 | 77 | if ($proxy) 78 | { 79 | $ua->proxy(['http', 'ftp'], "http://$proxy:$proxyport"); 80 | 81 | if ($proxyuser) 82 | { 83 | $h->proxy_authorization_basic($proxyuser,$proxypass); 84 | } 85 | } 86 | 87 | if ($urluser) 88 | { 89 | $h->authorization_basic($urluser, $urlpass); 90 | } 91 | 92 | my $t0 = [gettimeofday]; 93 | 94 | $req = HTTP::Request->new('GET', $url, $h); 95 | 96 | $res = $ua->request($req); 97 | 98 | my $elapsed = tv_interval ( $t0 ); 99 | 100 | if ($res->status_line =~ /^$expectstatus/) 101 | { 102 | printf( "OK - Status: %s | 'response_time'=%ss\n", $res->status_line, $elapsed); 103 | exit $ERRORS{"OK"}; 104 | } 105 | else 106 | { 107 | print "CRITICAL - Status: ".$res->status_line." (but expected $expectstatus...)\n"; 108 | exit $ERRORS{"CRITICAL"}; 109 | } 110 | 111 | sub print_usage () { 112 | print "Usage: $PROGNAME -u -p -l -e"; 113 | print " \n"; 114 | } 115 | 116 | sub print_help () { 117 | print_revision($PROGNAME,'$Revision: 0.1 $'); 118 | print "Perl check squid proxy\n"; 119 | 120 | print_usage(); 121 | 122 | print " 123 | -V, --version 124 | Version this script 125 | -h, --help 126 | Help 127 | -t, --timeout=INTEGER 128 | default 15s 129 | -u, --url=http:// 130 | The URL to check on the internet (http://www.google.com) 131 | -n, --urluser=username 132 | Username if the web site required authentication 133 | -s, --urlpass=password 134 | Password if the web site required authentication 135 | -p, --proxy=proxy 136 | Server that squid runs on (proxy.mydomain) 137 | -l, --proxyport=INTEGER 138 | TCP port that Squid listens on (3128) 139 | -o, --proxyuser=proxyuser 140 | Username if the web site required authentication 141 | -m, --proxypass=proxypass 142 | Password if the web site required authentication 143 | -e, --status=INTEGER 144 | HTTP code that should be returned 145 | 146 | "; 147 | 148 | support(); 149 | } 150 | -------------------------------------------------------------------------------- /check_cpu.py/okplugin_check_cpu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Copyright 2014, Tomas Edwardsson 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | """ 18 | Gathers information on cpu usage on a linux machine 19 | 20 | It returns performance data for both the last 5 seconds and from last run. 21 | """ 22 | 23 | from pynag.Plugins import PluginHelper, ok, unknown 24 | import os 25 | import time 26 | 27 | 28 | def main(): 29 | """The main logic of the program""" 30 | 31 | # See man proc and search for /proc/stat 32 | stat_fields = ['cpu', 'user', 'nice', 'system', 'idle', 'iowait', 'irq', 33 | 'softirq', 'steal', 'guest', 'guest_nice'] 34 | 35 | pyplug = PluginHelper() 36 | 37 | # Get the statistics from last run 38 | old_stat = get_saved_stat() 39 | 40 | # Get current state 41 | stat = get_stat() 42 | 43 | # Resample 44 | time.sleep(5) 45 | stat2 = get_stat() 46 | 47 | try: 48 | save_stat(stat) 49 | except IOError, err: 50 | pyplug.exit(unknown, "Unable to save cpu statistics: %s" % err) 51 | 52 | 53 | # Calculate averages for the last few seconds 54 | current_averages = diff_stats(stat2, stat) 55 | for pos in range(len(current_averages)): 56 | pyplug.add_metric(label=stat_fields[pos+1], 57 | value=current_averages[pos], 58 | uom="%") 59 | 60 | # Calculate averages from last run 61 | if old_stat: 62 | last_run_avg = diff_stats(old_stat, stat) 63 | for pos in range(len(current_averages)): 64 | pyplug.add_metric(label=stat_fields[pos+1]+"_avg", 65 | value=last_run_avg[pos], 66 | uom="%") 67 | 68 | pyplug.add_status(ok) 69 | pyplug.add_summary("CPU load %.2f%%" % (100.0 - current_averages[3])) 70 | pyplug.exit() 71 | 72 | def diff_stats(older, newer): 73 | """Calculates the percentage between two stat arrays""" 74 | if older: 75 | diff = [] 76 | for pos in range(len(newer)): 77 | diff.append(newer[pos] - older[pos]) 78 | averages = calc_avg(diff) 79 | else: 80 | averages = calc_avg(newer) 81 | 82 | return averages 83 | 84 | 85 | def remove_stale_state(): 86 | """Removes the last state file if we have rebooted""" 87 | 88 | try: 89 | state_mtime = os.stat("/var/lib/nagios-okplugin/check_cpu").st_mtime 90 | boot_time = os.stat("/proc/1").st_mtime 91 | if state_mtime < boot_time: 92 | os.unlink("/var/lib/nagios-okplugin/check_cpu") 93 | except OSError: 94 | return None 95 | 96 | return state_mtime 97 | 98 | def calc_avg(stat): 99 | """Calculates the average of each int in array""" 100 | stat_sum = sum(stat) 101 | avg = [] 102 | for pos in range(len(stat)): 103 | avg.append(float(stat[pos]) / stat_sum * 100) 104 | return avg 105 | 106 | def get_stat(): 107 | """Fetches the first line from /proc/stat and returns the numbers""" 108 | stat_fh = open("/proc/stat") 109 | return [int(pos) for pos in stat_fh.readline().split()[1:]] 110 | 111 | def get_saved_stat(): 112 | """Fetches information about the last run to be able to do averages""" 113 | 114 | remove_stale_state() 115 | try: 116 | stat_fh = open("/var/lib/nagios-okplugin/check_cpu") 117 | except IOError: 118 | return None 119 | return [int(pos) for pos in stat_fh.readline().split()[1:]] 120 | 121 | def save_stat(stat): 122 | """Save statistics to compare to in next run""" 123 | stat_fh = open("/var/lib/nagios-okplugin/check_cpu", "w") 124 | 125 | stat_fh.write("cpu " + " ".join([str(pos) for pos in stat]) + "\n") 126 | stat_fh.close() 127 | 128 | if __name__ == "__main__": 129 | main() 130 | 131 | # vim: sts=4 expandtab 132 | -------------------------------------------------------------------------------- /check_lvm_mirror/check_lvm_mirror.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from pynag.Plugins import simple as Plugin, WARNING, CRITICAL, UNKNOWN, OK 4 | from subprocess import Popen, PIPE 5 | import os 6 | 7 | 8 | def main(): 9 | global plugin 10 | 11 | plugin = Plugin(must_threshold=False) 12 | plugin.add_arg("l", "logical-volume", 13 | "Comma seperated list of VG/LV, eg vg00/data,vg00/snap", 14 | required=False) 15 | plugin.add_arg("V", "volume-group", 16 | "Comma seperated list of VG, eg vg00,vg01", 17 | required=False) 18 | plugin.add_arg("a", "check-all", "Check all LVs", required=False, 19 | action="store_true") 20 | plugin.activate() 21 | 22 | lvs = plugin["logical-volume"] and plugin["logical-volume"].split( 23 | ",") or [] 24 | vgs = plugin["volume-group"] and plugin["volume-group"].split(",") or [] 25 | 26 | if not lvs and not vgs and not plugin['check-all']: 27 | plugin.parser.error( 28 | "Either logical-volume or volume-group must be specified") 29 | elif plugin['check-all'] and ( lvs or vgs ): 30 | plugin.parser.error( 31 | "Mixing check-all and logical-volume or volume-group does not make sense") 32 | 33 | check_mirror(lvs, vgs, plugin['check-all'], plugin['host']) 34 | 35 | (code, message) = (plugin.check_messages(joinallstr="\n")) 36 | plugin.nagios_exit(code, message) 37 | 38 | 39 | def check_mirror(lv_list, vg_list, check_all, hostname): 40 | # Ensure the right locale for text parsing 41 | """ 42 | 43 | :rtype : None 44 | """ 45 | # Change lang setting for string consitency 46 | env = os.environ.copy() 47 | env['LC_ALL'] = 'C' 48 | 49 | # Remote execution 50 | if hostname: 51 | cmd = ['check_nrpe', '-H', hostname, '-c', 'get_lvm_mirrors'] 52 | # Local 53 | else: 54 | cmd = ["lvs", "--separator", ";", "-o", 55 | "vg_name,lv_name,lv_attr,copy_percent"] 56 | # Execute lvs 57 | ret = None 58 | lvs_output = None 59 | try: 60 | lvs = Popen(cmd, stdout=PIPE, shell=False, env=env) 61 | ret = lvs.wait() 62 | lvs_output = lvs.stdout.readlines() 63 | except Exception, e: 64 | plugin.nagios_exit(UNKNOWN, "Unable to execute lvs: %s" % (e)) 65 | 66 | if ret != 0: 67 | plugin.nagios_exit(CRITICAL, 68 | "lvs execution failed, return code %i" % (ret)) 69 | all_lvs = [] 70 | all_vgs = [] 71 | 72 | # Loop through lvs output 73 | linenumber = 0 74 | for l in lvs_output: 75 | linenumber += 1 76 | try: 77 | vg_name, lv_name, lv_attr, copy_percent = l.strip().split(";") 78 | except ValueError as error: 79 | plugin.add_message(UNKNOWN, 80 | "Unable to parse lvs line %i: %s\n%s" % ( 81 | linenumber, error, l)) 82 | continue 83 | all_lvs.append("%s/%s" % (vg_name, lv_name)) 84 | if vg_name not in all_vgs: 85 | all_vgs.append(vg_name) 86 | 87 | if check_all or "%s/%s" % ( 88 | vg_name, lv_name) in lv_list or vg_name in vg_list: 89 | if lv_attr[0] != "m" and lv_attr[0] != "M": 90 | plugin.add_message(CRITICAL, 91 | "LV %s/%s not mirrored" % (vg_name, lv_name)) 92 | elif lv_attr[2] != "a": 93 | plugin.add_message(CRITICAL, 94 | "LV %s/%s not active" % (vg_name, lv_name)) 95 | elif lv_attr[5] != "o": 96 | plugin.add_message(CRITICAL, 97 | "LV %s/%s not open" % (vg_name, lv_name)) 98 | elif float(copy_percent or 0) < 100: 99 | plugin.add_message(WARNING, "LV %s/%s Copy Percent %s" % ( 100 | vg_name, lv_name, copy_percent)) 101 | else: 102 | plugin.add_message(OK, "LV %s/%s functioning" % (vg_name, lv_name)) 103 | 104 | # Find lvs that were specified in cmd line but were not found via lvs 105 | for v in vg_list: 106 | if v not in all_vgs: 107 | plugin.add_message(CRITICAL, "VG %s not found" % (v)) 108 | 109 | # Find lvs that were specified in cmd line but were not found via lvs 110 | for l in lv_list: 111 | if l not in all_lvs: 112 | plugin.add_message(CRITICAL, "LV %s not found" % (l)) 113 | 114 | if __name__ == "__main__": 115 | main() 116 | 117 | 118 | -------------------------------------------------------------------------------- /check_snmp/check_snmp_connectivity: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # nagios: -epn 3 | # 4 | # 5 | # AUTHORS: 6 | # Pall Sigurdsson 7 | # 8 | # 9 | # This script is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This script is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with this script; if not, write to the Free Software 21 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | # 23 | 24 | use lib qw ( /usr/local/nagios/perl/lib ); 25 | use Net::SNMP; 26 | use Getopt::Std; 27 | 28 | $script = "check_snmp_description"; 29 | $script_version = "1.0.0"; 30 | # SNMP options 31 | $version = "2c"; 32 | $timeout = 2; 33 | 34 | # Oids to use 35 | $oid_description = ".1.3.6.1.2.1.1.1.0"; 36 | $oid_uptime =".1.3.6.1.2.1.1.3.0"; 37 | $oid_contact = ".1.3.6.1.2.1.1.4.0"; 38 | $oid_name = ".1.3.6.1.2.1.1.5.0"; 39 | $oid_location = ".1.3.6.1.2.1.1.6.0"; 40 | 41 | # Default values 42 | $description = ""; 43 | $uptime = ""; 44 | $contact = ""; 45 | $name = ""; 46 | $location = ""; 47 | 48 | 49 | $hostname = "10.199.7.59"; # Default hostname 50 | $returnstring = ""; 51 | $community = "public"; # Default community string 52 | #$configfilepath = "/usr/local/nagios/etc"; 53 | 54 | # Do we have enough information? 55 | if ( @ARGV < 1 ) { 56 | print "Too few arguments\n"; 57 | usage(); 58 | } 59 | 60 | getopts("hH:C:i:w:c:"); 61 | if ($opt_h) { 62 | usage(); 63 | exit(0); 64 | } 65 | if ($opt_H) { 66 | $hostname = $opt_H; 67 | 68 | # print "Hostname $opt_H\n"; 69 | } 70 | else { 71 | print "No hostname specified\n"; 72 | usage(); 73 | exit(0); 74 | } 75 | if ($opt_C) { 76 | $community = $opt_C; 77 | } 78 | if ($opt_w) { 79 | $warning = $opt_w; 80 | } 81 | if ($opt_c) { 82 | $critical = $opt_c; 83 | } 84 | else { 85 | 86 | # print "Using community $community\n"; 87 | } 88 | 89 | # Create the SNMP session 90 | 91 | $version = "1"; 92 | ( $s, $e ) = Net::SNMP->session( 93 | -community => $community, 94 | -hostname => $hostname, 95 | -version => $version, 96 | -timeout => $timeout, 97 | ); 98 | 99 | if ( !defined( $s->get_request($oid_description) ) ) { 100 | 101 | # If we can't connect using SNMPv1 lets try as SNMPv2 102 | $s->close(); 103 | sleep 0.5; 104 | $version = "2c"; 105 | ( $s, $e ) = Net::SNMP->session( 106 | -community => $community, 107 | -hostname => $hostname, 108 | -version => $version, 109 | -timeout => $timeout, 110 | ); 111 | if ( !defined( $s->get_request($oid_sysDescr) ) ) { 112 | print "Agent not responding, tried SNMP v1 and v2 (IP=$hostname, Community=$community)\n"; 113 | exit(1); 114 | } 115 | else { 116 | foreach ( $s->var_bind_names() ) { 117 | $description = $s->var_bind_list()->{$_}; 118 | } 119 | } 120 | 121 | } 122 | else { 123 | foreach ( $s->var_bind_names() ) { 124 | $description = $s->var_bind_list()->{$_}; 125 | } 126 | } 127 | # Get Location 128 | if ( !defined( $s->get_request($oid_location) ) ) { 129 | } 130 | else { 131 | foreach ( $s->var_bind_names() ) { 132 | $location = $s->var_bind_list()->{$_}; 133 | } 134 | } 135 | 136 | # Get Contact 137 | if ( !defined( $s->get_request($oid_contact) ) ) { 138 | } 139 | else { 140 | foreach ( $s->var_bind_names() ) { 141 | $contact = $s->var_bind_list()->{$_}; 142 | } 143 | } 144 | 145 | # Get name 146 | if ( !defined( $s->get_request($oid_name) ) ) { 147 | } 148 | else { 149 | foreach ( $s->var_bind_names() ) { 150 | $name = $s->var_bind_list()->{$_}; 151 | } 152 | } 153 | 154 | # Get Uptime 155 | if ( !defined( $s->get_request($oid_uptime) ) ) { 156 | } 157 | else { 158 | foreach ( $s->var_bind_names() ) { 159 | $uptime = $s->var_bind_list()->{$_}; 160 | } 161 | } 162 | 163 | print "OK - SNMP is working properly \n\n"; 164 | print "Name: $name \n"; 165 | print "Contact: $contact \n"; 166 | print "Location: $location \n"; 167 | print "Description: $description \n"; 168 | print "Uptime: $uptime \n"; 169 | exit 0; 170 | 171 | --------------------------------------------------------------------------------