Compare commits

..

1 Commits

@ -1,12 +0,0 @@
push:
git push
pull:
git pull
fetch:
git fetch
update:
git commit
git push

Binary file not shown.

@ -1,10 +1,9 @@
# Princeton
## Files that need to be copied to /usr/local/nagios/libexec:
* pu-notify-all-emails
This repository contains files associated with Princeton University (PU) NAemon to Nagios XI Converstion Project. This project is from 2019-09-09 throgh 2019-09-20, on site at PU.
## Files that need contents imported into XI:
* new_commands.cfg
## Files
## Also See failover/README.md
libexec.zip is their /usr/local/monitoring/.../libexec dir
princeton.zip is /usr/local/monitoring.../princeton (local libexec)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,163 +0,0 @@
define contactgroup {
contactgroup_name delladmins
alias Nagios Administrators
members ESS Page, ESS UNIX List
}
define contactgroup {
contactgroup_name DBA Page
alias DBA Page and email
members Audrey Wright, Sergey Guberman, Chris Stewart, Ron Gittleman, Todd Whitaker, Debby Becker, Krish Anugula, Paul Beaulieu
}
define contactgroup {
contactgroup_name DBA Page CRITICAL
alias DBA Page on CRITICAL
members Audrey Wright CRITICAL, Sergey Guberman CRITICAL, Chris Stewart CRITICAL, Ron Gittleman CRITICAL, Todd Whitaker CRITICAL, Debby Becker CRITICAL, DBA Important List, Krish Anugula CRITICAL, Paul Beaulieu CRITICAL
}
define contactgroup {
contactgroup_name dummy
alias Dummy contact group -- does nothing
members dummy
}
define contactgroup {
contactgroup_name nobody
alias Noone - does nothing
members nobody
}
define contactgroup {
contactgroup_name CISDR
alias CISDR (former CSG) members
members clk, dbashore, jsophy, jwagner, ratliff, stevea, monikam
}
define contactgroup {
contactgroup_name CISDR on call
alias CISDR members on call
members clk, dbashore, jsophy, jwagner, ratliff, stevea
}
define contactgroup {
contactgroup_name ESS_8x5
alias ESS page 8x5, and email rest of the time
members ESS_outside_8x5, ESS_8x5
}
define contactgroup {
contactgroup_name GUI Admins
alias Nagios GUI Administrators Authorization
members anykey, bhaines, bts, bigmac, chief53, coto, drevil, drinker, dw10, eburd, hajar, hajarn, irwin, ists, jfitz, jkaram, jmkcsg, jsotoj
}
define contactgroup {
contactgroup_name GUI Operators
alias Naemon GUI Operators Authorization
members bstango, chris, ck, clk, clu, cs2, dbashore, dchin, duvergem, igubenko, jasonrap, jf19, jlf, jsophy, jwagner, kgift, kh6, llong, martin, monikam, moraski2, ndelo, ranugula, riverhi21, ryangm, sergeyg, shorey, simonlee, skampel, steven, willman
}
define contactgroup {
contactgroup_name GUI Help Desk
alias Auth users for Help Desk VI/SOC
members ohd-vi002, ohd-vi003, ohd-vi004, ohd-vi005, ohd-vi006, ohd-vi007, ohd-vi008, ohd-vi009, ohd-vi010, ohd-vi011, ohd-vi012, ohd-vi013, ohd-vi015, ohd-vi016, ohd-vi017, ohd-vi019
}
define contactgroup {
contactgroup_name IAM
alias Identity Management
members jasonrap, kbmartin, simonlee, willman
}
define contactgroup {
contactgroup_name Maximo
alias Maximo Support
members Michael Zhong, Quoc B. Nguyen
}
define contactgroup {
contactgroup_name Maximo Pagers
alias Maximo Support via SMS
members Michael Zhong Cell, Quoc B. Nguyen Cell
}
define contactgroup {
contactgroup_name Monitoring Admins
alias Nagios Administrators
members Erick W. Burd, Igor Yahoo, Igor V. Gubenko, Joseph M. Karam
}
define contactgroup {
contactgroup_name Monitoring Admins Pager
alias Nagios Administrators
members Igor Pager, Igor Pager External, Joseph Karam Pager, Joseph Karam Pager External
}
define contactgroup {
contactgroup_name Networking Pager
alias Text all members of the Network n Monitoring group
members David Rinker Pager, Hajar Pager, Igor Pager, Irwin Pager, Joseph Karam Pager
}
define contactgroup {
contactgroup_name nagiosadmin
alias Linux Administrators
members nagiosadmin
}
define contactgroup {
contactgroup_name OAS
alias OAS folks
members Brian Long, Natasha Metelitsa, RN Admin, Salvatore Urso
}
define contactgroup {
contactgroup_name OnBase
alias OnBase people
members Devaki Ginde, Elizabeth Parham, Robert Tengowski, Terrence M. Lam, Vito Badalamenti, OnBase Admin, OnBase UA Support
}
define contactgroup {
contactgroup_name pu_default
alias pu_default
members pu_default
}
define contactgroup {
contactgroup_name OIT-Support-Services
alias OIT Support Services (SS Machines)
members Phillip M. Immordino, Thomas J. Francais, Jesse Barron
}
define contactgroup {
contactgroup_name SOC
alias SOC
members Andre D. Corbitt, Brian A. Ariza, Brian T. Burgher, Bradley A. Wells, Donald Ade, Dominique N. Davis, Eric J. Swingle, Jeffrey Kontio, Jacob Swimmer, John J. Zerillo, Raymund Roco, Thomas J. Byrne, Terence Tung, William V. Brown Jr., Zachary M. Barton
# members acorbitt, bariza, bburgher, bwells, dade, dd7, dplante, eswingle, jkontio, jswimmer, jzerillo, mariannm, rroco, tbyrne, ttung, wb, zbarton
}
define contactgroup {
contactgroup_name TSM
alias TSM (Martin, Maureen)
members Martin_Harriss, Maureen E. OConnor
}
define contactgroup {
contactgroup_name TSM Page
alias TSM Page (Martin, Maureen)
members Dan Chin Pager, Martin Pager, Maureen E. OConnor Pager
}
define contactgroup {
contactgroup_name UHS
alias UHS server team
members UHS Server Team, Kevin E. Leighton Pager
}
define contactgroup {
contactgroup_name WWS
alias Woodrow Wilson School (Catherine Cuff, Keith Moulton)
members Catherine Cuff, Catherine Cuff Pager, Keith Moulton, Keith Moulton Pager, WWS Help List
}

File diff suppressed because it is too large Load Diff

@ -1,48 +0,0 @@
define hostdependency {
dependent_hostgroup_name NS PrivateDMZ
host_name Gearman NS PrivateDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS PublicDMZ
host_name Gearman NS PublicDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS Trust
host_name Gearman NS Trust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS Untrust, NS Restricted
host_name Gearman NS Untrust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 PrivateDMZ
host_name Gearman 151 PrivateDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 PublicDMZ
host_name Gearman 151 PublicDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 Trust
host_name Gearman 151 Trust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 Untrust, 151 Restricted, Clusters, CISDR, Email, ESX, F5 Load Balancers, Firewalls, Kaltura Live, KMA, Net, Netmgmt, IAM, SharePoint, Solaris, TSM, Webcheck, Webcheck_csg, Webcheck_Roxen
host_name Gearman 151 Untrust
notification_failure_criteria d
}

@ -1,122 +0,0 @@
define hostescalation {
use Prod 8x5 escalation
hostgroup_name Prod 8x5 Linux, Prod 8x5 Windows
contact_groups ESS_8x5
}
define hostescalation {
use Prod outside 8x5 escalation
hostgroup_name Prod 8x5 Linux, Prod 8x5 Windows
contact_groups ESS_8x5
}
define hostescalation {
use Delay Dev
hostgroup_name Linux Dev/QA, !Oracle Exadata Dev/QA
contacts ESS UNIX List
}
define hostescalation {
use Delay Dev
hostgroup_name Oracle Exadata Dev/QA
contact_groups DBA Page
}
define hostescalation {
use Delay Dev
escalation_period 8x5
hostgroup_name Windows Dev/QA
contacts ESS Windows List
}
define hostescalation {
use Delay Production
hostgroup_name DBA Windows Prod, DBA UNIX Prod, Solaris, Linux Prod, Windows Prod, ESX, !Oracle Exadata, !TSM Production, !Prod 8x5 Linux, !Prod 8x5 Windows
contacts ESS Page
}
define hostescalation {
use Delay Exadata Production
hostgroup_name Oracle Exadata
contact_groups DBA Page
}
define hostescalation {
use Delay Production
hostgroup_name TSM Production
contact_groups TSM, TSM Page
}
define hostescalation {
use host_notify_once
hostgroup_name Netmgmt
contacts ESS Ops
}
define hostescalation {
use host_notify_once
hostgroup_name Netmgmt
escalation_options r
contacts ESS UNIX List
}
define hostescalation {
name Prod 8x5 escalation
first_notification 2
last_notification 24
notification_interval 360
escalation_period 8x5
escalation_options r,d,u
register 0
}
define hostescalation {
name Prod outside 8x5 escalation
first_notification 2
last_notification 24
notification_interval 360
escalation_period Outside 8x5
escalation_options r,d,u
register 0
}
define hostescalation {
name Delay Dev
first_notification 1
last_notification 30
notification_interval 1440
escalation_period 24x7
escalation_options r,d
register 0
}
define hostescalation {
name Delay Production
first_notification 2
last_notification 6
notification_interval 360
escalation_period 24x7
escalation_options r,d,u
register 0
}
define hostescalation {
name Delay Exadata Production
first_notification 1
last_notification 6
notification_interval 360
escalation_period 24x7
escalation_options r,d,u
register 0
}
define hostescalation {
name host_notify_once
first_notification 1
last_notification 1
notification_interval 0
escalation_period 24x7
escalation_options d,u
register 0
}

File diff suppressed because it is too large Load Diff

@ -1,163 +0,0 @@
define contactgroup {
contactgroup_name delladmins
alias Nagios Administrators
members ESS Page, ESS UNIX List
}
define contactgroup {
contactgroup_name DBA Page
alias DBA Page and email
members Audrey Wright, Sergey Guberman, Chris Stewart, Ron Gittleman, Todd Whitaker, Debby Becker, Krish Anugula, Paul Beaulieu
}
define contactgroup {
contactgroup_name DBA Page CRITICAL
alias DBA Page on CRITICAL
members Audrey Wright CRITICAL, Sergey Guberman CRITICAL, Chris Stewart CRITICAL, Ron Gittleman CRITICAL, Todd Whitaker CRITICAL, Debby Becker CRITICAL, DBA Important List, Krish Anugula CRITICAL, Paul Beaulieu CRITICAL
}
define contactgroup {
contactgroup_name dummy
alias Dummy contact group -- does nothing
members dummy
}
define contactgroup {
contactgroup_name nobody
alias Noone - does nothing
members nobody
}
define contactgroup {
contactgroup_name CISDR
alias CISDR (former CSG) members
members clk, dbashore, jsophy, jwagner, ratliff, stevea, monikam
}
define contactgroup {
contactgroup_name CISDR on call
alias CISDR members on call
members clk, dbashore, jsophy, jwagner, ratliff, stevea
}
define contactgroup {
contactgroup_name ESS_8x5
alias ESS page 8x5, and email rest of the time
members ESS_outside_8x5, ESS_8x5
}
define contactgroup {
contactgroup_name GUI Admins
alias Nagios GUI Administrators Authorization
members anykey, bhaines, bts, bigmac, chief53, coto, drevil, drinker, dw10, eburd, hajar, hajarn, irwin, ists, jfitz, jkaram, jmkcsg, jsotoj
}
define contactgroup {
contactgroup_name GUI Operators
alias Naemon GUI Operators Authorization
members bstango, chris, ck, clk, clu, cs2, dbashore, dchin, duvergem, igubenko, jasonrap, jf19, jlf, jsophy, jwagner, kgift, kh6, llong, martin, monikam, moraski2, ndelo, ranugula, riverhi21, ryangm, sergeyg, shorey, simonlee, skampel, steven, willman
}
define contactgroup {
contactgroup_name GUI Help Desk
alias Auth users for Help Desk VI/SOC
members ohd-vi002, ohd-vi003, ohd-vi004, ohd-vi005, ohd-vi006, ohd-vi007, ohd-vi008, ohd-vi009, ohd-vi010, ohd-vi011, ohd-vi012, ohd-vi013, ohd-vi015, ohd-vi016, ohd-vi017, ohd-vi019
}
define contactgroup {
contactgroup_name IAM
alias Identity Management
members jasonrap, kbmartin, simonlee, willman
}
define contactgroup {
contactgroup_name Maximo
alias Maximo Support
members Michael Zhong, Quoc B. Nguyen
}
define contactgroup {
contactgroup_name Maximo Pagers
alias Maximo Support via SMS
members Michael Zhong Cell, Quoc B. Nguyen Cell
}
define contactgroup {
contactgroup_name Monitoring Admins
alias Nagios Administrators
members Erick W. Burd, Igor Yahoo, Igor V. Gubenko, Joseph M. Karam
}
define contactgroup {
contactgroup_name Monitoring Admins Pager
alias Nagios Administrators
members Igor Pager, Igor Pager External, Joseph Karam Pager, Joseph Karam Pager External
}
define contactgroup {
contactgroup_name Networking Pager
alias Text all members of the Network n Monitoring group
members David Rinker Pager, Hajar Pager, Igor Pager, Irwin Pager, Joseph Karam Pager
}
define contactgroup {
contactgroup_name nagiosadmin
alias Linux Administrators
members nagiosadmin
}
define contactgroup {
contactgroup_name OAS
alias OAS folks
members Brian Long, Natasha Metelitsa, RN Admin, Salvatore Urso
}
define contactgroup {
contactgroup_name OnBase
alias OnBase people
members Devaki Ginde, Elizabeth Parham, Robert Tengowski, Terrence M. Lam, Vito Badalamenti, OnBase Admin, OnBase UA Support
}
define contactgroup {
contactgroup_name pu_default
alias pu_default
members pu_default
}
define contactgroup {
contactgroup_name OIT-Support-Services
alias OIT Support Services (SS Machines)
members Phillip M. Immordino, Thomas J. Francais, Jesse Barron
}
define contactgroup {
contactgroup_name SOC
alias SOC
members Andre D. Corbitt, Brian A. Ariza, Brian T. Burgher, Bradley A. Wells, Donald Ade, Dominique N. Davis, Eric J. Swingle, Jeffrey Kontio, Jacob Swimmer, John J. Zerillo, Raymund Roco, Thomas J. Byrne, Terence Tung, William V. Brown Jr., Zachary M. Barton
# members acorbitt, bariza, bburgher, bwells, dade, dd7, dplante, eswingle, jkontio, jswimmer, jzerillo, mariannm, rroco, tbyrne, ttung, wb, zbarton
}
define contactgroup {
contactgroup_name TSM
alias TSM (Martin, Maureen)
members Martin_Harriss, Maureen E. OConnor
}
define contactgroup {
contactgroup_name TSM Page
alias TSM Page (Martin, Maureen)
members Dan Chin Pager, Martin Pager, Maureen E. OConnor Pager
}
define contactgroup {
contactgroup_name UHS
alias UHS server team
members UHS Server Team, Kevin E. Leighton Pager
}
define contactgroup {
contactgroup_name WWS
alias Woodrow Wilson School (Catherine Cuff, Keith Moulton)
members Catherine Cuff, Catherine Cuff Pager, Keith Moulton, Keith Moulton Pager, WWS Help List
}

File diff suppressed because it is too large Load Diff

@ -1,48 +0,0 @@
define hostdependency {
dependent_hostgroup_name NS PrivateDMZ
host_name Gearman NS PrivateDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS PublicDMZ
host_name Gearman NS PublicDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS Trust
host_name Gearman NS Trust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name NS Untrust, NS Restricted
host_name Gearman NS Untrust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 PrivateDMZ
host_name Gearman 151 PrivateDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 PublicDMZ
host_name Gearman 151 PublicDMZ
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 Trust
host_name Gearman 151 Trust
notification_failure_criteria d
}
define hostdependency {
dependent_hostgroup_name 151 Untrust, 151 Restricted, Clusters, CISDR, Email, ESX, F5 Load Balancers, Firewalls, Kaltura Live, KMA, Net, Netmgmt, IAM, SharePoint, Solaris, TSM, Webcheck, Webcheck_csg, Webcheck_Roxen
host_name Gearman 151 Untrust
notification_failure_criteria d
}

@ -1,122 +0,0 @@
define hostescalation {
use Prod 8x5 escalation
hostgroup_name Prod 8x5 Linux, Prod 8x5 Windows
contact_groups ESS_8x5
}
define hostescalation {
use Prod outside 8x5 escalation
hostgroup_name Prod 8x5 Linux, Prod 8x5 Windows
contact_groups ESS_8x5
}
define hostescalation {
use Delay Dev
hostgroup_name Linux Dev/QA, !Oracle Exadata Dev/QA
contacts ESS UNIX List
}
define hostescalation {
use Delay Dev
hostgroup_name Oracle Exadata Dev/QA
contact_groups DBA Page
}
define hostescalation {
use Delay Dev
escalation_period 8x5
hostgroup_name Windows Dev/QA
contacts ESS Windows List
}
define hostescalation {
use Delay Production
hostgroup_name DBA Windows Prod, DBA UNIX Prod, Solaris, Linux Prod, Windows Prod, ESX, !Oracle Exadata, !TSM Production, !Prod 8x5 Linux, !Prod 8x5 Windows
contacts ESS Page
}
define hostescalation {
use Delay Exadata Production
hostgroup_name Oracle Exadata
contact_groups DBA Page
}
define hostescalation {
use Delay Production
hostgroup_name TSM Production
contact_groups TSM, TSM Page
}
define hostescalation {
use host_notify_once
hostgroup_name Netmgmt
contacts ESS Ops
}
define hostescalation {
use host_notify_once
hostgroup_name Netmgmt
escalation_options r
contacts ESS UNIX List
}
define hostescalation {
name Prod 8x5 escalation
first_notification 2
last_notification 24
notification_interval 360
escalation_period 8x5
escalation_options r,d,u
register 0
}
define hostescalation {
name Prod outside 8x5 escalation
first_notification 2
last_notification 24
notification_interval 360
escalation_period Outside 8x5
escalation_options r,d,u
register 0
}
define hostescalation {
name Delay Dev
first_notification 1
last_notification 30
notification_interval 1440
escalation_period 24x7
escalation_options r,d
register 0
}
define hostescalation {
name Delay Production
first_notification 2
last_notification 6
notification_interval 360
escalation_period 24x7
escalation_options r,d,u
register 0
}
define hostescalation {
name Delay Exadata Production
first_notification 1
last_notification 6
notification_interval 360
escalation_period 24x7
escalation_options r,d,u
register 0
}
define hostescalation {
name host_notify_once
first_notification 1
last_notification 1
notification_interval 0
escalation_period 24x7
escalation_options d,u
register 0
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,200 +0,0 @@
define servicedependency {
dependent_hostgroup_name NS PrivateDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker NS PrivateDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS PublicDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker NS PublicDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS Trust
dependent_service_description .*
host_name monitor
service_description Gearman worker NS Trust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS Untrust, NS Restricted
dependent_service_description .*
host_name monitor
service_description Gearman worker NS Untrust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 PrivateDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 PrivateDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 PublicDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 PublicDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 Trust
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 Trust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 Untrust, 151 Restricted
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 Untrust
notification_failure_criteria c
}
define servicedependency {
hostgroup_name Windows Prod
dependent_service_description nrpe_win_.*, !nrpe_win_agent_status
use NRPE_Win_Dependency
}
define servicedependency {
hostgroup_name Physical Prod Windows
dependent_service_description snmp_win_.*, !snmp_win_alive
use SNMP_Win_Dependency
}
define servicedependency {
hostgroup_name Windows Dev/QA
dependent_service_description nrpe_wintest_.*, !nrpe_wintest_agent_status
use NRPE_Win_NonProd_Dependency
}
define servicedependency {
hostgroup_name Windows Dev/QA
dependent_service_description snmp_wintest_.*, !snmp_wintest_alive
use SNMP_Win_NonProd_Dependency
}
define servicedependency {
hostgroup_name Linux Prod, Solaris
dependent_service_description nrpe_unix_.*, !nrpe_unix_agent_status
use NRPE_Unix_Dependency
}
define servicedependency {
hostgroup_name Physical Prod Linux
dependent_service_description snmp_unix_.*, !snmp_unix_alive
use SNMP_Unix_Dependency
}
define servicedependency {
hostgroup_name Linux Dev/QA
dependent_service_description nrpe_unixtest_.*, !nrpe_unixtest_agent_status
use NRPE_Unix_NonProd_Dependency
}
define servicedependency {
hostgroup_name Linux Dev/QA, !CPanel Dev/QA, !Linux DevQA - no SNMP
dependent_service_description snmp_unixtest_.*, !snmp_unixtest_alive
use SNMP_Unix_NonProd_Dependency
}
define servicedependency {
dependent_host_name backupvpn
dependent_service_description Comcast
host_name backupvpn
service_description Google through Comcast
notification_failure_criteria c
}
define servicedependency {
dependent_host_name backupvpn
dependent_service_description Verizon
host_name backupvpn
service_description Yahoo through Verizon
notification_failure_criteria c
}
define servicedependency {
name NRPE_Unix_Dependency
service_description nrpe_unix_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Unix_NonProd_Dependency
service_description nrpe_unixtest_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Win_Dependency
service_description nrpe_win_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Win_NonProd_Dependency
service_description nrpe_wintest_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Win_Dependency
service_description snmp_win_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Win_NonProd_Dependency
service_description snmp_wintest_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Unix_Dependency
service_description snmp_unix_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Unix_NonProd_Dependency
service_description snmp_unixtest_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name maestro_carryfwd_dependency
service_description jnextcheck
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}

@ -1,84 +0,0 @@
define serviceescalation {
use service_notify_once
hostgroup_name Netmgmt, !Netmgmt - No SSH
service_description .*
contacts ESS Ops
}
define serviceescalation {
hostgroup_name Netmgmt, !Netmgmt - No SSH
service_description .*
first_notification 1
last_notification 0
notification_interval 0
escalation_period 24x7
escalation_options r
contacts ESS UNIX List
}
define serviceescalation {
host_name monitor
service_description Gearman worker ims.*
first_notification 12
last_notification 14
notification_interval 120
escalation_period 24x7
escalation_options c
contact_groups Monitoring Admins Pager
}
define serviceescalation {
host_name monitor
service_description Gearman worker (151|NS).*
first_notification 3
last_notification 5
notification_interval 60
escalation_period 24x7
escalation_options c
contact_groups Monitoring Admins Pager
}
define serviceescalation {
use service_notify_once
host_name monitor
service_description .*_akam_net
escalation_options w,c,r
contacts Networking
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_agent_status, nrpe_win_Exchange*
escalation_period Exchange MBX busy
first_notification 1
last_notification 3
notification_interval 10
contact_groups dummy
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_agent_status
escalation_period Exchange MBX OK
first_notification 4
contacts ESS Page, ESS Windows List
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_Exchange*
escalation_period Exchange MBX OK
first_notification 4
contacts John P. Sophy
}
define serviceescalation {
name service_notify_once
first_notification 1
last_notification 1
notification_interval 0
escalation_period 24x7
escalation_options w,u,c
register 0
}

@ -1,122 +0,0 @@
define servicegroup {
servicegroup_name SharePoint Dev/QA
alias SharePoint Dev/QA services
members csgspfe100w,nrpe_wintest_service_SharePoint2K10, csgspfe101w,nrpe_wintest_service_SharePoint2K10, csgspapp102w,nrpe_wintest_service_SharePoint2K10, csgspapp103w,nrpe_wintest_service_SharePoint2K10
}
define servicegroup {
servicegroup_name Maestro_DEV
alias Dev Maestro Services and Disk
members ais302l, nrpe_maestro_stdlistsz, ais302l, nrpe_unixtest_disk_app_maestro, ais302l, nrpe_maestro_procs, landrdev, nrpe_maestro_stdlistsz, ais101l, nrpe_maestro_stdlistsz, ais101l, nrpe_maestro_procs, ais101l, nrpe_unixtest_disk_app_maestro
}
define servicegroup {
servicegroup_name Maestro_Prod
alias Maestro Production Services
members ais204l, nrpe_maestro_stdlistsz, ais204l, nrpe_unix_disk_app_maestro, ais204l, nrpe_maestro_procs
}
define servicegroup {
servicegroup_name Maestro_app_services
alias Maestro/TWS application checks
members landr,nrpe_maestro_stdlistsz, landrdev,nrpe_maestro_stdlistsz
}
define servicegroup {
servicegroup_name Monitor
alias All important checks for the monitoring infrastructure
servicegroup_members Monitor Production, Monitor Dev/QA
}
define servicegroup {
servicegroup_name Monitor Production
alias Important checks for the production monitoring infrastructure
members mon204l,Gearman, mon204l,Selenium, mon205l,Gearman, mon205l,Selenium, monitor,Gearman Hub, monitor,Selenium Cluster, monitor,Selenium Hub
}
define servicegroup {
servicegroup_name Monitor Dev/QA
alias Important checks for the devqa monitoring infrastructure
members mon302l,Gearman DevQA, mon302l,Selenium DevQA, mon303l,Gearman DevQA, mon303l,Selenium DevQA, monitor-dev,Gearman DevQA Hub, monitor-dev,Selenium DevQA Cluster, monitor-dev,Selenium DevQA Hub
}
define servicegroup {
servicegroup_name OnBase Development
alias Checks for OnBase Development
members aisob301w,nrpe_wintest_service_W3SVC, aisob302w,nrpe_wintest_service_W3SVC, aisob310w,nrpe_wintest_service_W3SVC, aisob311w,nrpe_wintest_service_W3SVC, aisob315w,nrpe_wintest_service_W3SVC, aisob316w,nrpe_wintest_service_W3SVC, aisob316w,http_OnBase_Hyland, aisob318w,nrpe_wintest_service_W3SVC, aisob302w,nrpe_wintest_service_OnBase_DDS, aisob319w,nrpe_wintest_service_OnBase_DDS, aisob313w,nrpe_wintest_service_SMTP, aisob313w,nrpe_wintest_service_Hyland, aisob318w,nrpe_wintest_service_Hyland_FTS, aisob314w,nrpe_wintest_service_Hyland_Unity, aisob316w,nrpe_wintest_service_BizTalk
}
define servicegroup {
servicegroup_name OnBase QA
alias Checks for OnBase QA
members aisob301tstw,nrpe_wintest_service_W3SVC, aisob302tstw,nrpe_wintest_service_W3SVC, aisob310tstw,nrpe_wintest_service_W3SVC, aisob311tstw,nrpe_wintest_service_W3SVC, aisob315tstw,nrpe_wintest_service_W3SVC, aisob318tstw,nrpe_wintest_service_W3SVC, aisob302tstw,nrpe_wintest_service_OnBase_DDS, aisob319tstw,nrpe_wintest_service_OnBase_DDS, aisob313tstw,nrpe_wintest_service_SMTP, aisob313tstw,nrpe_wintest_service_Hyland, aisob314tstw,nrpe_wintest_service_Hyland_Unity, aisob101w,nrpe_wintest_service_W3SVC, aisob102w,nrpe_wintest_service_W3SVC, aisob110w,nrpe_wintest_service_W3SVC, aisob111w,nrpe_wintest_service_W3SVC, aisob115w,nrpe_wintest_service_W3SVC, aisob118w,nrpe_wintest_service_W3SVC, aisob102w,nrpe_wintest_service_OnBase_DDS, aisob119w,nrpe_wintest_service_OnBase_DDS, aisob113w,nrpe_wintest_service_SMTP, aisob113w,nrpe_wintest_service_Hyland, aisob118w,nrpe_wintest_service_Hyland_FTS, aisob114w,nrpe_wintest_service_Hyland_Unity
}
define servicegroup {
servicegroup_name OnBase Dev/QA
alias Checks for OnBase Dev/QA
servicegroup_members OnBase Development, OnBase QA
}
define servicegroup {
servicegroup_name OnBase Production
alias Checks for OnBase Production
members aisob201w,nrpe_win_service_W3SVC, aisob202w,nrpe_win_service_W3SVC, aisob210w,nrpe_win_service_W3SVC, aisob211w,nrpe_win_service_W3SVC, aisob215w,nrpe_win_service_W3SVC, aisob216w,nrpe_win_service_W3SVC, aisob216w,http_OnBase_Hyland, aisob218w,nrpe_win_service_W3SVC, aisob202w,nrpe_win_service_OnBase_DDS, aisob219w,nrpe_win_service_OnBase_DDS, aisob213w,nrpe_win_service_SMTP, aisob213w,nrpe_win_service_Hyland, aisob218w,nrpe_win_service_Hyland_FTS, aisob214w,nrpe_win_service_Hyland_Unity, aisob216w,nrpe_win_service_BizTalk
}
define servicegroup {
servicegroup_name csg_services
alias imap, smtp, pop3
members lists,SMTP, smtp,SMTP, smtp,SMTPS
}
define servicegroup {
servicegroup_name disk_app_lsscvms_services
alias Drives D - K - Life Safety and Security
members lsscvms207w,nrpe_win_disk_app
}
define servicegroup {
servicegroup_name Webchecks
alias Webchecks to be run locally
members iamcas200w,https_CAS, iamcas201w,https_CAS, iamxythos200l,https_Webspace, iamxythos201l,https_Webspace, sdprsa200l,https_rsa_sc, sdprsa200l,https_rsa_ss, sdprsa201l,https_rsa_sc
}
define servicegroup {
servicegroup_name Local
alias Checks to be run locally
members backupvpn,Comcast, backupvpn,Google through Comcast, backupvpn,Verizon, backupvpn,Yahoo through Verizon, ims204,Naemon Latency, ims205,Naemon Latency, mon204l,Gearman, mon205l,Gearman, mon204l,Selenium, mon205l,Selenium, mon302l,Gearman DevQA, mon303l,Gearman DevQA, mon302l,Selenium DevQA, mon303l,Selenium DevQA, monitor-dev,Gearman DevQA Hub, monitor-dev,Selenium DevQA Hub, x110client01,snmp_unixtest_proc_memory_usage, x110client02,snmp_unixtest_proc_memory_usage, x210client01,snmp_unix_proc_memory_usage, x210client02,snmp_unix_proc_memory_usage
}
define servicegroup {
servicegroup_name Loghost
alias Log checks on eis222l
members .*,nrpe_unix_log_nfs_failure, .*,nrpe_unixtest_log_nfs_failure
}
define servicegroup {
servicegroup_name Network NTP
alias Network and Monitoring NTP services
members alfrente,NTP, alfrente,NTPq, capserver,NTP, capserver,NTPq, cuckoo,NTP, cuckoo,NTPq, four11,NTP, four11,NTPq, iblox1-vrrp,NTP, iblox1-vrrp,NTPq, iblox2-vrrp,NTP, iblox2-vrrp,NTPq, ibddipv6-vrrp,NTP, ibddipv6-vrrp,NTPq, netvclock200l,NTP, netvclock200l,NTPq, oznot,NTP, oznot,NTPq
}
define servicegroup {
servicegroup_name Network Web
alias Network and Monitoring Web checks
members Webcheck_host,https_mrtg_net, Webcheck_host,https_www_net
}
define servicegroup {
servicegroup_name External DNS
alias Backup external DNS servers
members monitor,DNS_a1-158_akam_net, monitor,DNS_a20-65_akam_net, monitor,DNS_a24-66_akam_net, monitor,DNS_a3-67_akam_net, monitor,DNS_a6-64_akam_net, monitor,DNS_a7-65_akam_net, monitor,DNS_auth1_dns_cogentco, monitor,DNS_auth2_dns_cogentco
}
define servicegroup {
servicegroup_name Network and Monitoring
alias Checks for Network and Monitoring group
# servicegroup_members External DNS, Network NTP, Network Web, Solaris DNS
servicegroup_members External DNS, Network NTP, Network Web
}

File diff suppressed because it is too large Load Diff

@ -1,200 +0,0 @@
define servicedependency {
dependent_hostgroup_name NS PrivateDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker NS PrivateDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS PublicDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker NS PublicDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS Trust
dependent_service_description .*
host_name monitor
service_description Gearman worker NS Trust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name NS Untrust, NS Restricted
dependent_service_description .*
host_name monitor
service_description Gearman worker NS Untrust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 PrivateDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 PrivateDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 PublicDMZ
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 PublicDMZ
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 Trust
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 Trust
notification_failure_criteria c
}
define servicedependency {
dependent_hostgroup_name 151 Untrust, 151 Restricted
dependent_service_description .*
host_name monitor
service_description Gearman worker 151 Untrust
notification_failure_criteria c
}
define servicedependency {
hostgroup_name Windows Prod
dependent_service_description nrpe_win_.*, !nrpe_win_agent_status
use NRPE_Win_Dependency
}
define servicedependency {
hostgroup_name Physical Prod Windows
dependent_service_description snmp_win_.*, !snmp_win_alive
use SNMP_Win_Dependency
}
define servicedependency {
hostgroup_name Windows Dev/QA
dependent_service_description nrpe_wintest_.*, !nrpe_wintest_agent_status
use NRPE_Win_NonProd_Dependency
}
define servicedependency {
hostgroup_name Windows Dev/QA
dependent_service_description snmp_wintest_.*, !snmp_wintest_alive
use SNMP_Win_NonProd_Dependency
}
define servicedependency {
hostgroup_name Linux Prod, Solaris
dependent_service_description nrpe_unix_.*, !nrpe_unix_agent_status
use NRPE_Unix_Dependency
}
define servicedependency {
hostgroup_name Physical Prod Linux
dependent_service_description snmp_unix_.*, !snmp_unix_alive
use SNMP_Unix_Dependency
}
define servicedependency {
hostgroup_name Linux Dev/QA
dependent_service_description nrpe_unixtest_.*, !nrpe_unixtest_agent_status
use NRPE_Unix_NonProd_Dependency
}
define servicedependency {
hostgroup_name Linux Dev/QA, !CPanel Dev/QA, !Linux DevQA - no SNMP
dependent_service_description snmp_unixtest_.*, !snmp_unixtest_alive
use SNMP_Unix_NonProd_Dependency
}
define servicedependency {
dependent_host_name backupvpn
dependent_service_description Comcast
host_name backupvpn
service_description Google through Comcast
notification_failure_criteria c
}
define servicedependency {
dependent_host_name backupvpn
dependent_service_description Verizon
host_name backupvpn
service_description Yahoo through Verizon
notification_failure_criteria c
}
define servicedependency {
name NRPE_Unix_Dependency
service_description nrpe_unix_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Unix_NonProd_Dependency
service_description nrpe_unixtest_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Win_Dependency
service_description nrpe_win_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name NRPE_Win_NonProd_Dependency
service_description nrpe_wintest_agent_status
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Win_Dependency
service_description snmp_win_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Win_NonProd_Dependency
service_description snmp_wintest_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Unix_Dependency
service_description snmp_unix_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name SNMP_Unix_NonProd_Dependency
service_description snmp_unixtest_alive
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}
define servicedependency {
name maestro_carryfwd_dependency
service_description jnextcheck
execution_failure_criteria w,u,c
notification_failure_criteria w,u,c
register 0
}

@ -1,84 +0,0 @@
define serviceescalation {
use service_notify_once
hostgroup_name Netmgmt, !Netmgmt - No SSH
service_description .*
contacts ESS Ops
}
define serviceescalation {
hostgroup_name Netmgmt, !Netmgmt - No SSH
service_description .*
first_notification 1
last_notification 0
notification_interval 0
escalation_period 24x7
escalation_options r
contacts ESS UNIX List
}
define serviceescalation {
host_name monitor
service_description Gearman worker ims.*
first_notification 12
last_notification 14
notification_interval 120
escalation_period 24x7
escalation_options c
contact_groups Monitoring Admins Pager
}
define serviceescalation {
host_name monitor
service_description Gearman worker (151|NS).*
first_notification 3
last_notification 5
notification_interval 60
escalation_period 24x7
escalation_options c
contact_groups Monitoring Admins Pager
}
define serviceescalation {
use service_notify_once
host_name monitor
service_description .*_akam_net
escalation_options w,c,r
contacts Networking
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_agent_status, nrpe_win_Exchange*
escalation_period Exchange MBX busy
first_notification 1
last_notification 3
notification_interval 10
contact_groups dummy
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_agent_status
escalation_period Exchange MBX OK
first_notification 4
contacts ESS Page, ESS Windows List
}
define serviceescalation {
hostgroup_name Exchange Mailbox
service_description nrpe_win_Exchange*
escalation_period Exchange MBX OK
first_notification 4
contacts John P. Sophy
}
define serviceescalation {
name service_notify_once
first_notification 1
last_notification 1
notification_interval 0
escalation_period 24x7
escalation_options w,u,c
register 0
}

@ -1,122 +0,0 @@
define servicegroup {
servicegroup_name SharePoint Dev/QA
alias SharePoint Dev/QA services
members csgspfe100w,nrpe_wintest_service_SharePoint2K10, csgspfe101w,nrpe_wintest_service_SharePoint2K10, csgspapp102w,nrpe_wintest_service_SharePoint2K10, csgspapp103w,nrpe_wintest_service_SharePoint2K10
}
define servicegroup {
servicegroup_name Maestro_DEV
alias Dev Maestro Services and Disk
members ais302l, nrpe_maestro_stdlistsz, ais302l, nrpe_unixtest_disk_app_maestro, ais302l, nrpe_maestro_procs, landrdev, nrpe_maestro_stdlistsz, ais101l, nrpe_maestro_stdlistsz, ais101l, nrpe_maestro_procs, ais101l, nrpe_unixtest_disk_app_maestro
}
define servicegroup {
servicegroup_name Maestro_Prod
alias Maestro Production Services
members ais204l, nrpe_maestro_stdlistsz, ais204l, nrpe_unix_disk_app_maestro, ais204l, nrpe_maestro_procs
}
define servicegroup {
servicegroup_name Maestro_app_services
alias Maestro/TWS application checks
members landr,nrpe_maestro_stdlistsz, landrdev,nrpe_maestro_stdlistsz
}
define servicegroup {
servicegroup_name Monitor
alias All important checks for the monitoring infrastructure
servicegroup_members Monitor Production, Monitor Dev/QA
}
define servicegroup {
servicegroup_name Monitor Production
alias Important checks for the production monitoring infrastructure
members mon204l,Gearman, mon204l,Selenium, mon205l,Gearman, mon205l,Selenium, monitor,Gearman Hub, monitor,Selenium Cluster, monitor,Selenium Hub
}
define servicegroup {
servicegroup_name Monitor Dev/QA
alias Important checks for the devqa monitoring infrastructure
members mon302l,Gearman DevQA, mon302l,Selenium DevQA, mon303l,Gearman DevQA, mon303l,Selenium DevQA, monitor-dev,Gearman DevQA Hub, monitor-dev,Selenium DevQA Cluster, monitor-dev,Selenium DevQA Hub
}
define servicegroup {
servicegroup_name OnBase Development
alias Checks for OnBase Development
members aisob301w,nrpe_wintest_service_W3SVC, aisob302w,nrpe_wintest_service_W3SVC, aisob310w,nrpe_wintest_service_W3SVC, aisob311w,nrpe_wintest_service_W3SVC, aisob315w,nrpe_wintest_service_W3SVC, aisob316w,nrpe_wintest_service_W3SVC, aisob316w,http_OnBase_Hyland, aisob318w,nrpe_wintest_service_W3SVC, aisob302w,nrpe_wintest_service_OnBase_DDS, aisob319w,nrpe_wintest_service_OnBase_DDS, aisob313w,nrpe_wintest_service_SMTP, aisob313w,nrpe_wintest_service_Hyland, aisob318w,nrpe_wintest_service_Hyland_FTS, aisob314w,nrpe_wintest_service_Hyland_Unity, aisob316w,nrpe_wintest_service_BizTalk
}
define servicegroup {
servicegroup_name OnBase QA
alias Checks for OnBase QA
members aisob301tstw,nrpe_wintest_service_W3SVC, aisob302tstw,nrpe_wintest_service_W3SVC, aisob310tstw,nrpe_wintest_service_W3SVC, aisob311tstw,nrpe_wintest_service_W3SVC, aisob315tstw,nrpe_wintest_service_W3SVC, aisob318tstw,nrpe_wintest_service_W3SVC, aisob302tstw,nrpe_wintest_service_OnBase_DDS, aisob319tstw,nrpe_wintest_service_OnBase_DDS, aisob313tstw,nrpe_wintest_service_SMTP, aisob313tstw,nrpe_wintest_service_Hyland, aisob314tstw,nrpe_wintest_service_Hyland_Unity, aisob101w,nrpe_wintest_service_W3SVC, aisob102w,nrpe_wintest_service_W3SVC, aisob110w,nrpe_wintest_service_W3SVC, aisob111w,nrpe_wintest_service_W3SVC, aisob115w,nrpe_wintest_service_W3SVC, aisob118w,nrpe_wintest_service_W3SVC, aisob102w,nrpe_wintest_service_OnBase_DDS, aisob119w,nrpe_wintest_service_OnBase_DDS, aisob113w,nrpe_wintest_service_SMTP, aisob113w,nrpe_wintest_service_Hyland, aisob118w,nrpe_wintest_service_Hyland_FTS, aisob114w,nrpe_wintest_service_Hyland_Unity
}
define servicegroup {
servicegroup_name OnBase Dev/QA
alias Checks for OnBase Dev/QA
servicegroup_members OnBase Development, OnBase QA
}
define servicegroup {
servicegroup_name OnBase Production
alias Checks for OnBase Production
members aisob201w,nrpe_win_service_W3SVC, aisob202w,nrpe_win_service_W3SVC, aisob210w,nrpe_win_service_W3SVC, aisob211w,nrpe_win_service_W3SVC, aisob215w,nrpe_win_service_W3SVC, aisob216w,nrpe_win_service_W3SVC, aisob216w,http_OnBase_Hyland, aisob218w,nrpe_win_service_W3SVC, aisob202w,nrpe_win_service_OnBase_DDS, aisob219w,nrpe_win_service_OnBase_DDS, aisob213w,nrpe_win_service_SMTP, aisob213w,nrpe_win_service_Hyland, aisob218w,nrpe_win_service_Hyland_FTS, aisob214w,nrpe_win_service_Hyland_Unity, aisob216w,nrpe_win_service_BizTalk
}
define servicegroup {
servicegroup_name csg_services
alias imap, smtp, pop3
members lists,SMTP, smtp,SMTP, smtp,SMTPS
}
define servicegroup {
servicegroup_name disk_app_lsscvms_services
alias Drives D - K - Life Safety and Security
members lsscvms207w,nrpe_win_disk_app
}
define servicegroup {
servicegroup_name Webchecks
alias Webchecks to be run locally
members iamcas200w,https_CAS, iamcas201w,https_CAS, iamxythos200l,https_Webspace, iamxythos201l,https_Webspace, sdprsa200l,https_rsa_sc, sdprsa200l,https_rsa_ss, sdprsa201l,https_rsa_sc
}
define servicegroup {
servicegroup_name Local
alias Checks to be run locally
members backupvpn,Comcast, backupvpn,Google through Comcast, backupvpn,Verizon, backupvpn,Yahoo through Verizon, ims204,Naemon Latency, ims205,Naemon Latency, mon204l,Gearman, mon205l,Gearman, mon204l,Selenium, mon205l,Selenium, mon302l,Gearman DevQA, mon303l,Gearman DevQA, mon302l,Selenium DevQA, mon303l,Selenium DevQA, monitor-dev,Gearman DevQA Hub, monitor-dev,Selenium DevQA Hub, x110client01,snmp_unixtest_proc_memory_usage, x110client02,snmp_unixtest_proc_memory_usage, x210client01,snmp_unix_proc_memory_usage, x210client02,snmp_unix_proc_memory_usage
}
define servicegroup {
servicegroup_name Loghost
alias Log checks on eis222l
members .*,nrpe_unix_log_nfs_failure, .*,nrpe_unixtest_log_nfs_failure
}
define servicegroup {
servicegroup_name Network NTP
alias Network and Monitoring NTP services
members alfrente,NTP, alfrente,NTPq, capserver,NTP, capserver,NTPq, cuckoo,NTP, cuckoo,NTPq, four11,NTP, four11,NTPq, iblox1-vrrp,NTP, iblox1-vrrp,NTPq, iblox2-vrrp,NTP, iblox2-vrrp,NTPq, ibddipv6-vrrp,NTP, ibddipv6-vrrp,NTPq, netvclock200l,NTP, netvclock200l,NTPq, oznot,NTP, oznot,NTPq
}
define servicegroup {
servicegroup_name Network Web
alias Network and Monitoring Web checks
members Webcheck_host,https_mrtg_net, Webcheck_host,https_www_net
}
define servicegroup {
servicegroup_name External DNS
alias Backup external DNS servers
members monitor,DNS_a1-158_akam_net, monitor,DNS_a20-65_akam_net, monitor,DNS_a24-66_akam_net, monitor,DNS_a3-67_akam_net, monitor,DNS_a6-64_akam_net, monitor,DNS_a7-65_akam_net, monitor,DNS_auth1_dns_cogentco, monitor,DNS_auth2_dns_cogentco
}
define servicegroup {
servicegroup_name Network and Monitoring
alias Checks for Network and Monitoring group
# servicegroup_members External DNS, Network NTP, Network Web, Solaris DNS
servicegroup_members External DNS, Network NTP, Network Web
}

@ -1,297 +0,0 @@
define timeperiod {
timeperiod_name Dell-24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
define timeperiod {
timeperiod_name dellworkhours
alias Normal Work Hours
monday 09:00-17:00
tuesday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
friday 09:00-17:00
}
define timeperiod {
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
}
define timeperiod {
timeperiod_name 7x4
alias 7am to 4pm weekdays (Normal ESS work time)
friday 07:00-16:00
wednesday 07:00-16:00
thursday 07:00-16:00
monday 07:00-16:00
tuesday 07:00-16:00
}
define timeperiod {
timeperiod_name 8x5
alias "Normal" Working Hours
friday 08:00-17:00
wednesday 08:00-17:00
thursday 08:00-17:00
monday 08:00-17:00
tuesday 08:00-17:00
}
define timeperiod {
timeperiod_name 9x5
alias Other Working Hours
friday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
monday 09:00-17:00
tuesday 09:00-17:00
}
define timeperiod {
timeperiod_name Dev Dispatcher
alias Dev Dispatcher on dev-webprod off during the summer
september 1 - june 30 / 1 00:00-24:00
}
define timeperiod {
timeperiod_name EGN Dome WWWInterface
alias egn-dome-wwwinterface off during the summer/fall
december 1 - april 20 / 1 00:00-24:00
}
define timeperiod {
timeperiod_name Listserv_hours
alias Hours when Listserv is operational
sunday 00:35-23:45
friday 00:35-23:45
saturday 00:35-23:45
wednesday 00:35-23:45
thursday 00:35-23:45
monday 00:35-23:45
tuesday 00:35-23:45
}
define timeperiod {
timeperiod_name Outside 8x5
alias Offhours 8x5
sunday 00:00-24:00
friday 17:00-24:00,00:00-08:00
saturday 00:00-24:00
wednesday 17:00-24:00,00:00-08:00
thursday 17:00-24:00,00:00-08:00
monday 17:00-24:00,00:00-08:00
tuesday 17:00-24:00,00:00-08:00
}
define timeperiod {
timeperiod_name Except 23:55-6:05
alias Hours except 23:55 to 6:05
sunday 06:05-23:55
friday 06:05-23:55
saturday 06:05-23:55
wednesday 06:05-23:55
thursday 06:05-23:55
monday 06:05-23:55
tuesday 06:05-23:55
}
define timeperiod {
timeperiod_name Except 23:55-3:05
alias Hours except 23:55 to 3:05
sunday 03:05-23:55
friday 03:05-23:55
saturday 03:05-23:55
wednesday 03:05-23:55
thursday 03:05-23:55
monday 03:05-23:55
tuesday 03:05-23:55
}
define timeperiod {
timeperiod_name none
alias No Time Is A Good Time
}
define timeperiod {
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
}
define timeperiod {
timeperiod_name roxen-devedit
alias Daytime hours for Roxen devedit response check
sunday 06:00-21:00
friday 06:00-21:00
saturday 06:00-21:00
wednesday 06:00-21:00
thursday 06:00-21:00
monday 06:00-21:00
tuesday 06:00-21:00
}
define timeperiod {
timeperiod_name score_hours
alias Score: available from 7:30am until 2:00am the following morning
sunday 00:00-02:00,07:30-24:00
friday 00:00-02:00,07:30-24:00
saturday 00:00-02:00,07:30-24:00
wednesday 00:00-02:00,07:30-24:00
thursday 00:00-02:00,07:30-24:00
monday 00:00-02:00,07:30-24:00
tuesday 00:00-02:00,07:30-24:00
}
define timeperiod {
timeperiod_name win_tdpexecc
alias Check for TSM Exchange backup process
friday 10:15-12:00,13:00-17:00
saturday 10:15-12:00,13:00-17:00
wednesday 10:15-12:00,13:00-17:00
thursday 10:15-12:00,13:00-17:00
monday 10:15-12:00,13:00-17:00
tuesday 10:15-12:00,13:00-17:00
}
define timeperiod {
timeperiod_name Except 11:55-12:10
alias Except 11:55pm to 12:10am
friday 00:10-23:55
saturday 00:10-23:55
sunday 00:10-23:55
monday 00:10-23:55
tuesday 00:10-23:55
wednesday 00:10-23:55
thursday 00:10-23:55
}
define timeperiod {
timeperiod_name Except 11:45-12:05
alias Except 11:45pm to 12:05am
friday 00:05-23:45
saturday 00:05-23:45
sunday 00:05-23:45
monday 00:05-23:45
tuesday 00:05-23:45
wednesday 00:05-23:45
thursday 00:05-23:45
}
define timeperiod {
timeperiod_name Except 1-3am
alias Except 1:00am to 3:00am
friday 00:00-01:00,03:00-24:00
saturday 00:00-01:00,03:00-24:00
sunday 00:00-01:00,03:00-24:00
monday 00:00-01:00,03:00-24:00
tuesday 00:00-01:00,03:00-24:00
wednesday 00:00-01:00,03:00-24:00
thursday 00:00-01:00,03:00-24:00
}
define timeperiod {
timeperiod_name Gearman server
alias Gearman server restart
sunday 00:00-00:15
}
define timeperiod {
timeperiod_name Gearman server online
alias Except Gearman server restart
day 1 - -1 00:00-24:00
exclude Gearman server
}
define timeperiod {
timeperiod_name 23:15-23:45 Tue and Fri
alias 11:15pm to 11:45pm Tuesday and Friday
tuesday 23:15-23:45
friday 23:15-23:45
}
define timeperiod {
timeperiod_name Except 23:15-23:45 Tue and Fri
alias All times except 11:15pm to 11:45pm on Tuesday and Friday
day 1 - -1 00:00-24:00
exclude 23:15-23:45 Tue and Fri
}
define timeperiod {
timeperiod_name 4am-9am daily
alias 4am to 9am every day
day 1 - -1 04:00-09:00
}
define timeperiod {
timeperiod_name 9am-4am daily
alias 9am to 4am every day (all times except 4am-9am)
day 1 - -1 00:00-24:00
exclude 4am-9am daily
}
define timeperiod {
timeperiod_name 3am-4am daily
alias 3am to 4am every day
day 1 - -1 03:00-04:00
}
define timeperiod {
timeperiod_name 4am-3am daily
alias 4am to 3am every day (all times except 3am-4am)
day 1 - -1 00:00-24:00
exclude 3am-4am daily
}
define timeperiod {
timeperiod_name 9am-3am daily
alias 9am to 3am every day (all times except 3am-9am)
day 1 - -1 00:00-24:00
exclude 3am-4am daily, 4am-9am daily
}
define timeperiod {
timeperiod_name Exchange MBX busy
alias Exchange Mailbox servers are busy
friday 17:00-24:00
saturday 00:00-24:00
sunday 00:00-24:00
monday 00:00-15:00
}
define timeperiod {
timeperiod_name Exchange MBX OK
alias Exchange Mailbox servers are not busy
friday 00:00-17:00
monday 15:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
}
define timeperiod {
timeperiod_name Exclude Cognos App Server Restart
alias Exclude daily restart time of Cognos App Server
day 1 - -1 05:05-24:00,00:00-04:40
}

@ -1,83 +0,0 @@
$exitCodes = @{
"UNKNOWN" = 3;
"CRITICAL" = 2;
"WARNING" = 1;
"OK" = 0
}
# check if puppet agent is installed on node
$service_name = 'puppet'
try
{
if ((get-service -Name $service_name -ea Stop).Status -ne "Running")
{
Write-Host "Service state:" (get-service -Name $service_name).Status
Exit $exitCodes.Critical
}
}
catch
{
Write-Host "Puppet agent is not installed."
exit $exitCodes.Critical
}
$puppet_file = get-item 'C:\ProgramData\PuppetLabs\puppet\cache\state\last_run_summary.yaml'
# first we are going to check the age of the status file
# if it's older than 1 hour (warning) or 24 hours (critical)
$puppet_file_write_time = $puppet_file.LastWriteTime
$date_string = $puppet_file_write_time -f {MM:dd:yy}
if (((get-date) - $puppet_file_write_time).TotalHours -gt 24 )
{
Write-Host "Last catalog run -- $date_string"
exit $exitCodes.Critical
}
elseif (((get-date) - $puppet_file_write_time).TotalHours -gt 1 )
{
Write-Host "Last catalog run -- $date_string"
exit $exitCodes.Warning
}
# get all items in status yaml file pertaining to events (if they exist)
[System.Collections.ArrayList]$content = get-content $puppet_file
$index = $content.Indexof("events:")
$events = @{}
if ($index -ne -1)
{
$range_events = $content.getRange(($index + 1),($content.count - ($index + 1)))
foreach ($event in $range_events)
{
$event = $event.split(":")
$events.Add($event[0].trim(),$event[1].trim())
}
$output_string = "Last catalog run -- " + $date_string + "; Events -- "
foreach ($key in $events.keys)
{
$output_string += $key +": " + $events[$key] + ", "
}
$output_string = $output_string.trimEnd(", ")
if ($events.failure -ne 0)
{
Write-Host $output_string
exit $exitCodes.Critical
}
else
{
Write-Host $output_string
exit $exitCodes.Ok
}
}
else
{
Write-Host "Last catalog run -- $date_string; Catalog run failure"
exit $exitCodes.Critical
}

@ -1,7 +0,0 @@
# Added PU_check_ncpa to do service check based on tokens on host template
define command {
command_name PU_check_ncpa
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ -t "$_HOSTNCPA_TOKEN$" -P $_HOSTNCPA_PORT$ -M "$ARG1$" $ARG2$
}

@ -1,21 +0,0 @@
FAILOVER=/home/nagios/bin/failover.sh
default: test
test:
${FAILOVER} -P primary.localdomain -S secondary.localdomain
go:
${FAILOVER} -P primary.localdomain -S secondary.localdomain -E
force:
${FAILOVER} -P primary.localdomain -S secondary.localdomain -E --force
copy-test:
rsync -avun /home/nagios/princeton/failover/ /home/nagios/bin/
copy:
rsync -avu /home/nagios/princeton/failover/ /home/nagios/bin/
release-%:
rm -f $@.zip
zip -r $@.zip colors.sh failover.sh nagios_startstop.sh rsync_xi.sh START STOP SYNC local/

@ -1,23 +0,0 @@
# Failover for Princeton University
Failover from primary Nagios XI to secondary Nagios XI is a Disaster Recovery effort aimed at providing a near-time up-to-date secondary Nagios server that can take over monitoring and notification options should the primary be unavailable. The primary will always monitor if it is capable. The secondary will only monitor when manually enabled and must also be manually disabled when the primary returns to active service.
## Prerequisites
* Nagios XI must be installed on both boxes with the same version and underlying directory configuration. If there are any differences in file locations or major configuration between the two boxes, the Nagios failover will have unpredictable results, including complete system failure.
* The syncing process will delete files that it does not believe should be on the secondary, so all work must be performed on the primary. Any work performed on the secondary will be overwritten when the next synchronization process occurs. Note that this includes SSH keys, as /home/nagios will be synced from the parimary to the secondary.
* /home/nagios/bin exists and contains the files needed for this process. Note that the sync process will sync these from the primary to the secondary, so like all other files, they must only be modified on the primary.
/home/nagios/bin/failover.sh
/home/nagios/bin/nagios_startstop.sh
/home/nagios/bin/rsync_xi.sh
* The root user has the ability to SSH from the primary to the secondary as the nagios user without entering a passphrase. This is how the rsync and database copies are performed
* root on primary (and root on secondary) has crontab requirements that will be detailed separately.
* nagios on both primary and secondary needs to be able ot sudo to root without a password and execute the rsync command:
NAGIOSXI ALL = NOPASSWD:/usr/bin/rsync *
* nagios user on primary needs to be able to SSH to nagios on secondary without a passphrase (thus, an SSH key and .ssh directory needs to be set up)
* Make sure any ramdisk (such as /ramdisk) is copied if it exists
* Note that any gearman addons such as /etc/mod_gearman or whatever are NOT copied as part of this procedure. These types of things need to be set up on both boxes the same way before this process is set up.

@ -1,3 +0,0 @@
#!/bin/sh
/home/nagios/bin/failover.sh -P epm202l.princeton.edu -S epm100l.Princeton.EDU -E --force

@ -1,3 +0,0 @@
#!/bin/sh
/home/nagios/bin/nagios_startstop.sh stop

@ -1,3 +0,0 @@
#!/bin/sh
/home/nagios/bin/failover.sh -P epm202l.princeton.edu -S epm100l.Princeton.EDU -E

@ -1,20 +0,0 @@
verbose () {
echo $2 "${color_green}$1${color_normal}"
}
error () {
echo $2 "${color_red}$1${color_normal}"
}
warning () {
echo $2 "${color_yellow}$1${color_normal}"
}
# check for color support
if test -t 1; then
# see if it supports colors...
ncolors=$(tput colors)
if test -n "$ncolors" && test $ncolors -ge 8; then
color_normal="$(tput sgr0)"
color_red="$(tput setaf 1)"
color_green="$(tput setaf 2)"
color_yellow="$(tput setaf 3)"
fi
fi

@ -1,113 +0,0 @@
#!/bin/sh
#
# Nagios XI failover for Princeton University
#
# Initial version written by:
# Eric Loyd (eloyd@everwatch.global)
# EverWatch Global, Inc.
PATH=/usr/sbin:/sbin:/usr/bin:/bin
#primary="nagiosxi-p.princeton.edu"
#secondary="nagiosxi-f.princeton.edu"
backupDir="/store/backups/nagiosxi"
force=""
noping="false"
primary=""
secondary=""
synconly="false"
syncname="sync"
extraCmd=""
hostname=`/bin/hostname`
. ./colors.sh
while [ -n "$1" ]; do
case "$1" in
-H | --hostname) hostname="$2"; shift 2;;
-S | --secondary) secondary="$2"; shift 2;;
-P | --primary) primary="$2"; shift 2;;
-n | --sync-name) syncname="$2"; shift 2;;
-s | --sync-only) synconly="true"; shift 1;;
--force) force="true"; shift 1;;
--noping) noping="true"; shift 1;;
*) extraCmd="$extraCmd $1"; shift 1;;
esac
done
[ -z "$hostname" ] && warning "Invalid hostname." && exit 2
ping_host() {
$noping && return 0
/usr/local/nagios/libexec/check_icmp -H $1 >/dev/null 2>&1
}
stop_nagios() {
/home/nagios/bin/nagios_startstop.sh stop
}
start_nagios() {
/home/nagios/bin/nagios_startstop.sh start
}
clean_old_copies() {
verbose "Cleaning up old sync files..." -n
find ${backupDir} -maxdepth 1 -name sync.\* -mtime +1 -exec rm {} \;
verbose "Done"
}
do_nothing() {
warning "We are not the primary or secondary. Doing nothing."
exit 1
}
do_primary() {
verbose "We are the primary. Checking to see if secondary is on the network..."
ping_host ${secondary}
[ $? -ne 0 ] && error "Cannot ping ${secondary}. Use --noping to continue wihout ping." && exit
verbose "Creating package to send to secondary"
/home/nagios/bin/rsync_xi.sh --prepend ${syncname} --primary "${primary}" --secondary "${secondary}" $extraCmd
}
do_secondary() {
verbose "We are the secondary. Checking to see if primary is on the network..."
ping_host ${primary}
if [ $? -eq 0 ]; then
if [ -z $force ]; then
warning "The primary (${primary}) is on the network. This process will be aborted. Use --force to force it to continue."
exit 1
else
warning "The primary (${primary}) is on the network but --force specified. Proceeding anyway."
fi
fi
verbose "Checking for package from the primary"
syncfile=$(basename `ls -tr1 ${backupDir}/${syncname}* | tail -1`)
fullfile="/store/backups/nagiosxi/$syncfile"
if [ -f "$fullfile" ]; then
verbose " Sync file found ($fullfile). Continuing."
/home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "$fullfile"
else
warning " No sync file found. Continuing to activate Nagios."
fi
if [ $? -eq 0 ]; then
chmod 0640 /usr/local/nagiosxi/var/keys/xi.key
chown nagios:nagios /usr/local/nagiosxi/var/keys/xi.key
verbose "This is intended to be manually executed when needed, so we assume you want to start Nagios..." -n
sleep 5
start_nagios
rm -f ${fullfile}
verbose "Done."
fi
}
case "$hostname" in
$primary) do_primary;;
$secondary) do_secondary;;
*) do_nothing
esac
clean_old_copies
exit 0

@ -1,8 +0,0 @@
;#header {
; background: #3cb371;
;}
#header {
background: #c71585;
}

@ -1,8 +0,0 @@
/* Primary CSS */
#header {
background: rgb(0,255,0);
background: -moz-linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
background: -webkit-linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
background: linear-gradient(90deg, rgba(0,255,0,1) 0%, rgba(0,0,0,1) 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#00ff00",endColorstr="#000000",GradientType=1);
}

@ -1,8 +0,0 @@
/* Secondary CSS */
#header {
background: rgb(0,0,255);
background: -moz-linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
background: -webkit-linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
background: linear-gradient(90deg, rgba(0,0,255,1) 0%, rgba(0,0,0,1) 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#0000ff",endColorstr="#000000",GradientType=1);
}

@ -1,50 +0,0 @@
#!/bin/sh
# Set a default path
PATH="/usr/bin:/bin"
# This is where we write to Nagios command pipe
# Make sure it's writeable (follow Nagios plugin exit code API)
commandfile="/usr/local/nagios/var/rw/nagios.cmd"
if [ ! -w "$commandfile" ]; then
echo "ERROR: Cannot write to $commandfile"
exit 2
fi
# Send to Nagios
send_nagios() {
now=`date +%s`
/bin/printf "[%lu] $*\n" $now > $commandfile
}
# Stop executing service checks
stop_engine() {
send_nagios "STOP_EXECUTING_SVC_CHECKS"
send_nagios "STOP_EXECUTING_HOST_CHECKS"
send_nagios "STOP_ACCEPTING_PASSIVE_SVC_CHECKS"
send_nagios "STOP_ACCEPTING_PASSIVE_HOST_CHECKS"
send_nagios "DISABLE_EVENT_HANDLERS"
send_nagios "DISABLE_NOTIFICATIONS"
send_nagios "DISABLE_FLAP_DETECTION"
send_nagios "DISABLE_PERFORMANCE_DATA"
}
# Start the monitoring engine
start_engine() {
send_nagios "START_ACCEPTING_PASSIVE_HOST_CHECKS"
send_nagios "START_ACCEPTING_PASSIVE_SVC_CHECKS"
send_nagios "START_EXECUTING_HOST_CHECKS"
send_nagios "START_EXECUTING_SVC_CHECKS"
send_nagios "ENABLE_EVENT_HANDLERS"
send_nagios "ENABLE_NOTIFICATIONS"
send_nagios "ENABLE_FLAP_DETECTION"
send_nagios "ENABLE_PERFORMANCE_DATA"
}
while [ -n "$1" ]; do
case "$1" in
start) start_engine; shift 1;;
stop) stop_engine; shift 1;;
*) shift 1;;
esac
done

@ -1,520 +0,0 @@
#!/bin/bash
#
# Creates a Full Backup of Nagios XI
# Copyright (c) 2011-2020 Nagios Enterprises, LLC. All rights reserved.
#
PATH=/home/nagios/bin:/usr/bin:/bin
. /home/nagios/bin/colors.sh
BASEDIR="/usr/local/nagiosxi/scripts"
timeStamp=`date +%s`
hostname="`/bin/hostname`"
pName=""
sName=""
noping=/bin/false
execute="-n"
syncfile=""
isP=/bin/false
isS=/bin/false
rsync_opts="-a --delete --delete-after"
# Import Nagios XI and xi-sys.cfg config vars
. $BASEDIR/../var/xi-sys.cfg
eval $(php $BASEDIR/import_xiconfig.php)
###############################
# USAGE / HELP
###############################
usage () {
echo ""
echo "Use this script to synchronize primary XI to secondary, or to expand primary information on secondary"
echo ""
echo " -P | --primary Set the FQDN of the primary (what is returned by /bin/hostname)"
echo " -S | --secondary Set the FQDN of the secondary (what is returned by /bin/hostname)"
echo " -F | --file Set the name of the file that we will be restoring from on the secondary"
echo " -E | --execute Perform the sync (otherwise, it just does a dry-run)"
echo " -n | --name Set the name of the backup minus the .tar.gz"
echo " -p | --prepend Prepend a string to the .tar.gz name"
echo " -a | --append Append a string to the .tar.gz name"
echo " -d | --directory Change the directory to store the compressed backup"
echo ""
}
###############################
# ADDING LOGIC FOR NEW BACKUPS
###############################
while [ -n "$1" ]; do
case "$1" in
-P | --primary)
pName="$2"
;;
-S | --secondary)
sName="$2"
;;
-E | --execute)
execute=""
;;
-F | --file)
syncfile="$2"
;;
--noping)
noping=/bin/true
;;
-h | --help)
usage
exit 0
;;
-n | --name)
fullname=$2
;;
-p | --prepend)
prepend=$2"."
;;
-a | --append)
append="."$2
;;
-d | --directory)
rootdir=$2
;;
esac
shift
done
do_primary() {
#ping_host $sName
#[ $? -ne 0 ] && echo "Cannot ping $sName. Use --noping to continue wihout ping." && exit
echo "Starting sync from $pName to $sName"
# Restart nagios to forcibly update retention.dat
verbose "Restarting nagios to forcibly update retention.dat"
sudo $BASEDIR/manage_services.sh stop nagios
sleep 5
sudo $BASEDIR/manage_services.sh start nagios
if [ -z $rootdir ]; then
rootdir="/store/backups/nagiosxi"
fi
# Move to root dir to store backups
cd $rootdir
#############################
# SET THE NAME & TIME
#############################
name=$fullname
if [ -z $fullname ]; then
name=$prepend$timeStamp$append
fi
# Get current Unix timestamp as name
if [ -z $name ]; then
name=timeStampts
fi
# My working directory
workDir=$rootdir/$name
# Make directory for this specific backup
mkdir -p $workDir
do_rsync() {
verbose "Syncing $1 (Excluding ${2:-nothing})..."
src="$1"
[ -n "$2" ] && exclude="--exclude $2" || exclude=""
[ ! -e "$src" ] && warning " OK: No such file or directory: $src" && return
[ -d "$src" ] && sudo /usr/bin/rsync --rsync-path="sudo /bin/rsync" ${rsync_opts} ${exclude} ${execute} ${src}/ nagios@${sName}:${src}/
[ -f "$src" ] && sudo /usr/bin/rsync --rsync-path="sudo /bin/rsync" ${rsync_opts} ${exclude} ${execute} ${src} nagios@${sName}:${src}
}
do_backup_files() {
##############################
# BACKUP DIRS
##############################
# Only backup NagiosQL if it exists
if [ -d "/var/www/html/nagiosql" ]; then
do_rsync /var/www/html/nagiosql
do_rsync /etc/nagiosql
fi
do_rsync /etc/apache2/sites-available/default-ssl.conf
do_rsync /etc/logrotate.d/nagiosxi
do_rsync /etc/mrtg/conf.d
do_rsync /etc/mrtg/mrtg.cfg
do_rsync /etc/snmp
do_rsync /etc/sysconfig/nagios
do_rsync /home/nagios
do_rsync $httpdconfdir/nagios.conf
do_rsync $httpdconfdir/nagiosmobile.conf
do_rsync $httpdconfdir/nagiosxi.conf
do_rsync $httpdconfdir/nagvis.conf
do_rsync $httpdconfdir/nrdp.conf
do_rsync $httpdconfdir/ssl.conf
do_rsync /usr/local/nagios
do_rsync /usr/local/nagiosmobile
do_rsync /usr/local/nagiosxi custom-includes/css/
do_rsync /usr/local/nagvis
do_rsync /usr/local/nrdp
do_rsync /usr/share/snmp
do_rsync /var/lib/mrtg
do_rsync /var/spool/cron/apache
do_rsync /var/spool/cron/crontabs/$apacheuser
} # End of do_backup_files
do_backup_sql() {
##############################
# BACKUP DATABASES
##############################
echo "Backing up MySQL databases..."
mkdir -p $workDir/mysql
if [[ "$cfg__db_info__ndoutils__dbserver" == *":"* ]]; then
ndoutils_dbport=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f2 -d":"`
ndoutils_dbserver=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f1 -d":"`
else
ndoutils_dbport='3306'
ndoutils_dbserver="$cfg__db_info__ndoutils__dbserver"
fi
mysqldump -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u $cfg__db_info__ndoutils__user --password="$cfg__db_info__ndoutils__pwd" --add-drop-database -B $cfg__db_info__ndoutils__db > $workDir/mysql/nagios.sql
res=$?
if [ $res != 0 ]; then
echo "Error backing up MySQL database 'nagios' - check the password in this script!"
rm -r $workDir
exit $res;
fi
if [[ "$cfg__db_info__nagiosql__dbserver" == *":"* ]]; then
nagiosql_dbport=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f2 -d":"`
nagiosql_dbserver=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f1 -d":"`
else
nagiosql_dbport='3306'
nagiosql_dbserver="$cfg__db_info__nagiosql__dbserver"
fi
mysqldump -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u $cfg__db_info__nagiosql__user --password="$cfg__db_info__nagiosql__pwd" --add-drop-database -B $cfg__db_info__nagiosql__db > $workDir/mysql/nagiosql.sql
res=$?
if [ $res != 0 ]; then
echo "Error backing up MySQL database 'nagiosql' - check the password in this script!"
rm -r $workDir
exit $res;
fi
# Only backup PostgresQL if we are still using it
if [ $cfg__db_info__nagiosxi__dbtype == "pgsql" ]; then
echo "Backing up PostgresQL databases..."
mkdir -p $workDir/pgsql
if [ -z $cfg__db_info__nagiosxi__dbserver ]; then
cfg__db_info__nagiosxi__dbserver="localhost"
fi
pg_dump -h $cfg__db_info__nagiosxi__dbserver -c -U $cfg__db_info__nagiosxi__user $cfg__db_info__nagiosxi__db > $workDir/pgsql/nagiosxi.sql
res=$?
if [ $res != 0 ]; then
echo "Error backing up PostgresQL database 'nagiosxi' !"
rm -r $workDir
exit $res;
fi
else
if [[ "$cfg__db_info__nagiosxi__dbserver" == *":"* ]]; then
nagiosxi_dbport=`echo "$cfg__db_info__nagiosxi__dbserver" | cut -f2 -d":"`
nagiosxi_dbserver=`echo "$cfg__db_info__nagiosxi__dbserver" | cut -f1 -d":"`
else
nagiosxi_dbport='3306'
nagiosxi_dbserver="$cfg__db_info__nagiosxi__dbserver"
fi
mysqldump -h "$nagiosxi_dbserver" --port="$nagiosxi_dbport" -u $cfg__db_info__nagiosxi__user --password="$cfg__db_info__nagiosxi__pwd" --add-drop-database -B $cfg__db_info__nagiosxi__db > $workDir/mysql/nagiosxi.sql
res=$?
if [ $res != 0 ]; then
echo "Error backing up MySQL database 'nagiosxi' - check the password in this script!"
rm -r $workDir
exit $res;
fi
fi
##############################
# COMPRESS BACKUP
##############################
verbose "Compressing database file..." -n
tar czfp $name.tar.gz $name
rm -rf $name
verbose "Done."
# Change ownership
chown $nagiosuser:$nagiosgroup $name.tar.gz
if [ -s $name.tar.gz ];then
echo " "
echo "==============="
echo "BACKUP COMPLETE"
echo "==============="
echo "Backup stored in $rootdir/$name.tar.gz"
else
echo " "
echo "==============="
echo "BACKUP FAILED"
echo "==============="
echo "File was not created at $rootdir/$name.tar.gz"
rm -rf $workDir
exit 1;
fi
do_rsync $rootdir/$name.tar.gz
rm -Rf $rootdir/$name.tar.gz
} # End of do_backup_sql
do_backup_files
do_backup_sql
} # End of do_primary
restore_secondary() {
# Change this password if your root password is different than "nagiosxi"
# MySQL root password
themysqlpass="nagiosxi"
# Tests mysql connection by opening a connection and selecting the DB we want to use
test_mysql_connection() {
local db_host="$1"
local db_port="$2"
local db_username="$3"
local db_password="$4"
db_error=$(mysql -h "$db_host" --port="$db_port" -u $db_username --password=$db_password -e "show databases;" 2>&1)
return $?
}
rootdir=/store/backups/nagiosxi
backupfile=$1
if [ ! -f $backupfile ]; then
error "Unable to find backup file $backupfile!"
exit 1
fi
ts=`date +%s`
mydir=${rootdir}/${ts}-restore
mkdir -p $mydir
if [ ! -d $mydir ]; then
error "Unable to create restore directory $mydir!"
exit 1
fi
# Extract backup
verbose "Extracting backup to $mydir..."
cd $mydir
tar xzfps $backupfile
# Change to subdirectory
cd `ls | head -1`
backupdir=`pwd`
verbose "Backup files look okay. Preparing to restore..."
# Shutdown services
verbose "Shutting down services..."
[ -r "/usr/local/nagios/var/retention.dat" ] && cp /usr/local/nagios/var/retention.dat $backupdir
sudo $BASEDIR/manage_services.sh stop nagios
sudo $BASEDIR/manage_services.sh stop ndo2db
sudo $BASEDIR/manage_services.sh stop npcd
[ -r "$backupdir/retention.dat" ] && cp $backupdir/retention.dat /usr/local/nagios/var/retention.dat
rootdir=/
# Overwrite the mysqlpass with the hardcoded one at the top
mysqlpass="$themysqlpass"
# Restore databases
verbose "Restoring MySQL databases..."
if [[ "$cfg__db_info__ndoutils__dbserver" == *":"* ]]; then
ndoutils_dbport=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f2 -d":"`
ndoutils_dbserver=`echo "$cfg__db_info__ndoutils__dbserver" | cut -f1 -d":"`
else
ndoutils_dbport='3306'
ndoutils_dbserver="$cfg__db_info__ndoutils__dbserver"
fi
# Test mysql and see if we can connect before continuing
x=1
while [ $x -le 5 ];
do
test_mysql_connection $ndoutils_dbserver $ndoutils_dbport "root" $mysqlpass
if [ $? == 1 ]; then
error "ERROR: Could not connect to $ndoutils_dbserver:$ndoutils_dbport with root password supplied."
read -s -r -p "Please enter the MySQL root password: " mysqlpass
echo ""
else
break
fi
if [ $x -eq 5 ]; then
error "ERROR: Aborting restore: Could not connect to MySQL."
error "$db_error"
exit 1
fi
x=$(($x+1))
done
# Save old Program URL
old_url=$(echo "select value from xi_options where name='url'" | mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass -N nagiosxi)
mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass < $backupdir/mysql/nagios.sql
res=$?
if [ $res != 0 ]; then
error "Error restoring MySQL database 'nagios'"
exit 1
fi
# Restore old Program URL
echo "update xi_options set value='$old_url' where name='url'" | mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass -N nagiosxi
if [[ "$cfg__db_info__nagiosql__dbserver" == *":"* ]]; then
nagiosql_dbport=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f2 -d":"`
nagiosql_dbserver=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f1 -d":"`
else
nagiosql_dbport='3306'
nagiosql_dbserver="$cfg__db_info__nagiosql__dbserver"
fi
# Test mysql again and see if we can connect before continuing
x=1
while [ $x -le 5 ];
do
test_mysql_connection $nagiosql_dbserver $nagiosql_dbport "root" $mysqlpass
if [ $? == 1 ]; then
error "ERROR: Could not connect to $nagiosql_dbserver:$nagiosql_dbport with root password supplied."
read -s -r -p "Please enter the MySQL root password: " mysqlpass
echo ""
else
break
fi
if [ $x -eq 5 ]; then
error "ERROR: Aborting restore: Could not connect to MySQL."
error "$db_error"
exit 1
fi
x=$(($x+1))
done
mysql -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u root --password=$mysqlpass < $backupdir/mysql/nagiosql.sql
res=$?
if [ $res != 0 ]; then
error "Error restoring MySQL database 'nagiosql'"
exit 1
fi
# Only restore PostgresQL if we are still using it
if [ "$cfg__db_info__nagiosxi__dbtype" == "pgsql" ]; then
service postgresql initdb &>/dev/null || true
verbose "Restoring Nagios XI PostgresQL database..."
if [ -f /var/lib/pgsql/data/pg_hba.conf ]; then
pghba="/var/lib/pgsql/data/pg_hba.conf"
cp -pr $pghba $pghba.old
else
#Ubuntu/Debian
pghba=$(find /etc/postgresql -name "*pg_hba.conf")
cp -pr $pghba $pghba.old
fi
echo "local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust" > $pghba
$BASEDIR/manage_services.sh start postgresql
sudo -u postgres psql -c "create user nagiosxi with password 'n@gweb';"
sudo -u postgres psql -c "create database nagiosxi owner nagiosxi;"
$BASEDIR/manage_services.sh restart postgresql
# Sleep a bit (required so Postgres finishes startup before we connect again)
verbose "Sleeping for a few seconds (please wait)..."
sleep 7
psql -U nagiosxi nagiosxi < $backupdir/pgsql/nagiosxi.sql
res=$?
if [ $res != 0 ]; then
error "Error restoring PostgresQL database 'nagiosxi' !"
exit 1
fi
$BASEDIR/manage_services.sh restart postgresql
if [ "$dist" == "el7" ] || [ "$dist" == "el8" ]; then
systemctl enable postgresql.service
elif [[ "$distro" == "Ubuntu" ]] || [[ "$distro" == "Debian" ]]; then
update-rc.d postgresql enable
else
chkconfig postgresql on
fi
# Remove nagiosxi db from mysql if postgres is used instead
if [[ "$cfg__db_info__nagiosql__dbserver" == *":"* ]]; then
nagiosql_dbport=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f2 -d":"`
nagiosql_dbserver=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f1 -d":"`
else
nagiosql_dbport='3306'
nagiosql_dbserver="$cfg__db_info__nagiosql__dbserver"
fi
mysql -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u root --password=$mysqlpass < "DROP TABLE IF EXISTS nagiosxi;"
else
verbose "Restoring Nagios XI MySQL database..."
if [[ "$cfg__db_info__nagiosxi__dbserver" == *":"* ]]; then
nagiosxi_dbport=`echo "$cfg__db_info__nagiosxi__dbserver" | cut -f2 -d":"`
nagiosxi_dbserver=`echo "$cfg__db_info__nagiosxi__dbserver" | cut -f1 -d":"`
else
nagiosxi_dbport='3306'
if [ "x$cfg__db_info__nagiosxi__dbserver" == "x" ]; then
nagiosxi_dbserver="localhost"
else
nagiosxi_dbserver="$cfg__db_info__nagiosxi__dbserver"
fi
fi
# Test mysql again and see if we can connect before continuing
x=1
while [ $x -le 5 ];
do
test_mysql_connection $nagiosxi_dbserver $nagiosxi_dbport "root" $mysqlpass
if [ $? == 1 ]; then
error "ERROR: Could not connect to $nagiosxi_dbserver:$nagiosxi_dbport with root password supplied."
read -s -r -p "Please enter the MySQL root password: " mysqlpass
echo ""
else
break
fi
if [ $x -eq 5 ]; then
error "ERROR: Aborting restore: Could not connect to MySQL."
error "$db_error"
exit 1
fi
x=$(($x+1))
done
mysql -h "$nagiosxi_dbserver" --port="$nagiosxi_dbport" -u root --password=$mysqlpass < $backupdir/mysql/nagiosxi.sql
res=$?
if [ $res != 0 ]; then
error "Error restoring MySQL database 'nagiosxi' !"
exit 1
fi
fi
##############################
# RESTART SERVICES
##############################
verbose "Restarting services..."
sudo $BASEDIR/manage_services.sh restart mysqld
sudo $BASEDIR/manage_services.sh restart httpd
sudo $BASEDIR/manage_services.sh start npcd
sudo $BASEDIR/manage_services.sh start ndo2db
sudo $BASEDIR/manage_services.sh start nagios
verbose "Restarting Nagios XI"
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
rm -rf $mydir
echo " "
echo "==============="
echo "RESTORE COMPLETE"
echo "==============="
}
do_secondary() {
[ ! -r "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2
restore_secondary "$syncfile"
if [ $? -eq 0 ]; then
if [ -r "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.secondary" -a -w "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css" ]; then
cp /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.secondary /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css
fi
rm -f ${syncfile}
fi
} # End of do_secondary
ping_host() {
$noping && return 0
/usr/local/nagios/libexec/check_icmp -H $1 >/dev/null 2>&1
}
[ -z "$pName" -o -z "$sName" ] && echo "Must specify primary name and secondary name" && exit 0
[ "$hostname" = "$pName" ] && isP=/bin/true
[ "$hostname" = "$sName" ] && isS=/bin/true
$isP && do_primary
$isS && do_secondary

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,85 +0,0 @@
HOME="/home/nagios"
PATH="/usr/local/monitoring/bin:/home/nagios/bin:/usr/local/perl/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/dell/srvadmin/bin"
MAILTO="epm-list@Princeton.EDU"
#*/5 * * * * (/bin/bash -l -c "/usr/bin/php /usr/local/cacti/poller.php") >/usr/local/monitoring/log/cacti-poller.log 2>&1
*/5 * * * * (/bin/bash -l -c "/usr/bin/php /usr/local/cacti/poller.php") >/dev/null 2>&1
# check moved the check_email_delivery
##*/15 * * * * /bin/echo "Lists Test with checksum $(/bin/echo \"Lists Test on $(date)\" | /usr/bin/md5sum)" | /bin/mail -s "Lists tests with checksum $(/bin/echo \"Lists Test on $(date)\" | /usr/bin/md5sum)" gwmon@lists.princeton.edu
# Clean the groundwk mailbox every couple of days
##00 00 * * 0,2,4,6 /usr/local/monitoring/princeton/bulk_email_delete -c /usr/local/monitoring/etc/bulk_email_delete.conf -u grndwk2 -h owa.princeton.edu:993 -s -m 100:400
##20 00 * * 0,2,4,6 /usr/local/monitoring/princeton/bulk_email_delete -c /usr/local/monitoring/etc/bulk_email_delete.conf -u groundwk -h owa.princeton.edu:993 -s -m 100:400
# Apps database backup every day at 10pm
0 22 * * * /usr/local/monitoring/princeton/db_backup >/usr/local/monitoring/backups/db_backup.log 2>&1
# RRD backup at 11pm
00 23 * * * /bin/tar cfP /usr/local/monitoring/backups/rrd_backup.tar /usr/local/monitoring/rrd >/dev/null
# Weekly host/service disabled notification report
00 09 * * 3 /usr/local/monitoring/princeton/host_service_status.awk /usr/local/monitoring/var/naemon/status.dat | mail -s "Disabled host/service checks and notifications" chris@princeton.edu epm-list@princeton.edu
# Daily Dell Temp Report - requested cancelled
#00 * * * * /usr/local/monitoring/princeton/dell_temp_report 2>&1 | mail -s "Dell Temperature Report" eisinv@princeton.edu
# Hourly Encoder Temp Report - requested cancelled
#00 * * * * /usr/local/monitoring/princeton/dell_temp_report encoder01 encoder02 encoder03 | mail -s "encoder's Temperature Report" augustin@princeton.edu
# Nagios passive checks
##10 11 * * * /usr/local/monitoring/nagios/libexec/check_nrpe_passive -h `sed -n '/define hostgroup/{N;/hostgroup_name[[:space:]]\+Windows Dev\/QA$/{N;N;s/.*members[[:space:]]\+//p}}' /usr/local/monitoring/var/naemon/objects.cache` -s nrpe_wintest_tsm_backups -c check_tsm_backups -m 5 2 5
00 09 * * * /usr/local/monitoring/nagios/libexec/check_nrpe_passive -h `sed -n '/define hostgroup/{N;/hostgroup_name[[:space:]]\+\(CPanel Dev\/QA\|Linux Dev\/QA\)$/{N;N;s/.*members[[:space:]]\+//p}}' /usr/local/monitoring/var/naemon/objects.cache | tr '\n' ','` -s nrpe_unixtest_tsm_backups -c check_tsm_backups -m 10 2 5
##00 15 * * * /usr/local/monitoring/nagios/libexec/check_nrpe_passive -h `sed -n '/define hostgroup/{N;/hostgroup_name[[:space:]]\+Windows Prod$/{N;N;s/.*members[[:space:]]\+//p}}' /usr/local/monitoring/var/naemon/objects.cache | tr '\n' ','` -s nrpe_win_tsm_backups -c check_tsm_backups -m 10 2 5
00 13 * * * /usr/local/monitoring/nagios/libexec/check_nrpe_passive -h `sed -n '/define hostgroup/{N;/hostgroup_name[[:space:]]\+\(CPanel Prod\|Linux Prod\)$/{N;N;s/.*members[[:space:]]\+//p}}' /usr/local/monitoring/var/naemon/objects.cache | tr '\n' ','` -s nrpe_unix_tsm_backups -c check_tsm_backups -m 20 2 5
# Dump hosts from Cacti
00 12 * * * /usr/bin/php /usr/local/cacti/cli/add_tree.php --list-hosts > /usr/local/cacti/cac_hosts 2>/dev/null
# Add hosts to Nagios, Cacti, SIEM
00 19 * * * . $HOME/.ssh/.ssh-agent >/dev/null 2>&1; /usr/local/monitoring/princeton/nagios_modify >> /usr/local/monitoring/log/nagios_modify.log 2>&1
# Reload Cacti Update script
00 00 * * 1-6 /bin/kill -HUP `cat /var/run/cacti/cacti_update.pid`
00 00 * * 0 /bin/kill -TERM `cat /var/run/cacti/cacti_update.pid`; sleep 300; cd /usr/local/monitoring/nagios/libexec/eventhandlers; ./cacti_update
# Dump host info from different Nagios groups into files and upload to a Samba share for ESS
00 00 * * * /usr/local/monitoring/princeton/hostdump
# PreProduction report
00 07 * * 3 /usr/local/monitoring/princeton/preprodreport | sort -k2,2 | mail -s "Pre-Production host report" chris@Princeton.EDU igubenko@Princeton.EDU epm-list@princeton.edu
# Load malicious IPs from emails to a SMB share for the SIEM
00 01,13 * * * /usr/local/monitoring/princeton/siem_process
# Create Nagios contacts from LDAP groups authorized for Nagios, for authorization purposes (MK Livestatus, others)
00 * * * * /usr/local/monitoring/princeton/create_auth_contacts_from_ldap
# AP Building report for Dave W. -- Student project is over - cancelled
#*/5 * * * * /usr/local/monitoring/scripts/aruba_cjhsu/aos_ap_stats_pull
# NEED TO MIGRATE TO ServiceLater: Generate a list of Princeton VLAN's from Host Database
##00 0 * * * /usr/local/monitoring/princeton/netgen > /usr/local/monitoring/etc/punets
# Copy rover hostfile
#00 00,12 * * * . $HOME/.ssh/.ssh-agent >/dev/null 2>&1; /usr/bin/ssh drevil@heymon 2>/dev/null | tar --strip-components=1 -xf - -C /usr/local/monitoring/etc 2>/dev/null
05 00,12 * * * . $HOME/.ssh/.ssh-agent >/dev/null 2>&1; /usr/bin/ssh drevil@heymon 2>/dev/null | dd of=/usr/local/monitoring/etc/hostfile-pager 2>/dev/null; sed '/^# \/rover\/pager.conf/,$!d' /usr/local/monitoring/etc/hostfile-pager > /usr/local/monitoring/etc/rover-pager; sed '/^# \/rover\/pager.conf/,$d' /usr/local/monitoring/etc/hostfile-pager > /usr/local/monitoring/etc/hostfile; rm -f /usr/local/monitoring/etc/hostfile-pager
50 09,15 * * * . $HOME/.ssh/.ssh-agent >/dev/null 2>&1; /usr/local/monitoring/princeton/rover2nag >/usr/local/monitoring/log/rover2nag.log 2>&1
# Load Hostdb entries for Nagios into the MySQL database "notify"
00 03 * * * /usr/local/monitoring/princeton/hostdb_process > /usr/local/monitoring/log/hostdb_mysql.log 2>&1
# Get info from hostdb
##30 04 * * * . $HOME/.ssh/.ssh-agent >/dev/null 2>&1; /usr/local/monitoring/princeton/puhostinfo >/usr/local/monitoring/log/puhostinfo.log 2>&1
### need to figure out what is creating the bloody user.js files in /tmp/tmp* dirs
00 * * * * find /tmp -name user.js 2>/dev/null | sed "s/\/user.js//" | xargs rm -rf
# Check Naemon process
*/5 * * * * res=`/usr/local/monitoring/naemon/plugins/check_nagios -F /usr/local/monitoring/log/naemon.log -e 2 -t 30 -v -C naemon.qh 2>&1`; /usr/local/monitoring/naemon/plugins/eventhandlers/submit_check_result ims204 Naemon $? "$res"
# NEED TO MIGRATE TO ServiceLater: Load a list of IP's that are not part of the PU IP ranges, though are in the host database, on a file share for SIEM consumption
##00 23 * * * /usr/local/monitoring/princeton/non-pu-ip

@ -1,19 +0,0 @@
define command {
command_name notify-host-by-email-address-1
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTADDRESS1$
}
define command {
command_name notify-service-by-email-address-1
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTADDRESS1$
}
define command {
command_name pu-notify-service-by-email-all
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | $USER1$/pu-notify-all-emails -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -t $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
}
define command {
command_name pu-notify-host-by-email-all
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,310 +0,0 @@
#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad (nagios@nagios.org)
#
# Last Modified: 12-11-2006
#
# NOTES:
# This is a sample configuration file for the NRPE daemon. It needs to be
# located on the remote host that is running the NRPE daemon, not the host
# from which the check_nrpe client is being executed.
#############################################################################
# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number. The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.
pid_file=/var/run/nrpe.pid
# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
server_port=9666
# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#server_address=192.168.1.1
# NRPE USER
# This determines the effective user that the NRPE daemon should run as.
# You can either supply a username or a UID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_user=nrpe
# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.
# You can either supply a group name or a GID.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
nrpe_group=nrpe
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address. I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
#allowed_hosts=127.0.0.1,192.168.0.2
# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed. This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments
dont_blame_nrpe=1
# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo. For this to work, you need to add
# the nagios user to your /etc/sudoers. An example entry for alllowing
# execution of the plugins from might be:
#
# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password. If you do this, make sure you don't give
# random users write access to that directory or its contents!
# command_prefix=/usr/bin/sudo
# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
debug=0
# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.
command_timeout=120
# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.
# connection_timeout=300
# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
#allow_weak_random_seed=1
# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.
#include=<somefile.cfg>
# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).
#include_dir=<somedirectory>
#include_dir=<someotherdirectory>
include_dir=/usr/local/nagios/etc/local_conf
# COMMAND DEFINITIONS
# Command definitions that this daemon will run. Definitions
# are in the following format:
#
# command[<command_name>]=<command_line>
#
# When the daemon receives a request to return the results of <command_name>
# it will execute the command specified by the <command_line> argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on! The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory. Also note that you will have to modify the definitions below
# to match the argument format the plugins expect. Remember, these are
# examples only!
# The following examples use hardcoded command arguments...
## command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
## command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
#command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda1
## command[check_disk2]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/hdb1
## command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
## command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
#command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% /
#command[check_asterisk]=/usr/local/nagios/libexec/check_asterisk.pl -m mgr --host 127.0.0.1 -u nagios -p N0WayJ0se --warning zap=2 --critical zap=3
# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'...
command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$ $ARG3$
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.pl -c ALL -W $ARG1$:$ARG2$ -i $ARG3$:$ARG4$
command[check_cpu_system]=/usr/local/nagios/libexec/check_cpu.pl -c ALL -s $ARG1$ -W $ARG2$ $ARG3$
command[check_cpu_user]=/usr/local/nagios/libexec/check_cpu.pl -c ALL -u $ARG1$ $ARG2$
command[check_swap]=/usr/local/nagios/libexec/check_swap -w $ARG1$ -c $ARG2$ $ARG3$
command[check_mem]=/usr/bin/perl /usr/local/nagios/libexec/check_mem.pl -f -w $ARG1$ -c $ARG2$
command[check_active_mem]=/usr/local/nagios/libexec/check_linux_active_mem.pl -w $ARG1$ -c $ARG2$
command[check_proc]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_proclist]=/usr/local/nagios/libexec/check_proclist_linux $ARG1$
command[check_daemon]=/usr/local/nagios/libexec/check_procs -c $ARG1$ -C $ARG2$
command[check_om]=/usr/local/nagios/libexec/check_om_pu.pl
command[check_ipmi_sun_chassis]=/usr/local/nagios/libexec/check_ipmi_sun_chassis.pl
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart -d $ARG1$ $ARG2$
command[check_sensors]=/usr/local/nagios/libexec/check_sensors $ARG1$
command[check_ifoperstatus]=/usr/local/nagios/libexec/check_ifoperstatus -k $ARG1$ -H $ARG2$ $ARG3$
command[check_ifstatus]=/usr/local/nagios/libexec/check_ifstatus -C $ARG1$ -H $ARG2$ -p $ARG3$ $ARG4$
#command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ $ARG3$ $ARG4$ $ARG5$
command[check_all_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$
command[check_disk_class]=/usr/local/nagios/libexec/check_disk_pu.pl -C $ARG1$ -p
command[check_disk_class_all]=/usr/local/nagios/libexec/check_disk_pu.pl -C $ARG1$ -w $ARG2$ -c $ARG3$ -t $ARG4$ -p
command[check_tws_procs]=/usr/local/nagios/libexec/check_maestro_procs.sh
command[check_tws_stdlistsz]=/usr/local/nagios/libexec/check_tws_stdlistsz.pl
command[check_mounts]=/usr/local/nagios/libexec/check_mounted_disks.pl
command[check_faxq]=/usr/local/nagios/libexec/check_faxq.sh $ARG1$ $ARG2$
command[check_dummy]=/usr/local/nagios/libexec/check_dummy $ARG1$ Testing
command[check_files]=/usr/local/nagios/libexec/check_file.pl $ARG1$ $ARG2$
command[check_file_age]=/usr/local/nagios/libexec/check_file_age -f $ARG1$ $ARG2$
command[check_by_ssh]=/usr/local/nagios/libexec/check_by_ssh -H $ARG1$ -C $ARG2$ $ARG3$
command[check_ssh]=/usr/local/nagios/libexec/check_ssh $ARG1$ $ARG2$
command[check_cluster]=/usr/local/nagios/libexec/check_cluster $ARG1$ $ARG2$
command[check_dbi]=/usr/local/nagios/libexec/check_dbi -d $ARG1$ $ARG2$
command[check_mysql]=/usr/local/nagios/libexec/check_mysql $ARG1$
command[check_oracle]=/usr/local/nagios/libexec/check_oracle $ARG1$ $ARG2$
command[check_dig]=/usr/local/nagios/libexec/check_dig -l $ARG1$ $ARG2$
command[check_dns]=/usr/local/nagios/libexec/check_dns -H $ARG1$ $ARG2$
command[check_ntp]=/usr/local/nagios/libexec/check_ntp -H $ARG1$ $ARG2$
command[check_ntp_peer]=/usr/local/nagios/libexec/check_ntp_peer -H $ARG1$ $ARG2$
command[check_ntp_time]=/usr/local/nagios/libexec/check_ntp_time -H $ARG1$ $ARG2$
command[check_time]=/usr/local/nagios/libexec/check_time -H $ARG1$ $ARG2$
command[check_disk_smb]=/usr/local/nagios/libexec/check_disk_smb -H $ARG1$ -s $ARG2$ -u $ARG3$ -p $ARG4$ -w $ARG5$ -c $ARG6$ $ARG7$
command[check_icmp]=/usr/local/nagios/libexec/check_icmp $ARG1$
command[check_fping]=/usr/local/nagios/libexec/check_fping $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
command[check_ping]=/usr/local/nagios/libexec/check_ping -H $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H $ARG1$ -p $ARG2$ $ARG3$
command[check_http]=/usr/local/nagios/libexec/check_http $ARG1$ $ARG2$
command[check_imap]=/usr/local/nagios/libexec/check_imap -H $ARG1$ -p $ARG2$ $ARG3$
command[check_ldap]=/usr/local/nagios/libexec/check_ldap -H $ARG1$ -b $ARG2$ $ARG3$
command[check_log]=/usr/local/nagios/libexec/check_log -F $ARG1$ -O $ARG2$ -q $ARG3$ $ARG4$
command[check_mailq]=/usr/local/nagios/libexec/check_mailq -w $ARG1$ -c $ARG2$ $ARG3$
command[check_real]=/usr/local/nagios/libexec/check_real -H $ARG1$ $ARG2$
command[check_rpc]=/usr/local/nagios/libexec/check_rpc -H $ARG1$ -C $ARG2$ $ARG3$
command[check_tcp]=/usr/local/nagios/libexec/check_tcp -H $ARG1$ -p $ARG2$ $ARG3$
command[check_udp]=/usr/local/nagios/libexec/check_udp -H $ARG1$ -p $ARG2$ $ARG3$
command[check_tws_procs]=/usr/local/nagios/libexec/check_maestro_procs.sh
command[check_tws_stdlistsz]=/usr/local/nagios/libexec/check_tws_stdlistsz.pl
command[check_tws_carryfwd]=/usr/local/nagios/libexec/check_tws_carryf.pl
command[check_tws_unlink]=/usr/local/nagios/libexec/check_tws_unlink.pl
command[check_tws_msgfilesz]=/usr/local/nagios/libexec/check_tws_msgfilesz.pl
command[check_asm_disk]=sudo -u oracle /usr/local/nagios/libexec/check_asm_disk -w $ARG1$ -c $ARG2$
command[check_tsm_backups]=/usr/local/nagios/libexec/check_tsm_backup.sh -w $ARG1$ -c $ARG2$
command[check_multipath]=sudo /usr/local/nagios/libexec/check_multipath -s -n unknown -m $ARG1$ -o $ARG2$
#command[check_nagios]=/usr/local/monitoring/nagios/libexec/check_nagios -F /usr/local/monitoring/nagios/var/status.dat -e 5 -C /usr/local/monitoring/nagios/etc/nagios.cfg
command[check_nagios]=/usr/local/monitoring/nagios/libexec/check_nagios -F $ARG1$ -C $ARG2$ $ARG3$
command[check_nagios_latency]=/usr/local/monitoring/nagios/libexec/check_nagios_latency.pl
command[check_log3]=/usr/local/nagios/libexec/check_log3.pl -l '$ARG1$' -p '$ARG2$' '$ARG3$' '$ARG4$' $ARG5$

@ -1,725 +0,0 @@
; A list of modules.
[/modules]
; Helper function - Various helper function to extend other checks. This is also only supported through NRPE.
CauseCrashes = 1
; CheckDisk - CheckDisk can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckDisk = 1
; Event log Checker. - Check for errors and warnings in the event log. This is only supported through NRPE so if you plan to use only NSClient this wont help you at all.
CheckEventLog = 1
; Check External Scripts - A simple wrapper to run external scripts and batch files.
CheckExternalScripts = 1
; Helper function - Various helper function to extend other checks. This is also only supported through NRPE.
CheckHelpers = 1
; Event log Checker. - Check for errors and warnings in the event log. This is only supported through NRPE so if you plan to use only NSClient this wont help you at all.
CheckLogFile = 1
; check_mk client - A simple check_mk client for checking remote check_mk servers.
CheckMKClient = 0
; NSCP server - A simple server that listens for incoming NSCP connection and handles them.
CheckMKServer = 0
; Check NSCP - Checkes the state of the agent
CheckNSCP = 1
; CheckTaskSched - CheckTaskSched can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckTaskSched = 0
; CheckTaskSched2 - CheckTaskSched2 can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckTaskSched2 = 0
; CheckWMI - CheckWMI can check various file and disk related things. The current version has commands to check Size of hard drives and directories.
CheckWMI = 1
; GraphiteClient - Graphite client
GraphiteClient = 0
; LUAScript - LUAScript...
LUAScript = 1
; NRDPClient - Passive check support over NRDP
NRDPClient = 0
; NRPE client - NRPE client
NRPEClient = 1
; NRPE server - A simple server that listens for incoming NRPE connection and handles them.
NRPEServer = 1
; NSCAClient - Passive check support over NSCA.
NSCAClient = 0
; NSCA server (no encryption) - A simple server that listens for incoming NSCA connection and handles them.
NSCAServer = 0
; NSCP client - A simple client for checking remote NSCP servers.
NSCPClient = 1
; NSCP server - A simple server that listens for incoming NSCP connection and handles them.
NSCPServer = 1
; NSClient server - A simple server that listens for incoming NSClient (check_nt) connection and handles them. Although NRPE is the preferred method NSClient is fully supported and can be used for simplicity or for compatibility.
NSClientServer = 0
; SMTPClient - Passive check support via SMTP
SMTPClient = 0
; Sample plugin - A sample plugin to display how to make plugins...
SamplePluginSimple = 0
; Scheduler - A scheduler which schedules checks at regular intervals
Scheduler = 0
; SimpleCache module - Caches results for later checking.
SimpleCache = 0
; SimpleFileWriter module - FileWriters results for later checking.
SimpleFileWriter = 0
; SyslogClient - Passive check support via Syslog
SyslogClient = 0
; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = enabled
; Section for SMTP passive check module.
[/settings/NRDP/client]
; CHANNEL - The channel to listen to.
channel = NRDP
; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = auto
; Target definition for: default
[/settings/NRDP/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; RECIPIENT - Recipient of email message
recipient = nscp@localhost
; SENDER - Sender of email message
sender = nscp@localhost
; TEMPLATE - Template for message data
template = Hello, this is %source% reporting %message%!
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; Section for NRPE active/passive check module.
[/settings/NRPE/client]
; CHANNEL - The channel to listen to.
channel = NRPE
; Target definition for: default
[/settings/NRPE/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH
; SSL CERTIFICATE -
certificate =
; PAYLOAD LENGTH - Length of payload to/from the NRPE agent. This is a hard specific value so you have to "configure" (read recompile) your NRPE agent to use the same value for it to work.
payload length = 1024
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true
; VERIFY MODE -
verify mode = none
; Section for NRPE (NRPEServer.dll) (check_nrpe) protocol options.
[/settings/NRPE/server]
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true
; PORT NUMBER - Port to use for NRPE.
port = 9666
; Section for NSCA passive check module.
[/settings/NSCA/client]
; CHANNEL - The channel to listen to.
channel = NSCA
; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = auto
; Target definition for: default
[/settings/NSCA/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH
; SSL CERTIFICATE -
certificate =
; ENCRYPTION METHOD - Number corresponding to the various encryption algorithms (see the wiki). Has to be the same as the server or it wont work at all.
encryption = aes
; PASSWORD - The password to use. Again has to be the same as the server or it wont work at all.
password =
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = false
; VERIFY MODE -
verify mode = none
; Section for NSCA (NSCAServer) (check_nsca) protocol options.
[/settings/NSCA/server]
; ENCRYPTION - Encryption to use
encryption = aes
; PASSWORD - Password to use
password =
; PAYLOAD LENGTH - Length of payload to/from the NSCA agent. This is a hard specific value so you have to "configure" (read recompile) your NSCA agent to use the same value for it to work.
payload length = 512
; PERFORMANCE DATA - Send performance data back to nagios (set this to 0 to remove all performance data).
performance data = true
; PORT NUMBER - Port to use for NSCA.
port = 5667
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = false
; Section for NSClient (NSClientServer.dll) (check_nt) protocol options.
[/settings/NSClient/server]
; PERFORMANCE DATA - Send performance data back to nagios (set this to 0 to remove all performance data).
performance data = true
; PORT NUMBER - Port to use for check_nt.
port = 12489
; Section for SMTP passive check module.
[/settings/SMTP/client]
; CHANNEL - The channel to listen to.
channel = SMTP
; Target definition for: default
[/settings/SMTP/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; RECIPIENT - Recipient of email message
recipient = nscp@localhost
; SENDER - Sender of email message
sender = nscp@localhost
; TEMPLATE - Template for message data
template = Hello, this is %source% reporting %message%!
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; Section for simple cache module (SimpleCache.dll).
[/settings/cache]
; CHANNEL - The channel to listen to.
channel = CACHE
; PRIMARY CACHE INDEX - Set this to the value you want to use as unique key for the cache (host, command, result,...).
primary index = ${alias-or-command}
; Section for system checks and system settings
[/settings/check/task schedule]
; SYNTAX - Set this to use a specific syntax string for all commands (that don't specify one)
default buffer length = %title% last run: %most-recent-run-time% (%exit-code%)
; Section for NSCP active/passive check module.
[/settings/check_mk/client]
; CHANNEL - The channel to listen to.
channel = NSCP
; Target definition for: default
[/settings/check_mk/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH
; SSL CERTIFICATE -
certificate =
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true
; VERIFY MODE -
verify mode = none
; Section for check_mk (CheckMKServer.dll) protocol options.
[/settings/check_mk/server]
; PORT NUMBER - Port to use for check_mk.
port = 6556
; Configure crash handling properties.
[/settings/crash]
; ARCHIVE CRASHREPORTS - Archive crash reports in the archive folder
archive = true
; CRASH ARCHIVE LOCATION - The folder to archive crash dumps in
archive folder = ${shared-path}/crash-dumps
; RESTART - Submit crash reports to nsclient.org (or your configured submission server)
restart = true
; RESTART SERVICE NAME - The url to submit crash reports to
restart target = NSClientpp
; SUBMIT CRASHREPORTS - Submit crash reports to nsclient.org (or your configured submission server)
submit = false
; SUBMISSION URL - The url to submit crash reports to
submit url = http://crash.nsclient.org/submit
; Section for the EventLog Checker (CheckEventLog.dll).
[/settings/eventlog]
; BUFFER_SIZE - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
buffer size = 131072
; DEBUG - Log more information when filtering (usefull to detect issues with filters) not usefull in production as it is a bit of a resource hog.
debug = false
; LOOKUP NAMES - Lookup the names of eventlog files
lookup names = true
; SYNTAX - Set this to use a specific syntax string for all commands (that don't specify one).
syntax =
; A set of options to configure the real time checks
[/settings/eventlog/real-time]
; DEBUG - Log missed records (usefull to detect issues with filters) not usefull in production as it is a bit of a resource hog.
debug = false
; REAL TIME CHECKING - Spawns a backgrounnd thread which detects issues and reports them back instantly.
enabled = false
; LOGS TO CHECK - Comma separated list of logs to check
log = application,system
; STARTUP AGE - The initial age to scan when starting NSClient++
startup age = 30m
; A set of filters to use in real-time mode
[/settings/eventlog/real-time/filters]
; Section for external scripts configuration options (CheckExternalScripts).
[/settings/external scripts]
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true
; SCRIPT DIRECTORY - Load all scripts in a directory and use them as commands. Probably dangerous but useful if you have loads of scripts :)
script path =
; COMMAND TIMEOUT - The maximum time in seconds that a command can execute. (if more then this execution will be aborted). NOTICE this only affects external commands not internal ones.
timeout = 12000
; A list of aliases available. An alias is an internal command that has been "wrapped" (to add arguments). Be careful so you don't create loops (ie check_loop=check_a, check_a=check_loop)
[/settings/external scripts/alias]
; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = checkCPU warn=80 crit=90 time=5m time=1m time=30s
; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
alias_cpu_ex = checkCPU warn=$ARG1$ crit=$ARG2$ time=5m time=1m time=30s
; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED
; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
alias_disk_loose = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll FilterType=FIXED ignore-unreadable
; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
alias_event_log = CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational') AND source != 'SideBySide'" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)"
; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
alias_file_age = checkFile2 filter=out "file=$ARG1$" filter-written=>1d MaxWarn=1 MaxCrit=1 "syntax=%filename% %write%"
; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
alias_file_size = CheckFiles "filter=size > $ARG2$" "path=$ARG1$" MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" max-dir-depth=10
; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = checkMem MaxWarn=80% MaxCrit=90% ShowAll=long type=physical type=virtual type=paged type=page
; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
alias_process = checkProcState "$ARG1$=started"
; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
alias_process_count = checkProcState MaxWarnCount=$ARG2$ MaxCritCount=$ARG3$ "$ARG1$=started"
; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
alias_process_hung = checkProcState MaxWarnCount=1 MaxCritCount=1 "$ARG1$=hung"
; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
alias_process_stopped = checkProcState "$ARG1$=stopped"
; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
alias_sched_all = CheckTaskSched "filter=exit_code ne 0" "syntax=%title%: %exit_code%" warn=>0
; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
alias_sched_long = CheckTaskSched "filter=status = 'running' AND most_recent_run_time < -$ARG1$" "syntax=%title% (%most_recent_run_time%)" warn=>0
; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
alias_sched_task = CheckTaskSched "filter=title eq '$ARG1$' AND exit_code ne 0" "syntax=%title% (%most_recent_run_time%)" warn=>0
; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
alias_service = checkServiceState CheckAll
; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
alias_service_ex = checkServiceState CheckAll "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
alias_up = checkUpTime MinWarn=1d MinWarn=1h
; alias_updates - Alias for alias_updates. To configure this item add a section called: /settings/external scripts/alias/alias_updates
alias_updates = check_updates -warning 0 -critical 0
; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
alias_volumes = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED
; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
alias_volumes_loose = CheckDriveSize MinWarn=10% MinCrit=5% CheckAll=volumes FilterType=FIXED ignore-unreadable
; default - Alias for default. To configure this item add a section called: /settings/external scripts/alias/default
default =
; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
shutdown=cmd /c "c:\\windows\\sysnative\\shutdown.exe /r /t 0"
; A list of wrappped scripts (ie. using the template mechanism)
[/settings/external scripts/wrapped scripts]
; ========================================
; Shibboleth IdP check
; Added by Michael Barton 2012 Jan 6
; Replaced by AJW on 2018 Oct 25
; ========================================
check_shibboleth=CheckShibbolethIdpStatus.ps1
check_tws_stdlistsz=check_stdlistsz.vbs
check_win_counters=getCounters.ps1 '$ARG1$' '$ARG2$' '$ARG3$' '$ARG4$' $ARG5$ $ARG6$
check_tsm_backups=check_tsm_backups.ps1 $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$
check_vss_writers=check_vss_writers.ps1
check_puppet=check_Puppet.ps1
; A list of templates for wrapped scripts
[/settings/external scripts/wrappings]
; BATCH FILE WRAPPING -
bat = scripts\\PU\\%SCRIPT% %ARGS%
; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\\PU\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs scripts\\PU\\%SCRIPT% %ARGS%
; Section for graphite passive check module.
[/settings/graphite/client]
; CHANNEL - The channel to listen to.
channel = GRAPHITE
; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname = auto
; Target definition for: default
[/settings/graphite/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; PATH FOR VALUES -
path = system.${hostname}.${check_alias}.${perf_alias}
; Section for configuring the log handling.
[/settings/log]
; DATEMASK - The size of the buffer to use when getting messages this affects the speed and maximum size of messages you can recieve.
date format = %Y-%m-%d %H:%M:%S
; FILENAME - The file to write log data to. Set this to none to disable log to file.
file name = ${exe-path}/nsclient.log
; LOG LEVEL - Log level to use. Avalible levels are error,warning,info,debug,trace
level = info
; Section for log file checker
[/settings/logfile]
; DEBUG - Log more information to help diagnose errors and configuration problems.
debug = false
; SYNTAX - Set the default syntax to use
syntax =
; A set of options to configure the real time checks
[/settings/logfile/real-time]
; REAL TIME CHECKING - Spawns a backgrounnd thread which waits for file changes.
enabled = false
; A set of filters to use in real-time mode
[/settings/logfile/real-time/checks]
; Section for the LUAScripts module.
[/settings/lua]
; A list of scripts available to run from the LuaSCript module.
[/settings/lua/scripts]
; Section for NSCP active/passive check module.
[/settings/nscp/client]
; CHANNEL - The channel to listen to.
channel = NSCP
; Target definition for: default
[/settings/nscp/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH
; SSL CERTIFICATE -
certificate =
; TIMEOUT - Timeout when reading/writing packets to/from sockets.
timeout = 12000
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true
; VERIFY MODE -
verify mode = none
; Section for NSCP (NSCPListener.dll) (check_nscp) protocol options.
[/settings/nscp/server]
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; PORT NUMBER - Port to use for NSCP.
port = 9668
; Section for the Scheduler module.
[/settings/scheduler]
; THREAD COUNT - Number of threads to use.
threads = 5
; Section for the Scheduler module.
[/settings/scheduler/schedules]
; Section for configuring the shared session.
[/settings/shared session]
; LOG LEVEL - Log level to use
enabled = false
; Section for SYSLOG passive check module.
[/settings/syslog/client]
; CHANNEL - The channel to listen to.
channel = syslog
; HOSTNAME - The host name of this host if set to blank (default) the windows name of the computer will be used.
hostname =
; Target definition for: default
[/settings/syslog/client/targets/default]
; TARGET ADDRESS - Target host address
address =
; TODO -
critical severity = critical
; TODO -
facility = kernel
; TODO -
message_syntax = %message%
; TODO -
ok severity = informational
; TODO -
severity = error
; TODO -
tag_syntax = NSCA
; TODO -
unknown severity = emergency
; TODO -
warning severity = warning
; Section for system checks and system settings
[/settings/system/windows]
; DEFAULT LENGTH - Used to define the default intervall for range buffer checks (ie. CPU).
default buffer length = 1h
; Confiure which services has to be in which state
[/settings/system/windows/service mapping]
; A list of avalible remote target systems
[/settings/targets]
; Section for simple file writer module (SimpleFileWriter.dll).
[/settings/writers/file]
; CHANNEL - The channel to listen to.
channel = FILE
; FILE TO WRITE TO - The filename to write output to.
file = output.txt
; PRIMARY CACHE INDEX - Set this to the value you want to use as unique key for the cache (host, command, result,...).
syntax = ${alias-or-command} ${result} ${message}
[/settings/default]
; ALLOWED CIPHERS - A better value is: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH
allowed ciphers = ADH
; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = 127.0.0.1,ims304.Princeton.EDU,ims312.Princeton.EDU,ims314.Princeton.EDU,ims315.Princeton.EDU,ims318.Princeton.EDU,ims319.Princeton.EDU,ims320.Princeton.EDU,ims321.Princeton.EDU,ims204.Princeton.EDU,ims205.Princeton.EDU,ims218.Princeton.EDU,ims219.Princeton.EDU,ims220.Princeton.EDU,ims221.Princeton.EDU,ims222.Princeton.EDU,ims223.Princeton.EDU,ims224.Princeton.EDU,ims225.Princeton.EDU
; BIND TO ADDRESS - Allows you to bind server to a specific local address. This has to be a dotted ip address not a host name. Leaving this blank will bind to all available IP addresses.
bind to =
; CACHE ALLOWED HOSTS - If hostnames should be cached, improves speed and security somewhat but wont allow you to have dynamic IPs for your nagios server.
cache allowed hosts = false
; SSL CERTIFICATE -
certificate =
; INBOX - The default channel to post incoming messages on
inbox = inbox
; PASSWORD - Password used to authenticate againast server
password =
; TIMEOUT - Timeout when reading packets on incoming sockets. If the data has not arrived within this time we will bail out.
timeout = 12000
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true
; VERIFY MODE -
verify mode = none
; Configure log file properties.
[/settings/log/file]
; MAXIMUM FILE SIZE - When file size reaches this it will be truncated to 50% if set to 0 (default) truncation will be disabled
max size = 0

Binary file not shown.

Binary file not shown.

@ -1,50 +0,0 @@
#!/bin/sh
#
# curl -c /tmp/cookie.txt --location -k "https://oampfsqual.princeton.edu:443/psp/pfsqual/EMPLOYEE/ERP/" | grep "Central Authentication Service"
http="http"
port="80"
host=""
uri=""
search=""
while getopts ":SH:u:s:p:" OPTION; do
case "$OPTION" in
S) http="https"; port=443;;
H) host="$OPTARG";;
u) uri="$OPTARG";;
s) search="$OPTARG";;
p) port="$OPTARG";;
esac
done
[ -z "$http" ] && echo "Error - invalid protocol ($http)" && exit 3
[ -z "$host" ] && echo "Error - invalid host ($host)" && exit 3
[ -z "$port" ] && echo "Error - invalid port ($port)" && exit 3
tmpfile="/tmp/cookies.txt.$$"
rm -Rf $tmpfile
URL="$http://$host:$port$uri"
output_format="%{size_download} bytes in %{time_total} second response time |time=%{time_total}s;;;0.000 size=%{size_download}B;;;0"
output=`curl --silent -o $tmpfile.output -w "$output_format" -c $tmpfile --location -k "$URL"`
status=$?
if [ $status -eq 0 ]; then
if [ -n "$search" ]; then
grep -q "$search" $tmpfile.output
status=$?
rm -Rf $tmpfile $tmpfile.*
if [ $status -ne 0 ]; then
echo "HTTP CRITICAL: string '$search' not found on '$URL' - $output"
exit 2
else
echo "HTTP OK: $output"
fi
else
echo "HTTP OK: $output"
fi
else
rm -Rf $tmpfile $tmpfile.*
echo "WARNING: $URL did not respond properly" && exit 1
fi
rm -Rf $tmpfile $tmpfile.*
exit 0

@ -1,44 +0,0 @@
#!/bin/sh
#
# Command to send to multiple email addreses simultaneously, separated by commas.
# However, if any email address has a colon in it, then the second email address overrides the first
#
# Ex:
# user1@example.com,user2@example.com:user3@example.com,user4@example.com
#
# This will send to user1, user3 (overriding user2), and user4.
#
# Command line definition from Nagios:
# /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | \
# $USER1$/pu-notify-all-emails -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" \
# -t $CONTACTEMAIL$:$_HOSTALT_CONTACT$,$CONTACTADDRESS1$
PATH=/usr/bin:/bin
subject=""
sendto=""
# Get params for subject and receiver
while [ -n "$1" ]; do
case "$1" in
-s) subject="$2"; shift 2;;
-t) sendto="$2"; shift 2;;
*) shift 1;;
esac
done
# If we have a blank subject or a blank receiver, then exit
[ -z "$subject" -o -z "$sendto" ] && exit
output=""
output=`cat`
OLD_FS=$IFS
IFS=,
for receiver in $sendto; do
[ -z "$receiver" ] && continue
override=`echo $receiver | cut -d ":" -f 2`
[ -n "$override" ] && receiver=$override
echo "$output" | /bin/mail -s "$subject" $receiver
done
IFS=$OLD_FS

@ -1,31 +0,0 @@
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
all: check_mkevents
check_mkevents: check_mkevents.cc
g++ -O2 -s -o check_mkevents check_mkevents.cc
clean:
rm -f check_mkevents

@ -1,284 +0,0 @@
#!/usr/local/bin/perl
#
# (c)2001 Sebastian Hetze, Linux Information Systems AG
# send bug reports to <S.Hetze@Linux-AG.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# you should have received a copy of the GNU General Public License
# along with this program (or with Nagios); if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA
#
#
# Check apache status information provided by mod_status to find
# out about the load (number of servers working) and the
# performance (average response time for recent requests).
#
# Usage:
# check_apache -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]
#
# check_apache <host> <warn> <crit> <url> (if you cannot avoid it)
#
use LWP::UserAgent;
use URI::URL;
use Getopt::Long;
Getopt::Long::Configure('bundling');
$version=0.01;
my %ERRORS = ('UNKNOWN' , '-1',
'OK' , '0',
'WARNING', '1',
'CRITICAL', '2');
#
# some default values
#
$perf_w=500;
$perf_c=1000;
$load_w=20;
$load_c=30;
$TIMEOUT=15;
#
# get command line options the regular way
#
GetOptions
("V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"l" => \$opt_l, "load" => \$opt_l,
"v" => \$verbose, "verbose" => \$verbose,
"w=s" => \$opt_w, "warning=s" => \$opt_w,
"c=s" => \$opt_c, "critical=s" => \$opt_c,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"u=s" => \$opt_u, "url=s" => \$opt_u);
#
# handle the verbose stuff first
#
if ($opt_V) {
print "\n";
print "check_apache nagios plugin version $version\n";
print "\n";
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
print "copies of the plugins under the terms of the GNU General Public License.\n";
print "For more information about these matters, see the file named COPYING.\n";
print "\n";
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
print "\n";
print "\n";
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'UNKNOWN'};
}
#
# now get options the weired way and set the defaults
# if nothing else is provided
#
$opt_H = shift unless ($opt_H);
print_usage() unless ($opt_H);
if($opt_l) {
$autostring="?auto";
($opt_w) || ($opt_w = shift) || ($opt_w = $load_w);
$warn = $1 if ($opt_w =~ /([0-9]+)/);
($opt_c) || ($opt_c = shift) || ($opt_c = $load_c);
$alert = $1 if ($opt_c =~ /([0-9]+)/);
} else {
$autostring="";
($opt_w) || ($opt_w = shift) || ($opt_w = $perf_w);
$warn = $1 if ($opt_w =~ /([0-9]+)/);
($opt_c) || ($opt_c = shift) || ($opt_c = $perf_c);
$alert = $1 if ($opt_c =~ /([0-9]+)/);
}
($opt_u) || ($opt_u = shift) || ($opt_u = "/server-status");
#
# dont let us wait forever...
#
$SIG{'ALRM'} = sub {
print ("ERROR: No response from HTTP server (alarm)\n");
exit $ERRORS{"UNKNOWN"};
};
alarm($TIMEOUT);
#
# now we set things up for the real work
# and fire up the request
#
$ua = new LWP::UserAgent;
$ua->agent("Nagios/0.1 " . $ua->agent);
$urlstring = "http://" . $opt_H . $opt_u . $autostring;
$url = url($urlstring);
my $req = new HTTP::Request 'GET', $url;
my $res = $ua->request($req);
#
# hopefully we´ve got something usefull
#
if ($res->is_success) {
if($opt_l) {
foreach $_ (split /^/m, $res->content) {
next if /^\s*$/;
#
# this is the load checking section
# we parse the whole content, just in case someone
# wants to use this some day in the future
#
if (/^Total Accesses:\s+([0-9.]+)/) { $accesses = $1; next; }
if (/^Total kBytes:\s+([0-9.]+)/) { $kbytes = $1; next; }
if (/^CPULoad:\s+([0-9.]+)\s+/) { $load = $1; next; }
if (/^Uptime:\s+([0-9.]+)\s+/) { $uptime = $1; next; }
if (/^ReqPerSec:\s+([0-9.]+)\s+/) { $rps = $1; next; }
if (/^BytesPerSec:\s+([0-9.]+)\s+/) { $bps = $1; next; }
if (/^BytesPerReq:\s+([0-9.]+)\s+/) { $bpr = $1; next; }
if (/^BusyServers:\s+([0-9.]+)\s+/) { $busy = $1; next; }
if (/^IdleServers:\s+([0-9.]+)\s+/) { $idle = $1; next; }
if (/^Scoreboard:\s+([SRWKDLG_.]+)\s+/) { $score = $1; next; }
print "Unknown Status\n";
exit $ERRORS{"UNKNOWN"};
}
#
# now we even parse the whole scoreboard, just for fun
#
foreach $scorepoint (split //m, $score) {
if($scorepoint eq '.') { $scores{'.'}+=1; next; } # Unused
if($scorepoint eq '_') { $scores{'_'}+=1; next; } # Waiting
if($scorepoint eq 'S') { $scores{'S'}+=1; next; } # Starting
if($scorepoint eq 'R') { $scores{'R'}+=1; next; } # Reading
if($scorepoint eq 'W') { $scores{'W'}+=1; next; } # Writing
if($scorepoint eq 'K') { $scores{'K'}+=1; next; } # Keepalive
if($scorepoint eq 'D') { $scores{'D'}+=1; next; } # DNS Lookup
if($scorepoint eq 'L') { $scores{'L'}+=1; next; } # Logging
if($scorepoint eq 'G') { $scores{'G'}+=1; next; } # Going
}
if($busy>$alert) {
printf "HTTPD CRITICAL: %.0f servers running\n", $busy;
exit $ERRORS{"CRITICAL"};
}
if($busy>$warn) {
printf "HTTPD WARNING: %.0f servers running\n", $busy;
exit $ERRORS{"WARNING"};
}
printf "HTTPD ok: %.0f servers running, %d idle\n", $busy, $idle;
exit $ERRORS{"OK"};
} else {
#
# this is the performance check section
# We are a bit lazy here, no parsing of the initial data
# block and the scoreboard.
# However, you have the whole set of per server
# information to play with ;-)
# The actual performance is measured by adding up the
# milliseconds required to process the most recent
# requests of all instances and then taking the average.
#
foreach $tablerow (split /<tr>/m, $res->content) {
$tablerow =~ s/<\/td>//g;
($empty,$Srv,$PID,$Acc,$M,$CPU,$SS,$Req,$Conn,$Child,$Slot,$Client,$VHost,$Request)
= split /<td>/, $tablerow;
if(defined $Req) {
$lines+=1;
$req_sum+=$Req;
}
undef $Req;
}
$average=$req_sum/$lines;
if($average>$alert) {
printf "HTTPD CRITICAL: average response time %.0f
milliseconds\n", $average;
exit $ERRORS{"CRITICAL"};
}
if($average>$warn) {
printf "HTTPD WARNING: average response time %.0f
milliseconds\n", $average;
exit $ERRORS{"WARNING"};
}
if($average>0 or ($average == 0 and $lines > 0)) {
printf "HTTPD ok: average response time %.0f milliseconds\n",
$average;
exit $ERRORS{"OK"};
}
print "Unknown Status\n";
exit $ERRORS{"UNKNOWN"};
}
} else {
print "HTTP request failed\n";
exit $ERRORS{"CRITICAL"};
}
#
# ok, now we are almost through
# These last subroutines do the things for those that do not
# read source code.
#
sub print_usage () {
print "Usage: $0 -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]\n"; }
sub print_help () {
print "\n";
print "\n";
print "check_apache nagios plugin version $version\n";
print "\n";
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
print "copies of the plugins under the terms of the GNU General Public License.\n";
print "For more information about these matters, see the file named COPYING.\n";
print "\n";
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
print "\n";
print "\n";
print "This plugin checks the apache HTTP service on the specified host.\n";
print "It uses the mod_status facilities provided by the apache server.\n";
print "The monitoring server must be authorized in httpd.conf.\n";
print "\n";
print "\n";
print_usage();
print "\n";
print "Options:\n";
print " -H, --hostname=ADDRESS\n";
print " host name argument for server.\n";
print " -l, --load\n";
print " check load instead of performance.\n";
print " -h, --help\n";
print " print detailed help screen.\n";
print " -V, --version\n";
print " print version information.\n";
print " -w, --warning=INTEGER\n";
print " load / performance level at which a warning message will be gererated.\n";
print " -c, --critical=INTEGER\n";
print " load / performance level at which a critical message will be gererated.\n";
print " -u, --url=PATH\n";
print " location to call mod_status.\n";
print "\n";
print " Defaults for performance checking are $perf_w/$perf_c msec.\n";
print " Defaults for load checking are $load_w/$load_c servers running.\n";
print "\n";
print "\n";
}
#
# the end
#

Binary file not shown.

@ -1,192 +0,0 @@
#!/usr/bin/perl
#
# License: GPL v.3+
# Copyright (c) 2009 op5 AB
# Author: Henrik Nilsson <henrik30000@gmail.com>
#
# For direct contact with any of the op5 developers send a mail to
# op5-users@lists.op5.com
# Discussions are directed to the mailing list op5-users@op5.com,
# see http://lists.op5.com/mailman/listinfo/op5-users
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 or,
# at your option, any later version, as published by the Free Software
# Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
use lib qw(/usr/local/monitoring/perl/lib/perl5);
use DBI;
use Nagios::Plugin;
my $return_code=0;
my $return_msg;
my $p=Nagios::Plugin->new(usage=>"Usage %s: -U user -P password (-H server|-S servername)\n");
$p->add_arg(spec=>'username|U=s', help=>'User name', required=>1);
$p->add_arg(spec=>'password|P=s', help=>'Password', required=>1);
$p->add_arg(spec=>'host|H=s', help=>'BizTalk server to check (hostname/IP)', required=>0);
$p->add_arg(spec=>'server|S=s', help=>'BizTalk server to check (by sybase configuration)', required=>0);
$p->add_arg(spec=>'port|p=i', help=>'Port for the MSSQL server that BizTalk uses', required=>0);
$p->add_arg(spec=>'warning|w=s', help=>'Warning-range for receive/send ports', required=>0);
$p->add_arg(spec=>'critical|c=s', help=>'Critical-range for receive/send ports', required=>0);
$p->add_arg(spec=>'queuewarning|W=s', help=>'Warning-range for queues', required=>0);
$p->add_arg(spec=>'queuecritical|C=s', help=>'Critical-range for queues', required=>0);
$p->add_arg(spec=>'orchestrationwarning|o=s', help=>'Warning-range for orchestrations', required=>0);
$p->add_arg(spec=>'orchestrationcritical|O=s', help=>'Critical-range for orchestrations', required=>0);
$p->add_arg(spec=>'sendportwarning|d=s', help=>'Warning-range for sendports', required=>0);
$p->add_arg(spec=>'sendportcritical|D=s', help=>'Critical-range for sendports', required=>0);
$p->add_arg(spec=>'receivelocations|l=s', help=>'Specific receivelocation(s) to check, comma-separated', required=>0);
$p->getopts;
if(!defined($p->opts->host)&&!defined($p->opts->server)){$p->nagios_die("You must provide either host or server name");}
# Set up timeout
if(defined($p->opts->timeout))
{
$SIG{'ALRM'} = sub{$p->nagios_die("UNKNOWN", "Plugin timed out.");};
alarm($p->opts->timeout);
}
if (defined($p->opts->port)) {
$ENV{TDSPORT} = $p->opts->port;
}
# Connect to the database
my $db;
if(defined($p->opts->host))
{
$db=DBI->connect("dbi:Sybase:server=".$p->opts->host.";port=".(defined($p->opts->port)?$p->opts->port:1433), $p->opts->username, $p->opts->password) or $p->nagios_die("Could not connect to the BizTalk database", CRITICAL);
}else{
$db=DBI->connect("dbi:Sybase:".$p->opts->server, $p->opts->username, $p->opts->password) or $p->nagios_die("Could not connect to the BizTalk database", CRITICAL);
}
$db->prepare("use BizTalkMgmtDb")->execute();
# Check receive locations
my $q=$db->prepare("select Name, Disabled from adm_ReceiveLocation;");
$q->execute();
my $name, $disabled;
my $count=0;
my $msg="";
$q->bind_columns(\$name, \$disabled);
if(defined($p->opts->receivelocations))
{
$msg='';
my @list=split(",", $p->opts->receivelocations);
while($q->fetch)
{
if($disabled and grep {$_ eq $name} @list)
{
$msg.=$name.", ";
$count++;
}
}
$return_code=$p->check_threshold(check=>$count, warning=>$p->opts->warning, critical=>$p->opts->critical);
$p->nagios_exit($return_code, $count." of ".@list." receive location".(@list!=1?'s':'')." disabled: ".$msg);
}else{
while($q->fetch)
{
if($disabled)
{
$msg.=$name.", ";
$count++;
}
}
}
$code=$p->check_threshold(check=>$count, warning=>$p->opts->warning, critical=>$p->opts->critical);
if($code>$return_code)
{
$return_code=$code;
$return_msg=$count." receive location".($count!=1?"s":"")." disabled: ".$msg;
}elsif($return_code==0){
$return_msg.=$count." receive location".($count!=1?"s":"")." disabled. ";
}
# Check message queue
# Getting the messagequeue, in which we check if nState is 4 or 32 (both mean suspended, 4 for resumable, 32 for non-resumable)
$db->prepare("use BizTalkMsgBoxDb")->execute();
$q=$db->prepare("select nState, nvcErrorDescription from InstancesSuspended where nState=4 or nState=32;");
$q->execute();
my $state, $error;
$count=0;
$msg="";
$q->bind_columns(\$state, \$error);
while($q->fetch)
{
if($state==32)
{
$msg.="Non-resumable: ".$error;
}else{
$msg.="Resumable: ".$error;
}
$count++;
}
$code=$p->check_threshold(check=>$count, warning=>$p->opts->warning, critical=>$p->opts->critical);
if($code>$return_code)
{
$return_code=$code;
$return_msg=$count." suspended messages: ".$msg;
}elsif($return_code==0){
$return_msg.=$count." suspended messages. ";
}
# Check the total length of the queue
$q=$db->prepare("select count(nState) from InstancesSuspended;");
$q->execute();
my @line=$q->fetchrow_array;
$code=$p->check_threshold(check=>$line[0], warning=>$p->opts->queuewarning, critical=>$p->opts->queuecritical);
if($code>$return_code)
{
$return_code=$code;
$return_msg=$line[0]." messages in queue.";
}elsif($return_code==0){
$return_msg.=$line[0]." messages in queue. ";
}
# Check SendPorts
$q=$db->prepare("SELECT nvcName AS SendPortName, nPortStatus as PortStatus FROM [BizTalkMgmtDb].[dbo].[bts_sendport] WHERE nPortStatus != 3");
$q->execute();
$q->bind_columns(\$SendPortName, \$PortStatus);
$count=0;
my $portline;
while($q->fetch) {
$portline .= $SendPortName . ": " . $PortStatus . " ";
$count++;
}
$return_msg .= $count . " lines matching SendPortStatus <> 3. ";
$code=$p->check_threshold(check=>$count,warning=>$p->opts->sendportwarning,critical=>$p->opts->sendportcritical);
if ( $code > 0 ) {
$return_code = $code;
$return_msg =" SendPort: " . $portline
}
# Check Orchesrations
$q=$db->prepare("SELECT nvcFullName AS OrchestrationName,nOrchestrationStatus as PortStatus FROM [BizTalkMgmtDb].[dbo].[bts_orchestration] WHERE (nOrchestrationStatus != 3)");
$q->execute();
$q->bind_columns(\$OrchestrationName, \$PortStatus);
$count=0;
my $orchline;
while($q->fetch) {
$orchline .= $OrchestrationName . ": " . $PortStatus . " ";
$count++;
}
$return_msg .= $count . " lines matching OrchestrationStatus <> 3. ";
$code=$p->check_threshold(check=>$count,warning=>$p->opts->orchestrationwarning,critical=>$p->opts->orchestrationcritical);
if ( $code > 0 ) {
$return_code = $code;
$return_msg =" Orchestration: " . $orchline
}
$p->nagios_exit($return_code, $return_msg);

@ -1,38 +0,0 @@
#!/bin/bash
### ### som kollar att MSDTC process som visar vilken server som är aktiv, körs på exakt en av de servrar som anges i argumentet.
SERVICE='BTSSvc$GcCxHost'
if [ $# -ne 1 -o "$1" == "-h" ]; then
echo "Usage: $1 -h | ip.address,ip.address,ip.address, ..."
exit
fi
IFS=,
RUNNING=0
for i in $1; do
status=`/opt/plugins/check_nt -H $i -p 1248 -v SERVICESTATE -l $SERVICE`
ret=$?
if [ $ret == 0 ]; then
RUNNING=$(($RUNNING + 1))
TEXT="$TEXT$i is running $SERVICE "
fi
done
if [ $RUNNING == 0 ]; then
echo "INSTANCES CRITICAL: None running $SERVICE"
exit 2
elif [ $RUNNING -gt 1 ]; then
echo "INSTANCES CRITICAL: More than one ($RUNNING) hosts running
$SERVICE! ($TEXT)"
exit 2
else
echo "INSTANCES OK: $TEXT"
exit 0
fi

@ -1,39 +0,0 @@
#!/bin/bash
### som kollar att MSDTC process som visar vilken server som är aktiv, körs på exakt en av de servrar som anges i argumentet.
SERVICE='MSDTC$a6c864e0-37c8-4aa9-b63e-8fb1b8c89f79'
if [ $# -ne 1 -o "$1" == "-h" ]; then
echo "Usage: $1 -h | ip.address,ip.address,ip.address, ..."
exit
fi
IFS=,
RUNNING=0
for i in $1; do
status=`/opt/plugins/check_nt -H $i -p 1248 -v SERVICESTATE -l $SERVICE`
ret=$?
if [ $ret == 0 ]; then
RUNNING=$(($RUNNING + 1))
TEXT="$TEXT$i is running $SERVICE "
fi
done
if [ $RUNNING == 0 ]; then
echo "INSTANCES CRITICAL: None running $SERVICE"
exit 2
elif [ $RUNNING -gt 1 ]; then
echo "INSTANCES CRITICAL: More than one ($RUNNING) hosts running
$SERVICE! ($TEXT)"
exit 2
else
echo "INSTANCES OK: $TEXT"
exit 0
fi

@ -1,89 +0,0 @@
#!/usr/local/bin/perl -w
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '/usr/local/monitoring/libexec';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME = "check_breeze";
sub print_help ();
sub print_usage ();
$ENV{'PATH'}='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
Getopt::Long::Configure('bundling');
GetOptions
("V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"w=s" => \$opt_w, "warning=s" => \$opt_w,
"c=s" => \$opt_c, "critical=s" => \$opt_c,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"C=s" => \$opt_C, "community=s" => \$opt_C);
if ($opt_V) {
print_revision($PROGNAME,'2.1.1');
exit $ERRORS{'OK'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
($opt_H) || usage("Host name/address not specified\n");
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($host) || usage("Invalid host: $opt_H\n");
($opt_w) || usage("Warning threshold not specified\n");
my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
($warning) || usage("Invalid warning threshold: $opt_w\n");
($opt_c) || usage("Critical threshold not specified\n");
my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
($critical) || usage("Invalid critical threshold: $opt_c\n");
($opt_C) || ($opt_C = "public") ;
my $sig=0;
$sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`;
my @test=split(/ /,$sig);
$sig=$test[2];
$sig=int($sig);
if ($sig>100){$sig=100}
print "Signal Strength at: $sig%\n";
exit $ERRORS{'CRITICAL'} if ($sig<$critical);
exit $ERRORS{'WARNING'} if ($sig<$warning);
exit $ERRORS{'OK'};
sub print_usage () {
print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n";
}
sub print_help () {
print_revision($PROGNAME,'2.1.1');
print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop
This plugin reports the signal strength of a Breezecom wireless equipment
";
print_usage();
print "
-H, --hostname=HOST
Name or IP address of host to check
-C, --community=community
SNMPv1 community (default public)
-w, --warning=INTEGER
Percentage strength below which a WARNING status will result
-c, --critical=INTEGER
Percentage strength below which a CRITICAL status will result
";
support();
}

Binary file not shown.

@ -1,16 +0,0 @@
#!/bin/bash
eval "$(<~/.ssh/.ssh-agent)" >/dev/null
#for arg in $@; do echo "#${arg}#"; done
# This crazy shit is done because of issues with passing quotes in
precmd=`echo $* | sed 's/\-C.*//'`
cmd=`echo "$*" | sed 's/.*\-C[[:space:]]\+//'`
#echo "#${precmd}#${cmd}#"
exec /usr/local/monitoring/nagios/libexec/check_by_ssh $precmd -C "$cmd" 2>&1
exit $?

@ -1,28 +0,0 @@
#!/bin/bash
if [[ "$#" -lt "4" ]]; then
echo "Usage: $0 <path_to_keyfile> <remoteuser> <remotehost> <remotecommand> [regex_to_match_expected]"
exit 3
fi
key=$1
usr=$2
host=$3
command=$4
expect=$5
command=`echo "$command" | sed 's/%%%%pipe%%%%/|/'`
##echo "###$command###"
ret=`/usr/bin/ssh -i $key ${usr}@${host} "$command" 2>&1`
stat=$?
if [[ "$stat" -eq "0" && ("$ret" =~ $expect || -z "$expect") ]]
then
echo "OK: $ret"
else
echo "CRITICAL: $ret"
stat=2
fi
exit $stat

Binary file not shown.

Binary file not shown.

@ -1,45 +0,0 @@
#!/bin/sh
name=`basename $0`
usage () {
echo "Usage: $name {-h|-s} [-l label] [-w warn_thres] [-c crit_thres] -d <host_or_service_ret_codes_comma_sep>"
exit 3
}
#echo "$*" >> /tmp/trace.clus
while getopts "d:hsl:w:c:" option
do
case $option in
d) spec="$OPTARG" ;;
s) type="-s" ;;
h) type="-h" ;;
l) label="$OPTARG" ;;
w) warn="-w $OPTARG" ;;
c) crit="-c $OPTARG" ;;
*) usage ;;
\?) usage ;;
esac
done
if [ -z "$type" -o -z "$spec" ]; then usage; fi
OLD_IFS="$IFS"
IFS=,
for stat in $spec
do
if [ "$stat" -eq "$stat" ] 2>/dev/null; then continue; else
echo "The host or service specified \"$stat\" does not exist"
exit 3
fi
done
IFS="$OLD_IFS"
lbl=`echo $label | sed 's/ /_/g'`
label="$lbl"
#echo "/usr/local/monitoring/nagios/libexec/check_cluster $type $label -d $spec $warn $crit" >> /tmp/trace.clus
/usr/local/monitoring/nagios/libexec/check_cluster $type -l $label -d $spec $warn $crit
exit $?

@ -1,263 +0,0 @@
#!/usr/bin/perl -w
#
# $Id: check_cpu,v 1.7 2004/06/22 16:51:05 hmann Exp $
#
# check_cpu checks CPU and returns sar stats
#
# Copyright (c) 2000-2004 Harper Mann. All rights reserved
# (harper.mann@comcast.net)
#
# No warrenty of any kind is granted io implied.
#
# Change Log
#----------------
# 15-Feb-2004 - Harper Mann
# Initial revision
# 19-Mar-2004 Harper Mann
# Fixed to use /proc instead of sar
# 23-Mar-2004 Harper Mann
# Back to sar so numbers match. Beta release
# 4-Jun-2004 - Harper Mann
# Changed idle value to be a < test
# 21-Jun-2004 - Harper Mann
# Added switch for CPU
#
use strict;
my @sar_vals = undef;
my @lines = undef;
my @res = undef;
my $PROCSTAT = "/proc/stat";
my $cpu;
my $userwarn = 101;
my $usercrit = 101;
my $nicewarn = 101;
my $nicecrit = 101;
my $syswarn = 101;
my $syscrit = 101;
my $iowaitwarn = 101;
my $iowaitcrit = 101;
my $idlewarn = 0;
my $idlecrit = 0;
my $debug = 0;
my $perf = 0;
# my $SAR = "/usr/local/groundwork/bin/sar";
my $SAR = "/usr/bin/sar";
use Getopt::Long;
use vars qw($opt_V $opt_c $opt_s $opt_n $opt_u $opt_i $opt_W $opt_D $opt_p $opt_h);
use vars qw($PROGNAME);
use lib "/usr/local/nagios/libexec" ;
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
sub print_help ();
sub print_usage ();
$PROGNAME = "check_cpu";
Getopt::Long::Configure('bundling');
my $status = GetOptions
( "V" => \$opt_V, "Version" => \$opt_V,
"c=s" => \$opt_c, "cpu=s" => \$opt_c,
"u=s" => \$opt_u, "user=s" => \$opt_u,
"n=s" => \$opt_n, "nice=s" => \$opt_n,
"s=s" => \$opt_s, "system=s" => \$opt_s,
"W=s" => \$opt_W, "iowait=s" => \$opt_W,
"i=s" => \$opt_i, "idle=s" => \$opt_i,
"D" => \$opt_D, "debug" => \$opt_D,
"p" => \$opt_p, "performance" => \$opt_p,
"h" => \$opt_h, "help" => \$opt_h );
if ($status == 0) { print_usage() ; exit $ERRORS{'UNKNOWN'}; }
# Debug switch
if ($opt_D) { $debug = 1 }
# Cpu switch
if ($opt_c) { $cpu = $opt_c } else { $cpu = 0 }
print "CPU: $cpu\n" if $debug;
# Performance switch
if ($opt_p) { $perf = 1; }
# Version
if ($opt_V) {
print_revision($PROGNAME,'$Revision: 1.7 $');
exit $ERRORS{'OK'};
}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'}}
# Options checking
# Percent CPU system utilization
if ($opt_s) {
($syswarn, $syscrit) = split /:/, $opt_s;
($syswarn && $syscrit) || usage ("missing value -s <warn:crit>\n");
($syswarn =~ /^\d{1,3}$/ && $syswarn > 0 && $syswarn <= 100) &&
($syscrit =~ /^\d{1,3}$/ && $syscrit > 0 && $syscrit <= 100) ||
usage("Invalid value: -s <warn:crit> (system percent): $opt_s\n");
($syscrit > $syswarn) ||
usage("system critical (-s $opt_s <warn:crit>) must be > warning\n");
}
# Percent CPU nice utilization
if ($opt_n) {
($nicewarn, $nicecrit) = split /:/, $opt_n;
($nicewarn && $nicecrit) || usage ("missing value -n <warn:crit>\n");
($nicewarn =~ /^\d{1,3}$/ && $nicewarn > 0 && $nicewarn <= 100) &&
($nicecrit =~ /^\d{1,3}$/ && $nicecrit > 0 && $nicecrit <= 100) ||
usage("Invalid value: -n <warn:crit> (nice percent): $opt_n\n");
($nicecrit > $nicewarn) ||
usage("nice critical (-n $opt_n <warn:crit>) must be > warning\n");
}
# Percent CPU user utilzation
if ($opt_u) {
($userwarn, $usercrit) = split /:/, $opt_u;
($userwarn && $usercrit) || usage ("missing value -u <warn:crit>\n");
($userwarn =~ /^\d{1,3}$/ && $userwarn > 0 && $userwarn <= 100) &&
($usercrit =~ /^\d{1,3}$/ && $usercrit > 0 && $usercrit <= 100) ||
usage("Invalid value: -u <warn:crit> (user percent): $opt_u\n");
($usercrit > $userwarn) ||
usage("user critical (-u $opt_u <warn:crit>) must be < warning\n");
}
# Percent CPU idle utilzation
if ($opt_i) {
($idlewarn, $idlecrit) = split /:/, $opt_i;
($idlewarn && $idlecrit) || usage ("missing value -i <warn:crit>\n");
($idlewarn =~ /^\d{1,3}$/ && $idlewarn > 0 && $idlewarn <= 100) &&
($idlecrit =~ /^\d{1,3}$/ && $idlecrit > 0 && $idlecrit <= 100) ||
usage("Invalid value: -i <warn:crit> (idle percent): $opt_i\n");
($idlecrit < $idlewarn) ||
usage("idle critical (-i $opt_i <warn:crit>) must be > warning\n");
}
# Percent CPU iowait utilzation
if ($opt_W) {
($iowaitwarn, $iowaitcrit) = split /:/, $opt_W;
($iowaitwarn && $iowaitcrit) || usage ("missing value -W <warn:crit>\n");
($iowaitwarn =~ /^\d{1,3}$/ && $iowaitwarn > 0 && $iowaitwarn <= 100) &&
($iowaitcrit =~ /^\d{1,3}$/ && $iowaitcrit > 0 && $iowaitcrit <= 100) ||
usage("Invalid value: -W <warn:crit> (iowait percent): $opt_W\n");
($iowaitcrit > $iowaitwarn) ||
usage("iowait critical (-i $opt_W <warn:crit>) must be > warning\n");
}
# Read /proc/stat values. The first "cpu " line has aggregate values if
# the system is SMP
#
my ($lbl, $user, $nice, $sys, $iowait, $idle, $idle2, $use_idle2) = undef;
if ($cpu eq "ALL" ) {
(@res = qx/$SAR 1 1/) || die "No output from sar: $!";
} else {
(@res = qx/$SAR 1 1 -U $cpu/) || die "No output from sar: $!";
}
foreach (@res) {
chomp;
if (/steal/) { $use_idle2 = 1; }
($lbl,$cpu,$user,$nice,$sys,$iowait,$idle,$idle2) = split(/\s+/);
if (/average/) { last }
}
$idle = $idle2 if $use_idle2;
# Do the value checks
my $out = undef;
$out=$out."(cpu: $cpu) ";
$out=$out."user: $user";
($user > $usercrit) ? ($out=$out."(Critical) ") :
($user > $userwarn) ? ($out=$out."(Warning) ") : ($out=$out."(OK) ");
$out=$out."nice: $nice";
($nice > $nicecrit) ? ($out=$out."(Critical) ") :
($nice > $nicewarn) ? ($out=$out."(Warning) ") : ($out=$out."(OK) ");
$out=$out."iowait: $iowait";
($iowait > $iowaitcrit) ? ($out=$out."(Critical) ") :
($iowait > $iowaitwarn) ? ($out=$out."(Warning) ") : ($out=$out."(OK) ");
$out=$out."sys: $sys";
($sys > $syscrit) ? ($out=$out."(Critical) ") :
($sys > $syswarn) ? ($out=$out."(Warning) ") : ($out=$out."(OK) ");
$out=$out."idle: $idle";
($idle < $idlecrit) ? ($out=$out."(Critical) ") :
($idle < $idlewarn) ? ($out=$out."(Warning) ") : ($out=$out."(OK) ");
print "$out";
print " |cpu: $cpu user: $user nice: $nice sys: $sys idle: $idle" if $perf;
print "\n";
# Plugin output
# $worst == $ERRORS{'OK'} ? print "CPU OK @goodlist" : print "@badlist";
# Performance?
if ($out =~ /Critical/) { exit (2) }
if ($out =~ /Warning/) { exit (1) }
exit (0); #OK
# Usage sub
sub print_usage () {
print "Usage: $PROGNAME
[-c, --cpu <cpu number>
[-u, --user <warn:crit> percent
[-n, --nice <warn:crit> percent
[-s, --system <warn:crit> percent
[-i, --idle <warn:crit> percent (NOTE: idle less than x)
[-p] (output Nagios performance data)
[-D] (debug) [-h] (help) [-V] (Version)\n";
}
# Help sub
sub print_help () {
print_revision($PROGNAME,'$Revision: 1.7 $');
# Perl device CPU check plugin for Nagios
print_usage();
print "
-c, --cpu
CPU Number (default is 0, ALL for all)
-u, --user
Percent CPU user
-n, --nice
Percent CPU nice
-s, --system=STRING
Percent CPU system
-i, --idle
If less than Percent CPU idle
-p, --performance
Report Nagios performance data after the ouput string
-h, --help
Print help
-V, --Version
Print version of plugin
";
}

@ -1,580 +0,0 @@
#!/usr/bin/perl -w
#
# ============================== SUMMARY =====================================
#
# Program : check_dell_openmanage.pl
# Version : 1.3
# Date : March 31 2010
# Author : Jason Ellison - infotek@gmail.com
# Summary : This is a nagios plugin that checks the status of objects
# monitored by Dell OpenManage on Dell PowerEdge servers via SNMP
#
# Licence : GPL - summary below, full text at http://www.fsf.org/licenses/gpl.txt
#
# =========================== PROGRAM LICENSE =================================
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# ===================== INFORMATION ABOUT THIS PLUGIN =========================
#
# This plugin checks the status of objects monitored by OpenManage via SNMP
# and returns OK, WARNING, CRITICAL or UNKNOWN. If a failure occurs it will
# describe the subsystem that failed and the failure code.
#
# This program is written and maintained by:
# Jason Ellison - infotek(at)gmail.com
#
# It is based on check_snmp_temperature.pl plugin by:
# William Leibzon - william(at)leibzon.org
#
# Using information from
# Dell OpenManage Server Administrator Version 5.4 SNMP Reference Guide
# http://support.dell.com/support/edocs/software/svradmin/
#
# System Types
#
# "dellom" monitors the following OID's:
# systemStateChassisStatus .1.3.6.1.4.1.674.10892.1.200.10.1.4.1
# systemStatePowerSupplyStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.9.1
# systemStateVoltageStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.12.1
# systemStateCoolingDeviceStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.21.1
# systemStateTemperatureStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.24.1
# systemStateMemoryDeviceStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.27.1
# systemStateChassisIntrusionStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.30.1
# systemStateEventLogStatus .1.3.6.1.4.1.674.10892.1.200.10.1.41.1
#
# "dellom_storage" test all of the OID's "dellom" tests plus the storage OID
# systemStateChassisStatus .1.3.6.1.4.1.674.10892.1.200.10.1.4.1
# systemStatePowerSupplyStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.9.1
# systemStateVoltageStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.12.1
# systemStateCoolingDeviceStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.21.1
# systemStateTemperatureStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.24.1
# systemStateMemoryDeviceStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.27.1
# systemStateChassisIntrusionStatusCombined .1.3.6.1.4.1.674.10892.1.200.10.1.30.1
# systemStateEventLogStatus .1.3.6.1.4.1.674.10892.1.200.10.1.41.1
# StorageManagement-MIB::agentGlobalSystemStatus .1.3.6.1.4.1.674.10893.1.20.110.13.0
#
# "global" monitors
# GlobalSystemStatus .1.3.6.1.4.1.674.10892.1.200.10.1.2.1
#
# "chassis" monitors
# ChassisStatus .1.3.6.1.4.1.674.10892.1.200.10.1.4.1
#
# "custom" is meant to be customised by advanced users
#
# ============================= SETUP NOTES ====================================
#
# Copy this file to your Nagios installation folder in "libexec/". Rename
# to "check_dell_openmanage.pl".
#
# You must have Dell OpenManage installed on the server that you want to
# monitor. You must have enabled SNMP on the server and allow SNMP queries.
# On the server that will be running the plugin you must have the perl
# "Net::SNMP" module installed.
#
# perl -MCPAN -e shell
# cpan> install Net::SNMP
#
# For SNMPv3 support make sure you have the following modules installed:
# Crypt::DES, Digest::MD5, Digest::SHA1, and Digest::HMAC
#
# Check Dell OpenManage on the local host for alert thresholds like min/max
# fan speeds and temperatures...
#
# To test using SNMPv1 use the following syntax:
#
# ./check_dell_openmanage.pl -v -H <host> -C <snmp_community> -T <type>
#
# Where <type> is "test", "dellom", "dellom_storage", "blade", "global", "chassis" or "custom"
#
# ========================= SETUP EXAMPLES ==================================
#
# define command{
# command_name check_dell_open_manage
# command_line $USER1$/check_dell_openmanage.pl -H $HOSTADDRESS$ -C $ARG1$ -T $ARG2$
# }
#
# define service{
# use generic-service
# host_name DELL-SERVER-00
# service_description Dell OpenManage Status
# check_command check_dell_open_manage!public!dellom
# normal_check_interval 3
# retry_check_interval 1
# }
#
# define service{
# use generic-service
# host_name DELL-SERVER-01
# service_description Dell OpenManage Status plus Storage
# check_command check_dell_open_manage!public!dellom_storage
# normal_check_interval 3
# retry_check_interval 1
# }
#
# =================================== TODO ===================================
#
# Fix bugs and make more user friendly.
#
# ================================ REVISION ==================================
#
#
# ver 1.3
#
# If non-numeric codes are returned just add the text to the statusinfo
# This was done to allow adding machine information Dell Model Number and Service Tag to output.
#
# ver 1.2
#
# Major rewrite. Simplified the way new systems are defined. Added system
# type "test" which can be used to easly generate new system definitions.
#
# ver 1.1
# formating of text output
# add blade system type... blades apparently do not support
# systemStatePowerSupplyStatusCombined, systemStateCoolingDeviceStatusCombined
# or systemStateChassisIntrusionStatusCombined
#
# ver 1.0
#
# while in verbose mode report which OID failed in a more readable manner.
# add "global", "chassis", and "custom" type.
#
# ver 0.9
# change added type dellom_storage as this is more accurate. This plugin works
# with all PowerEdge servers it has been tested with. left pe2950 in for compat
# remove min max int options from help text as they are no longer relevant
#
# ver 0.8
#
# removed ucdavis definition. Added note about SNMPv3 dependencies
# check that perl environment has "Net::SNMP" if not found complain.
# missing "Net::SNMP" is the most common issue users report.
#
# ver 0.7
#
# removed ucdavis definition. Added note about SNMPv3 dependencies
#
# ver 0.6
#
# + Added StorageManagement GlobalSystemStatus
# StorageManagement-MIB::agentGlobalSystemStatus
# .1.3.6.1.4.1.674.10893.1.20.110.13.0
#
# ver 0.5
#
# + Cleaned up verbose output for debugging
#
# ver 0.4
#
# + Fixed major flaw in logic that cause errors to not be reported.
#
# + Added to the system_types error warning and unkown variables like seen on
# http://www.mail-archive.com/intermapper-talk@list.dartware.com/msg02687.html
# below section: "This section performs value to text conversions"
#
# ========================== START OF PROGRAM CODE ============================
use strict;
use Getopt::Long;
my %system_types = (
"dellom" => [
'systemStateChassisStatus',
'systemStatePowerSupplyStatusCombined',
'systemStateVoltageStatusCombined',
'systemStateCoolingDeviceStatusCombined',
'systemStateTemperatureStatusCombined',
'systemStateMemoryDeviceStatusCombined',
'systemStateChassisIntrusionStatusCombined',
'systemStateEventLogStatus',
],
"dellom_storage" => [
'systemStateChassisStatus',
'systemStatePowerSupplyStatusCombined',
'systemStateVoltageStatusCombined',
'systemStateCoolingDeviceStatusCombined',
'systemStateTemperatureStatusCombined',
'systemStateMemoryDeviceStatusCombined',
'systemStateChassisIntrusionStatusCombined',
'systemStateEventLogStatus',
'StorageManagementGlobalSystemStatus'
],
"blade" => [
'systemStateChassisStatus',
'systemStateVoltageStatusCombined',
'systemStateTemperatureStatusCombined',
'systemStateMemoryDeviceStatusCombined',
'systemStateEventLogStatus',
'StorageManagementGlobalSystemStatus'
],
"global" => [
'systemStateGlobalSystemStatus'
],
"chassis" => [
'systemStateChassisStatus'
],
"storage" => [
'StorageManagementGlobalSystemStatus'
],
"custom" => [
'systemStateChassisStatus',
'systemStatePowerSupplyStatusCombined',
'systemStateCoolingDeviceStatusCombined',
'systemStateTemperatureStatusCombined',
'systemStateChassisIntrusionStatusCombined',
'systemStateEventLogStatus',
'chassisModelName',
'chassisServiceTagName'
]
);
my %dell_oids = (
'systemStateGlobalSystemStatus'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.2.1',
'systemStateChassisStatus'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.4.1',
'systemStatePowerSupplyStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.9.1',
'systemStateVoltageStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.12.1',
'systemStateAmperageStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.15.1',
'systemStateCoolingDeviceStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.21.1',
'systemStateTemperatureStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.24.1',
'systemStateMemoryDeviceStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.27.1',
'systemStateChassisIntrusionStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.30.1',
'systemStateACPowerCordStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.36.1',
'systemStateEventLogStatus'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.41.1',
'systemStatePowerUnitStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.42.1',
'systemStateCoolingUnitStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.44.1',
'systemStateACPowerSwitchStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.46.1',
'systemStateProcessorDeviceStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.50.1',
'systemStateBatteryStatusCombined'=>'.1.3.6.1.4.1.674.10892.1.200.10.1.52.1',
'StorageManagementGlobalSystemStatus'=>'.1.3.6.1.4.1.674.10893.1.20.110.13.0',
'chassisManufacturerName'=>'1.3.6.1.4.1.674.10892.1.300.10.1.8.1',
'chassisModelName'=>'1.3.6.1.4.1.674.10892.1.300.10.1.9.1',
'chassisServiceTagName'=>'1.3.6.1.4.1.674.10892.1.300.10.1.11.1',
'chassisSystemName'=>'1.3.6.1.4.1.674.10892.1.300.10.1.15.1',
'operatingSystemOperatingSystemName'=>'1.3.6.1.4.1.674.10892.1.400.10.1.6.1',
'operatingSystemOperatingSystemVersionName'=>'1.3.6.1.4.1.674.10892.1.400.10.1.7.1'
);
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
my @DELLSTATUS=('DellStatus', 'other', 'unknown', 'ok', 'nonCritical', 'critical', 'nonRecoverable');
my $Version='1.3';
my $o_host= undef; # hostname
my $o_community= undef; # community
my $o_port= 161; # SNMP port
my $o_help= undef; # help option
my $o_verb= undef; # verbose mode
my $o_version= undef; # version info option
my $o_warn= undef; # warning level option
my @o_warnL= (); # array for above list
my $o_crit= undef; # Critical level option
my @o_critL= (); # array for above list
my $o_timeout= 5; # Default 5s Timeout
my $o_version2= undef; # use snmp v2c
# SNMPv3 specific
my $o_login= undef; # Login for snmpv3
my $o_passwd= undef; # Pass for snmpv3
my $o_attr= undef; # What attribute(s) to check (specify more then one separated by '.')
my @o_attrL= (); # array for above list
my $o_unkdef= 2; # Default value to report for unknown attributes
my $o_type= undef; # Type of system to check
sub print_version { print "$0: $Version\n" };
sub print_usage {
print "Usage: $0 [-v] -H <host> -C <snmp_community> [-2] | (-l login -x passwd) [-P <port>] -T test|dellom|dellom_storage|blade|global|chassis|custom [-t <timeout>] [-V] [-u <unknown_default>]\n";
}
# Return true if arg is a number
sub isnum {
my $num = shift;
if ( $num =~ /^(\d+\.?\d*)|(^\.\d+)$/ ) { return 1 ;}
return 0;
}
sub help {
print "\nSNMP Dell OpenManage Monitor for Nagios version ",$Version,"\n";
print " by Jason Ellison - infotek(at)gmail.com\n\n";
print_usage();
print <<EOD;
-v, --verbose
print extra debugging information
-h, --help
print this help message
-H, --hostname=HOST
name or IP address of host to check
-C, --community=COMMUNITY NAME
community name for the host's SNMP agent (implies v 1 protocol)
-2, --v2c
use SNMP v2 (instead of SNMP v1)
-P, --port=PORT
SNMPd port (Default 161)
-t, --timeout=INTEGER
timeout for SNMP in seconds (Default: 5)
-V, --version
prints version number
-u, --unknown_default=INT
If attribute is not found then report the output as this number (i.e. -u 0)
-T, --type=test|dellom|dellom_storage|blade|global|chassis|custom
This allows to use pre-defined system type
Currently support systems types are:
test (tries all OID's in verbose mode can be used to generate new system type)
dellom (Dell OpenManage general detailed)
dellom_storage (Dell OpenManage plus Storage Management detailed)
blade (some features are on the chassis not the blade)
global (only check the global health status)
chassis (only check the system chassis health status)
custom (intended for customization)
EOD
}
# For verbose output - don't use it right now
sub verb { my $t=shift; print $t,"\n" if defined($o_verb) ; }
# Get the alarm signal (just in case snmp timout screws up)
$SIG{'ALRM'} = sub {
print ("ERROR: Alarm signal (Nagios time-out)\n");
exit $ERRORS{"UNKNOWN"};
};
sub check_options {
Getopt::Long::Configure ("bundling");
GetOptions(
'v' => \$o_verb, 'verbose' => \$o_verb,
'h' => \$o_help, 'help' => \$o_help,
'H:s' => \$o_host, 'hostname:s' => \$o_host,
'P:i' => \$o_port, 'port:i' => \$o_port,
'C:s' => \$o_community, 'community:s' => \$o_community,
'l:s' => \$o_login, 'login:s' => \$o_login,
'x:s' => \$o_passwd, 'passwd:s' => \$o_passwd,
't:i' => \$o_timeout, 'timeout:i' => \$o_timeout,
'V' => \$o_version, 'version' => \$o_version,
'2' => \$o_version2, 'v2c' => \$o_version2,
'u:i' => \$o_unkdef, 'unknown_default:i' => \$o_unkdef,
'T:s' => \$o_type, 'type:s' => \$o_type
);
if (defined($o_help) ) { help(); exit $ERRORS{"UNKNOWN"}; }
if (defined($o_version)) { print_version(); exit $ERRORS{"UNKNOWN"}; }
if (! defined($o_host) ) # check host and filter
{ print "No host defined!\n";print_usage(); exit $ERRORS{"UNKNOWN"}; }
# check snmp information
if (!defined($o_community) && (!defined($o_login) || !defined($o_passwd)) )
{ print "Put snmp login info!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}; }
if (!defined($o_type)) { print "Must define system type!\n"; print_usage(); exit $ERRORS{"UNKNOWN"}; }
if (defined ($o_type)) {
if ($o_type eq "test"){
print "TEST MODE:\n";
} elsif (!defined($system_types{$o_type})) {
print "Unknown system type $o_type !\n"; print_usage(); exit $ERRORS{"UNKNOWN"};
}
}
}
########## MAIN #######
check_options();
# Check global timeout if something goes wrong
if (defined($o_timeout)) {
verb("Alarm at $o_timeout");
alarm($o_timeout);
} else {
verb("no timeout defined : using 5s");
alarm (5);
}
eval "use Net::SNMP";
if ($@) {
verb("ERROR: You do NOT have the Net:".":SNMP library \n"
. " Install it by running: \n"
. " perl -MCPAN -e shell \n"
. " cpan[1]> install Net::SNMP \n");
exit 1;
} else {
verb("The Net:".":SNMP library is available on your server \n");
}
# SNMP Connection to the host
my ($session,$error);
if (defined($o_login) && defined($o_passwd)) {
# SNMPv3 login
verb("SNMPv3 login");
($session, $error) = Net::SNMP->session(
-hostname => $o_host,
-version => '3',
-username => $o_login,
-authpassword => $o_passwd,
-authprotocol => 'md5',
-privpassword => $o_passwd,
-timeout => $o_timeout
);
} else {
if (defined ($o_version2)) {
# SNMPv2 Login
($session, $error) = Net::SNMP->session(
-hostname => $o_host,
-version => 2,
-community => $o_community,
-port => $o_port,
-timeout => $o_timeout
);
} else {
# SNMPV1 login
($session, $error) = Net::SNMP->session(
-hostname => $o_host,
-community => $o_community,
-port => $o_port,
-timeout => $o_timeout
);
}
}
# next part of the code builds list of attributes to be retrieved
my $i;
my $oid;
my $line;
my $resp;
my $attr;
my $key;
my %varlist = ();
my $result;
if ( $o_type eq "test" ) {
print "Trying all preconfigured Dell OID's against target...\n";
for $attr (sort keys %dell_oids) {
print "$attr\t\($dell_oids{$attr}\)\n";
$result = $session->get_request(
-varbindlist => [$dell_oids{$attr}]
);
print "RESULT: ";
if (!defined($result)) {
print "NO RESPONSE\n";
} else {
if ( $result->{$dell_oids{$attr}} =~ /^[123456]$/ ) {
push @{ $varlist{$attr} }, "$attr", "$dell_oids{$attr}", "$result->{$dell_oids{$attr}}";
print "$result->{$dell_oids{$attr}}\($DELLSTATUS[$result->{$dell_oids{$attr}}]\)\n";
} else {
print "$result->{$dell_oids{$attr}}\n";
}
}
}
$session->close();
print "\nPlease email the results to Jason Ellison - infotek\@gmail.com\n";
print "\nTo add this system to check_dell_openmanage, use something like the following:\n\n";
print " \"pexxxx\" => [\n";
$i = 1;
my $count = keys %varlist;
for $attr (sort keys %varlist){
print " \'$varlist{$attr}[0]\'";
if ( $i lt $count ) {
print ",\n";
} else {
print "\n";
}
$i++;
}
print " ],\n";
exit 0 ;
}
my $statusinfo = "";
verb("SNMP responses...");
for $attr ( @{ $system_types{$o_type} } ) {
$result = $session->get_request(
-varbindlist => [$dell_oids{$attr}]
);
if (!defined($result)) {
verb("RESULT: $attr \n$dell_oids{$attr} = undef");
push @{ $varlist{$attr} }, "$attr", "$dell_oids{$attr}", "$o_unkdef";
}
else {
if ( $result->{$dell_oids{$attr}} =~ /^[123456]$/ ) {
verb("RESULT: $attr \n$dell_oids{$attr} = $result->{$dell_oids{$attr}}\($DELLSTATUS[$result->{$dell_oids{$attr}}]\)");
push @{ $varlist{$attr} }, "$attr", "$dell_oids{$attr}", "$result->{$dell_oids{$attr}}";
} else {
verb("RESULT: $attr \n$dell_oids{$attr} = $result->{$dell_oids{$attr}}");
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$result->{$dell_oids{$attr}}";
}
}
}
$session->close();
# loop to check if warning & critical attributes are ok
verb("\nDell Status to Nagios Status mapping...");
my $statuscode = "OK";
my $statuscritical = "0";
my $statuswarning = "0";
my $statusunknown = "0";
foreach $attr (keys %varlist) {
if ($varlist{$attr}[2] eq "6") {
$statuscritical = "1";
$statuscode="CRITICAL";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=Non-Recoverable";
}
elsif ($varlist{$attr}[2] eq "5") {
$statuscritical="1";
$statuscode="CRITICAL";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=Critical";
}
elsif ($varlist{$attr}[2] eq "4") {
$statuswarning = "1";
$statuscode="WARNING";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=Non-Critical";
}
elsif ($varlist{$attr}[2] eq "2") {
$statusunknown = "1";
$statuscode="UNKNOWN";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=UKNOWN";
}
elsif ($varlist{$attr}[2] eq "1") {
$statusunknown = "1";
$statuscode="UNKNOWN";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=Other";
}
elsif ($varlist{$attr}[2] eq "3") {
$statuscode="OK";
}
else {
$statusunknown = "1";
$statuscode="UNKNOWN";
$statusinfo .= ", " if ($statusinfo);
$statusinfo .= "$attr=UKNOWN";
}
verb("$attr: statuscode = $statuscode");
}
$statuscode="OK";
if ($statuscritical eq '1'){
$statuscode="CRITICAL";
}
elsif ($statuswarning eq '1'){
$statuscode="WARNING";
}
elsif ($statusunknown eq '1'){
$statuscode="UNKNOWN";
}
printf("$statuscode: $statusinfo\n");
verb("\nEXIT CODE: $ERRORS{$statuscode} STATUS CODE: $statuscode\n");
exit $ERRORS{$statuscode};

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,279 +0,0 @@
#!/usr/bin/perl
use Getopt::Std;
$CFG_FILE = "/usr/local/nagios/etc/check_disk.cfg";
$CFG_FILE_LOCAL = "/usr/local/nagios/etc/check_disk_local.cfg";
$DFLT_WARN = 90;
$DFLT_CRIT = 95;
$DFLT_CLASS = "system";
$CURR_WARN = $DFLT_WARN;
$CURR_CRIT = $DFLT_CRIT;
$CURR_CLASS = $DFLT_CLASS;
$sys_type = `uname`;
chomp($sys_type);
%FSTypes = (
ext2 => 1,
ext3 => 1,
ext4 => 1,
ufs => 1,
vxfs => 1,
zfs => 1,
xfs => 1
);
# -p enable perf stats
# -d enable debugging output
# -c <crit> set default critical threshold
# -w <warn> set default warning threshold
# -f <config-file>
# -C <class>
# -t <type[,type...]> add additional file system types
getopts("pdc:w:f:C:t:");
$CURR_WARN = $opt_w if $opt_w ne '';
$CURR_CRIT = $opt_c if $opt_c ne '';
$opt_C = $CURR_CLASS if $opt_C eq '';
# get the types
if ($opt_t ne '') {
@types = split(/,/, $opt_t);
for $t (@types) {
print "add type $t\n" if $opt_d;
$FSTypes{$t} = 1;
}
}
# get the list of file systems
&read_mounts;
# read the config file; if it's not there we take the defaults, except
# that if we specify a config file on the command line, we return UNKNOWN
# if the file isn't there
if ($opt_f ne '') {
open (CFG_FILE, $opt_f) or unknown("Can't open config file: $opt_f");
&read_config;
}
else {
(open(CFG_FILE, $CFG_FILE_LOCAL) or open(CFG_FILE, $CFG_FILE)) and &read_config;
}
if ($opt_d) {
for $fs (sort keys %Class) {
print "fs $fs class $Class{$fs} warn $Warn{$fs} crit $Crit{$fs}\n";
}
}
# if there are any file systems that are mounted but not mentioned in the config file,
# give them default class and thresholds
for $fs (keys %Type) {
print "testing $fs: ", defined($Interesting{$fs}) ? "" : "not ", "interested\n" if $opt_d;
if (! defined($Interesting{$fs})) {
$Class{$fs} = $DFLT_CLASS;
$Warn{$fs} = $DFLT_WARN;
$Crit{$fs} = $DFLT_CRIT;
}
}
if ($sys_type eq "Linux") {
$cmd = "/bin/df -kP";
}
elsif ($sys_type eq "SunOS") {
$cmd = "/usr/bin/df -k";
}
else {
unknown("I don't grok system type $sys_type");
}
$fscount = 0;
for $fs (sort keys %Class) {
## unknown("Non-existant FS ($fs) in config file, line $Line{$fs}") if $Type{$fs} eq '';
push(@FSList, $fs);
}
for $fs (@FSList) {
next if $Ignore{$fs};
next if $Class{$fs} ne $opt_C;
$cmd = $cmd . " " . $fs;
$fscount++;
}
if ($fscount == 0) {
unknown("no file systems in class \'$opt_C\'");
}
print "$cmd\n" if $opt_d;
$code = 0;
open(DF, "$cmd|") or unknown("Unable to exec df command");
$junk = <DF>; # column headers
while (<DF>) {
chop;
($dev, $tot, $used, $free, $cap, $fs) = split;
$p = int(($tot - $free) * 100 / $tot);
print "$fs: $used/$tot $p\n" if $opt_d;
$perf .= " $fs=$p\%";
if ($p > $Crit{$fs}) {
$crit_result .= " $fs: $p\% (C)";
$code = 2;
}
elsif ($p > $Warn{$fs}) {
$warn_result .= " $fs: $p\% (W)";
$code = 1 if $code != 2;
}
else {
$result .= " $fs: $p\% (OK)";
}
}
print "perf $perf\n" if $opt_d;
@CODE = ("OK", "WARNING", "CRITICAL", "UNKNOWN");
print "DISK $CODE[$code]: class '$opt_C':$crit_result$warn_result$result";
print "|$perf" if $opt_p;
print "\n";
exit $code;
sub read_mounts
{
open(MNTTAB, "/etc/mtab") or open(MNTTAB, "/etc/mnttab") or unknown("Can't open file system mount table");
while (<MNTTAB>) {
chop;
@mnt = split;
next if $FSTypes{$mnt[2]} != 1;
$fs = $mnt[1];
print "read from mtab: $_\n" if $opt_d;
# push(@FSList, $fs);
$Type{$fs} = $mnt[2];
# $Class{$fs} = $DFLT_CLASS;
# $Warn{$fs} = $DFLT_WARN;
# $Crit{$fs} = $DFLT_CRIT;
}
}
sub read_config
{
my ($tmp_class, $tmp_warn, $tmp_crit);
$line_num = 0;
while (<CFG_FILE>) {
$line_num++;
chop;
s/^[ ]*//;
next if /^#/;
next if $_ eq '';
if (/^ignore\s/) {
($junk, $fs) = split;
$Ignore{$fs} = 1;
}
elsif (/^crit\s/) {
($junk, $crit) = split;
$CURR_CRIT = $crit;
}
elsif (/^warn\s/) {
($junk, $warn) = split;
$CURR_WARN = $warn;
}
elsif (/^class\s/) {
($junk, $class) = split;
$CURR_CLASS = $class;
}
elsif (/^fs\s/) {
($junk, @a) = split;
$fs = $a[0];
@fslist = &match($fs);
foreach $fs (@fslist) {
$tmp_class = $CURR_CLASS;
$tmp_warn = $CURR_WARN;
$tmp_crit = $CURR_CRIT;
@aa = @a;
shift @aa;
foreach $arg (@aa) {
if ($arg =~ /^class=/) { $tmp_class = substr($arg, 6); }
elsif ($arg =~ /^warn=/) { $tmp_warn = substr($arg, 5); }
elsif ($arg =~ /^crit=/) { $tmp_crit = substr($arg, 5); }
else { unknown("Syntax error in config file, line $line_num"); }
}
# mark the file system as being of overall interest
$Interesting{$fs} = 1;
# Only set these values if the class of the file system is the one that
# we are looking to check. This allows us to put a file system in
# multiple classes (in cases where more than on group wants to know
# about a F.S.) and not have one definition overwritten by another one.
print "about to test $fs now $Class{$fs} tmp $tmp_class dflt $CURR_CLASS opt $opt_C\n" if $opt_d;
next if $tmp_class ne $opt_C;
print "setting $fs to class $tmp_class\n" if $opt_d;
$Class{$fs} = $tmp_class;
$Warn{$fs} = $tmp_warn;
$Crit{$fs} = $tmp_crit;
$Line{$fs} = $line_num;
}
}
else { # syntax error
unknown("Syntax error in config file, line $line_num");
}
}
close(CFG_FILE);
}
sub match
{
my ($fs) = @_;
my @glist = glob($fs);
my @rlist = ();
print "Match glob list is " . join(' ', @glist) . "\n" if $opt_d;
foreach $fs (@glist) {
push @rlist, $fs if $Type{$fs} ne '';
}
print "Match return list is " . join(' ', @rlist) . "\n" if $opt_d;
return @rlist;
}
sub unknown
{
my ($reason) = @_;
print "UNKNOWN: $reason\n";
exit 3;
}

@ -1,331 +0,0 @@
#!/usr/local/bin/perl -w
#
#
# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
#
# Monitoring host script to get the disk usage from a SMB share
#
# Changes and Modifications
# =========================
# 7-Aug-1999 - Michael Anthon
# Created from check_disk.pl script provided with netsaint_statd (basically
# cause I was too lazy (or is that smart?) to write it from scratch)
# 8-Aug-1999 - Michael Anthon
# Modified [warn] and [critical] parameters to accept format of nnn[M|G] to
# allow setting of limits in MBytes or GBytes. Percentage settings for large
# drives is a pain in the butt
# 2-May-2002 - SGhosh fix for embedded perl
#
#
require 5.004;
use POSIX;
use strict;
use Getopt::Long;
use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose);
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '/usr/local/monitoring/libexec';
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
sub print_help ();
sub print_usage ();
$PROGNAME = "check_disk_smb";
$ENV{'PATH'}='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
Getopt::Long::Configure('bundling');
GetOptions
("v" => \$verbose, "verbose" => \$verbose,
"P=s" => \$opt_P, "port=s" => \$opt_P,
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"w=s" => \$opt_w, "warning=s" => \$opt_w,
"c=s" => \$opt_c, "critical=s" => \$opt_c,
"p=s" => \$opt_p, "password=s" => \$opt_p,
"u=s" => \$opt_u, "username=s" => \$opt_u,
"s=s" => \$opt_s, "share=s" => \$opt_s,
"W=s" => \$opt_W, "workgroup=s" => \$opt_W,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"a=s" => \$opt_a, "address=s" => \$opt_a);
if ($opt_V) {
print_revision($PROGNAME,'2.1.1'); #'
exit $ERRORS{'OK'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
my $smbclient = $utils::PATH_TO_SMBCLIENT;
$smbclient || usage("check requires smbclient, smbclient not set\n");
-x $smbclient || usage("check requires smbclient, $smbclient: $!\n");
# Options checking
($opt_H) || ($opt_H = shift @ARGV) || usage("Host name not specified\n");
my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
($host) || usage("Invalid host: $opt_H\n");
($opt_s) || ($opt_s = shift @ARGV) || usage("Share volume not specified\n");
my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
($share) || usage("Invalid share: $opt_s\n");
defined($opt_u) || ($opt_u = shift @ARGV) || ($opt_u = "guest");
my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]*)$/);
defined($user) || usage("Invalid user: $opt_u\n");
defined($opt_p) || ($opt_p = shift @ARGV) || ($opt_p = "");
my $pass = $1 if ($opt_p =~ /(.*)/);
($opt_w) || ($opt_w = shift @ARGV) || ($opt_w = 85);
my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
($warn) || usage("Invalid warning threshold: $opt_w\n");
($opt_c) || ($opt_c = shift @ARGV) || ($opt_c = 95);
my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
($crit) || usage("Invalid critical threshold: $opt_c\n");
# Execute the given command line and return anything it writes to STDOUT and/or
# STDERR. (This might be useful for other plugins, too, so it should possibly
# be moved to utils.pm.)
sub output_and_error_of {
local *CMD;
local $/ = undef;
my $pid = open CMD, "-|";
if (defined($pid)) {
if ($pid) {
return <CMD>;
} else {
open STDERR, ">&STDOUT" and exec @_;
exit(1);
}
}
return undef;
}
# split the type from the unit value
#Check $warn and $crit for type (%/M/G) and set up for tests
#P = Percent, K = KBytes
my $warn_type;
my $crit_type;
if ($opt_w =~ /^([0-9]+)\%?$/) {
$warn = "$1";
$warn_type = "P";
} elsif ($opt_w =~ /^([0-9]+)k$/) {
$warn_type = "K";
$warn = $1;
} elsif ($opt_w =~ /^([0-9]+)M$/) {
$warn_type = "K";
$warn = $1 * 1024;
} elsif ($opt_w =~ /^([0-9]+)G$/) {
$warn_type = "K";
$warn = $1 * 1048576;
}
if ($opt_c =~ /^([0-9]+)\%?$/) {
$crit = "$1";
$crit_type = "P";
} elsif ($opt_c =~ /^([0-9]+)k$/) {
$crit_type = "K";
$crit = $1;
} elsif ($opt_c =~ /^([0-9]+)M$/) {
$crit_type = "K";
$crit = $1 * 1024;
} elsif ($opt_c =~ /^([0-9]+)G$/) {
$crit_type = "K";
$crit = $1 * 1048576;
}
# check if both warning and critical are percentage or size
unless( ( $warn_type eq "P" && $crit_type eq "P" ) || ( $warn_type ne "P" && $crit_type ne "P" ) ){
$opt_w =~ s/\%/\%\%/g;
$opt_c =~ s/\%/\%\%/g;
usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n");
}
# verify warning is less than critical
if ( $warn_type eq "K") {
unless ( $warn > $crit) {
usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n");
}
}else{
unless ( $warn < $crit) {
$opt_w =~ s/\%/\%\%/g;
$opt_c =~ s/\%/\%\%/g;
usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n");
}
}
my $workgroup = $1 if (defined($opt_W) && $opt_W =~ /(.*)/);
my $address = $1 if (defined($opt_a) && $opt_a =~ /(.*)/);
# end of options checking
my $state = "OK";
my $answer = undef;
my $res = undef;
my $perfdata = "";
my @lines = undef;
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print "No Answer from Client\n";
exit $ERRORS{"UNKNOWN"};
};
alarm($TIMEOUT);
# Execute a "du" on the share using smbclient program
# get the results into $res
my @cmd = (
$smbclient,
"//$host/$share",
"-U", "$user%$pass",
defined($workgroup) ? ("-W", $workgroup) : (),
defined($address) ? ("-I", $address) : (),
defined($opt_P) ? ("-p", $opt_P) : (),
"-c", "du"
);
print join(" ", @cmd) . "\n" if ($verbose);
$res = output_and_error_of(@cmd) or exit $ERRORS{"UNKNOWN"};
#Turn off alarm
alarm(0);
#Split $res into an array of lines
@lines = split /\n/, $res;
#Get the last line into $_
$_ = $lines[$#lines-1];
#print "$_\n";
#Process the last line to get free space.
#If line does not match required regexp, return an UNKNOWN error
if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) {
my ($avail_bytes) = $3 * $2;
my ($total_bytes) = $1 * $2;
my ($occupied_bytes) = $1 * $2 - $avail_bytes;
my ($avail) = $avail_bytes/1024;
my ($capper) = int(($3/$1)*100);
my ($mountpt) = "\\\\$host\\$share";
# TODO : why is the kB the standard unit for args ?
my ($warn_bytes) = $total_bytes - $warn * 1024;
if ($warn_type eq "P") {
$warn_bytes = $warn * $1 * $2 / 100;
}
my ($crit_bytes) = $total_bytes - $crit * 1024;
if ($crit_type eq "P") {
$crit_bytes = $crit * $1 * $2 / 100;
}
if (int($avail / 1024) > 0) {
$avail = int($avail / 1024);
if (int($avail /1024) > 0) {
$avail = (int(($avail / 1024)*100))/100;
$avail = $avail ."G";
} else {
$avail = $avail ."M";
}
} else {
$avail = $avail ."K";
}
#print ":$warn:$warn_type:\n";
#print ":$crit:$crit_type:\n";
#print ":$avail:$avail_bytes:$capper:$mountpt:\n";
$perfdata = "'" . $share . "'=" . $occupied_bytes . 'B;'
. $warn_bytes . ';'
. $crit_bytes . ';'
. '0;'
. $total_bytes;
if ($occupied_bytes > $crit_bytes) {
$state = "CRITICAL";
$answer = "CRITICAL: Only $avail ($capper%) free on $mountpt";
} elsif ( $occupied_bytes > $warn_bytes ) {
$state = "WARNING";
$answer = "WARNING: Only $avail ($capper%) free on $mountpt";
} else {
$answer = "Disk ok - $avail ($capper%) free on $mountpt";
}
} else {
$answer = "Result from smbclient not suitable";
$state = "UNKNOWN";
foreach (@lines) {
if (/(Access denied|NT_STATUS_LOGON_FAILURE|NT_STATUS_ACCESS_DENIED)/) {
$answer = "Access Denied";
$state = "CRITICAL";
last;
}
if (/(Unknown host \w*|Connection.*failed)/) {
$answer = "$1";
$state = "CRITICAL";
last;
}
if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) {
$answer = "Invalid share name \\\\$host\\$share";
$state = "CRITICAL";
last;
}
}
}
print $answer;
print " | " . $perfdata if ($perfdata);
print "\n";
print "$state\n" if ($verbose);
exit $ERRORS{$state};
sub print_usage () {
print "Usage: $PROGNAME -H <host> -s <share> -u <user> -p <password>
-w <warn> -c <crit> [-W <workgroup>] [-P <port>] [-a <IP>]\n";
}
sub print_help () {
print_revision($PROGNAME,'2.1.1');
print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop
Perl Check SMB Disk plugin for monitoring
";
print_usage();
print "
-H, --hostname=HOST
NetBIOS name of the server
-s, --share=STRING
Share name to be tested
-W, --workgroup=STRING
Workgroup or Domain used (Defaults to \"WORKGROUP\")
-a, --address=IP
IP-address of HOST (only necessary if HOST is in another network)
-u, --user=STRING
Username to log in to server. (Defaults to \"guest\")
-p, --password=STRING
Password to log in to server. (Defaults to an empty password)
-w, --warning=INTEGER or INTEGER[kMG]
Percent of used space at which a warning will be generated (Default: 85%)
-c, --critical=INTEGER or INTEGER[kMG]
Percent of used space at which a critical will be generated (Defaults: 95%)
-P, --port=INTEGER
Port to be used to connect to. Some Windows boxes use 139, others 445 (Defaults to smbclient default)
If thresholds are followed by either a k, M, or G then check to see if that
much disk space is available (kilobytes, Megabytes, Gigabytes)
Warning percentage should be less than critical
Warning (remaining) disk space should be greater than critical.
";
support();
}

Binary file not shown.

@ -1,155 +0,0 @@
#!/usr/bin/perl -w
use strict;
use IO::Handle;
use Socket;
use Sys::Hostname;
use Getopt::Std;
STDERR->autoflush(1);
STDOUT->autoflush(1);
# getopts "H:p:b:a:v:s:t:
# b: base dn; a: atrib; v: value of attrib; s: search string; t: timeout
use vars qw($opt_d $opt_h $opt_H $opt_p $opt_b $opt_a $opt_v $opt_s $opt_t);
getopts("dhH:p:b:a:v:s:t:");
our $Usage = <<EOUSAGE;
Usage: $0 -H <hostname> [-p <port>] [-t <timeout>] -b <base DN> -a <attribute> -v <value> -s <result string>
EOUSAGE
(print $Usage and exit 3) if $opt_h;
if (!defined($opt_H) or !defined($opt_b) or !defined($opt_a) or !defined($opt_v) or !defined($opt_s)) {
print $Usage;
exit 3;
}
our $debug = $opt_d;
our $ThatHost = $opt_H;
our $ThatPort = defined($opt_p) ? $opt_p : 80;
our $TIMEOUT = defined($opt_t) ? $opt_t : 10;
# our $BaseDN = "o=Princeton University,c=US";
# our $Attrib = "uid";
# our $Value = "esm";
our $BaseDN = $opt_b;
our $Attrib = $opt_a;
our $Value = $opt_v;
our $SearchFor = $opt_s;
our @Result;
our $DSML = <<End_Of_Query;
<?xml version='1.0' encoding='UTF-8' ?>
<soap-env:Envelope
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/'>
<soap-env:Body xmlns:dsml="urn:oasis:names:tc:DSML:2:0:core">
<batchRequest>
<searchRequest dn="$BaseDN"
scope="wholeSubtree"
derefAliases="neverDerefAliases"
sizeLimit="1">
<filter>
<equalityMatch name="$Attrib">
<value>$Value</value>
</equalityMatch>
</filter>
<attributes>
<attribute name="cn" />
</attributes>
</searchRequest>
</batchRequest>
</soap-env:Body>
</soap-env:Envelope>
End_Of_Query
our $LengthOfDSML = length($DSML);
our $ThisHost = hostname();
our ($AfInet, $SockStream, $SockAddr) = (AF_INET, SOCK_STREAM, 'S n a4 x8');
our ($Name, $Aliases, $Proto) = getprotobyname('tcp');
our ($Type, $Length) = (undef, undef);
our @ThisAddr = ();
our @ThatAddr = ();
($Name, $Aliases, $Type, $Length, @ThisAddr) = gethostbyname($ThisHost);
($Name, $Aliases, $Type, $Length, @ThatAddr) = gethostbyname($ThatHost);
our $This = pack ($SockAddr, $AfInet, 0, $ThisAddr[0]);
our $That = pack ($SockAddr, $AfInet, $ThatPort, $ThatAddr[0]);
if (socket(SOCKET, $AfInet, $SockStream, $Proto)) {
print STDOUT "TCP socket created\n" if $debug;
} else {
print "CRITICAL: Cannot connect to $ThatHost:$ThatPort\n";
exit 2;
}
## if (bind(SOCKET, $This)) {
## print STDOUT "Bound to $ThisHost\n";
## } else {
## die "Cannot bind to $ThisHost; $!\n";
## }
## our $Error = sprintf 'Timeout connecting to port %u of %s', $ThatPort, $ThatHost;
our $Error = '';
$SIG{ALRM} = sub { print "CRITICAL: Timeout connecting to $ThatHost:$ThatPort\n"; exit 2; };
alarm($TIMEOUT) if $TIMEOUT > 0;
if (connect(SOCKET, $That)) {
printf STDOUT "Connected to port %u of %s\n", $ThatPort, $ThatHost if $debug;
} else {
print "CRITICAL: Cannot connect to $ThatHost:$ThatPort\n";
exit 2;
}
alarm(0);
$SIG{ALRM} = 'DEFAULT';
SOCKET->autoflush(1);
our $HTTPandDSML = <<EODSML;
POST / HTTP/1.1
Host: $ThisHost
Content-Type: text/xml; charset="utf-8"
Content-Length: $LengthOfDSML
SOAPAction: dsml://$ThatHost/
$DSML
EODSML
select SOCKET; $|=1; select STDOUT;
$SIG{ALRM} = sub { print "CRITICAL: Timeout receiving response from $ThatHost:$ThatPort\n"; exit 2; };
alarm($TIMEOUT) if $TIMEOUT > 0;
print STDOUT $HTTPandDSML if $debug;
print SOCKET $HTTPandDSML;
while (<SOCKET>) {
print STDOUT if $debug;
chop;
push @Result, $_;
next unless m|</soap-env:Envelope>|is;
$Error = '';
last;
}
alarm(0);
$SIG{ALRM} = 'DEFAULT';
close SOCKET;
if ($Result[0] !~ /HTTP\/.*200 OK/) {
print "CRITICAL: DSML query returned $Result[0]\n";
exit 2;
}
my $s;
foreach $s (@Result) {
if ($s =~ /$SearchFor/) {
print "OK: lookup of $Attrib=$Value succeeded\n";
exit 0;
}
}
print "CRITICAL: lookup of $Attrib=$Value failed\n";
exit 2;

Binary file not shown.

@ -1,974 +0,0 @@
#!/usr/bin/perl
use strict;
use lib qw(/usr/local/perl/lib/perl5);
#use lib qw(/usr/local/perl/modules/lib/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib/perl5/5.8.8 /usr/local/perl/modules/lib64/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib64/perl5/5.8.8);
my $VERSION = '0.7.1';
my $COPYRIGHT = 'Copyright (C) 2005-2011 Jonathan Buhacoff <jonathan@buhacoff.net>';
my $LICENSE = 'http://www.gnu.org/licenses/gpl.txt';
my %status = ( 'OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3 );
# look for required modules
exit $status{UNKNOWN} unless load_modules(qw/Getopt::Long/);
BEGIN {
if( grep { /^--hires$/ } @ARGV ) {
eval "use Time::HiRes qw(time);";
warn "Time::HiRes not installed\n" if $@;
}
}
# get options from command line
Getopt::Long::Configure("bundling");
my $verbose = 0;
my $help = "";
my $help_usage = "";
my $show_version = "";
my $host = "";
my $smtp_server = "";
my $smtp_port = "";
my $imap_server = "";
my $smtp_username = "";
my $smtp_password = "";
my $smtp_tls = "";
my $imap_port = "";
my $imap_username = "";
my $imap_password = "";
my $imap_mailbox = "";
my $username = "";
my $password = "";
my $ssl = "";
my $imap_ssl = "";
my $mailto = "";
my $mailfrom = "";
my @header = ();
my $body = "";
my $warnstr = "";
my $critstr = "";
my $waitstr = "";
my $delay_warn = 95;
my $delay_crit = 300;
my $smtp_warn = 15;
my $smtp_crit = 30;
my $imap_warn = 15;
my $imap_crit = 30;
my $timeout = "";
my @alert_plugins = ();
my $imap_interval = 5;
my $imap_retries = 5;
my @plugins = ();
my @token_formats = ();
my $tokenfile = "";
my $default_crit = 30;
my $default_warn = 15;
my $default_wait = 5;
my $default_timeout = 60;
my $time_hires = "";
my $libexec = "/usr/local/monitoring/nagios/libexec";
my $ok;
$ok = Getopt::Long::GetOptions(
"V|version"=>\$show_version,
"v|verbose+"=>\$verbose,"h|help"=>\$help,"usage"=>\$help_usage,
"w|warning=s"=>\$warnstr,"c|critical=s"=>\$critstr, "t|timeout=s"=>\$timeout,
"libexec=s"=>\$libexec,
# plugin settings
"p|plugin=s"=>\@plugins, "T|token=s"=>\@token_formats,
"A|alert=i"=>\@alert_plugins,
"F|file=s"=>\$tokenfile,
# common settings
"H|hostname=s"=>\$host,
"U|username=s"=>\$username,"P|password=s"=>\$password,
"ssl!"=>\$ssl,
# smtp settings
"smtp-server=s"=>\$smtp_server,"smtp-port=i"=>\$smtp_port,
"mailto=s"=>\$mailto, "mailfrom=s",\$mailfrom,
"header=s"=>\@header, "body=s"=>\$body,
# smtp-tls settings
"smtptls!"=>\$smtp_tls,
"smtp-username=s"=>\$smtp_username,"smtp-password=s"=>\$smtp_password,
# delay settings
"wait=s"=>\$waitstr,
# imap settings
"imap-server=s"=>\$imap_server,"imap-port=i"=>\$imap_port,
"imap-username=s"=>\$imap_username,"imap-password=s"=>\$imap_password,
"imap-mailbox=s"=>\$imap_mailbox,
"imap-check-interval=i"=>\$imap_interval,"imap-retries=i"=>\$imap_retries,
"imapssl!"=>\$imap_ssl,
# Time
"hires"=>\$time_hires,
);
if( $show_version ) {
print "$VERSION\n";
if( $verbose ) {
print "Warning threshold: $delay_warn seconds\n";
print "Critical threshold: $delay_crit seconds\n";
print "Default wait: $default_wait seconds\n";
print "Default timeout: $default_timeout seconds\n";
}
exit $status{UNKNOWN};
}
if( $help ) {
exec "perldoc", $0 or print "Try `perldoc $0`\n";
exit $status{UNKNOWN};
}
if( $host ) {
$smtp_server = $host if $smtp_server eq "";
$imap_server = $host if $imap_server eq "";
}
if( $username ) {
$smtp_username = $username if $smtp_username eq "";
$imap_username = $username if $imap_username eq "";
}
if( $password ) {
$smtp_password = $password if $smtp_password eq "";
$imap_password = $password if $imap_password eq "";
}
if( $ssl ) {
$imap_ssl = $ssl if $imap_ssl eq "";
$smtp_tls = $ssl if $smtp_tls eq "";
}
if( $help_usage
||
(
scalar(@plugins) == 0
&&
(
$smtp_server eq "" || $mailto eq "" || $mailfrom eq ""
|| $imap_server eq "" || $username eq "" || $password eq ""
)
)
) {
print "Usage 1: $0 -H host \n\t".
"--mailto recipient\@your.net --mailfrom sender\@your.net --body 'message' \n\t".
"--username username --password password \n\t".
"[-w <seconds>] [-c <seconds>]\n\t" .
"[--imap-check-interval <seconds> ] [--imap-retries <times> ]\n";
print "Usage 2: $0 \n\t".
"-p 'first plugin command with %TOKEN1% embedded' \n\t".
"-p 'second plugin command with %TOKEN1% embedded' \n\t".
"[-w <seconds1>,<seconds2>] [-c <seconds1>,<seconds2>] \n";
exit $status{UNKNOWN};
}
# determine thresholds
my @warning_times = split(",", $warnstr);
my @critical_times = split(",", $critstr);
my @alarm_times = split(",", $timeout);
my @wait_times = split(",", $waitstr);
my ($dw,$sw,$rw) = split(",", $warnstr);
my ($dc,$sc,$rc) = split(",", $critstr);
my ($wait) = split(",", $waitstr);
$delay_warn = $dw if defined $dw and $dw ne "";
$smtp_warn = $sw if defined $sw and $sw ne "";
$imap_warn = $rw if defined $rw and $rw ne "";
$delay_crit = $dc if defined $dc and $dc ne "";
$smtp_crit = $sc if defined $sc and $sc ne "";
$imap_crit = $rc if defined $rc and $rc ne "";
my $smtp_thresholds = "";
$smtp_thresholds .= "-w $smtp_warn " if defined $smtp_warn and $smtp_warn ne "";
$smtp_thresholds .= "-c $smtp_crit " if defined $smtp_crit and $smtp_crit ne "";
my $imap_thresholds = "";
$imap_thresholds .= "-w $imap_warn " if defined $imap_warn and $imap_warn ne "";
$imap_thresholds .= "-c $imap_crit " if defined $imap_crit and $imap_crit ne "";
$imap_thresholds .= "--imap-check-interval $imap_interval " if defined $imap_interval and $imap_interval ne "";
$imap_thresholds .= "--imap-retries $imap_retries " if defined $imap_retries and $imap_retries ne "";
if( scalar(@alarm_times) == 1 ) {
$default_timeout = shift(@alarm_times);
}
# determine which other options to include
my $smtp_options = "";
$smtp_options .= "-H $smtp_server " if defined $smtp_server and $smtp_server ne "";
$smtp_options .= "-p $smtp_port " if defined $smtp_port and $smtp_port ne "";
$smtp_options .= "--tls " if defined $smtp_tls and $smtp_tls;
$smtp_options .= "-U ".shellquote($smtp_username)." " if defined $smtp_username and $smtp_username ne "";
$smtp_options .= "-P ".shellquote($smtp_password)." " if defined $smtp_password and $smtp_password ne "";
$smtp_options .= "--mailto ".shellquote($mailto)." " if defined $mailto and $mailto ne "";
$smtp_options .= "--mailfrom ".shellquote($mailfrom)." " if defined $mailfrom and $mailfrom ne "";
foreach my $h( @header ) {
$smtp_options .= "--header ".shellquote($h)." ";
}
my $imap_options = "";
$imap_options .= "-H $imap_server " if defined $imap_server and $imap_server ne "";
$imap_options .= "-p $imap_port " if defined $imap_port and $imap_port ne "";
$imap_options .= "-U ".shellquote($imap_username)." " if defined $imap_username and $imap_username ne "";
$imap_options .= "-P ".shellquote($imap_password)." " if defined $imap_password and $imap_password ne "";
$imap_options .= "--mailbox ".shellquote($imap_mailbox)." " if defined $imap_mailbox and $imap_mailbox ne "";
$imap_options .= "--ssl " if defined $imap_ssl and $imap_ssl;
# create the report object
my $report = new PluginReport;
my @report_plugins = (); # populated later with either (smtp,imap) or (plugin1,plugin2,...)
my $time_start; # initialized later with time the work actually starts
# create token formats for use with the plugins
my @alpha = qw/a b c d e f g h i j k l m n o p q r s t u v w x y z/;
my @numeric = qw/0 1 2 3 4 5 6 7 8 9/;
my @hex = qw/0 1 2 3 4 5 6 7 8 9 a b c d e f/;
my @pgp_even = qw/aardvark absurd accrue acme adrift adult afflict ahead aimless Algol allow alone ammo ancient apple artist assume Athens atlas Aztec baboon backfield backward banjo beaming bedlamp beehive beeswax befriend Belfast berserk billiard bison blackjack blockade blowtorch bluebird bombast bookshelf brackish breadline breakup brickyard briefcase Burbank button buzzard cement chairlift chatter checkup chisel choking chopper Christmas clamshell classic classroom cleanup clockwork cobra commence concert cowbell crackdown cranky crowfoot crucial crumpled crusade cubic dashboard deadbolt deckhand dogsled dragnet drainage dreadful drifter dropper drumbeat drunken Dupont dwelling eating edict egghead eightball endorse endow enlist erase escape exceed eyeglass eyetooth facial fallout flagpole flatfoot flytrap fracture framework freedom frighten gazelle Geiger glitter glucose goggles goldfish gremlin guidance hamlet highchair hockey indoors indulge inverse involve island jawbone keyboard kickoff kiwi klaxon locale lockup merit minnow miser Mohawk mural music necklace Neptune newborn nightbird Oakland obtuse offload optic orca payday peachy pheasant physique playhouse Pluto preclude prefer preshrunk printer prowler pupil puppy python quadrant quiver quota ragtime ratchet rebirth reform regain reindeer rematch repay retouch revenge reward rhythm ribcage ringbolt robust rocker ruffled sailboat sawdust scallion scenic scorecard Scotland seabird select sentence shadow shamrock showgirl skullcap skydive slingshot slowdown snapline snapshot snowcap snowslide solo southward soybean spaniel spearhead spellbind spheroid spigot spindle spyglass stagehand stagnate stairway standard stapler steamship sterling stockman stopwatch stormy sugar surmount suspense sweatband swelter tactics talon tapeworm tempest tiger tissue tonic topmost tracker transit trauma treadmill Trojan trouble tumor tunnel tycoon uncut unearth unwind uproot upset upshot vapor village virus Vulcan waffle wallet watchword wayside willow woodlark Zulu/;
my @pgp_odd = qw/adroitness adviser aftermath aggregate alkali almighty amulet amusement antenna applicant Apollo armistice article asteroid Atlantic atmosphere autopsy Babylon backwater barbecue belowground bifocals bodyguard bookseller borderline bottomless Bradbury bravado Brazilian breakaway Burlington businessman butterfat Camelot candidate cannonball Capricorn caravan caretaker celebrate cellulose certify chambermaid Cherokee Chicago clergyman coherence combustion commando company component concurrent confidence conformist congregate consensus consulting corporate corrosion councilman crossover crucifix cumbersome customer Dakota decadence December decimal designing detector detergent determine dictator dinosaur direction disable disbelief disruptive distortion document embezzle enchanting enrollment enterprise equation equipment escapade Eskimo everyday examine existence exodus fascinate filament finicky forever fortitude frequency gadgetry Galveston getaway glossary gossamer graduate gravity guitarist hamburger Hamilton handiwork hazardous headwaters hemisphere hesitate hideaway holiness hurricane hydraulic impartial impetus inception indigo inertia infancy inferno informant insincere insurgent integrate intention inventive Istanbul Jamaica Jupiter leprosy letterhead liberty maritime matchmaker maverick Medusa megaton microscope microwave midsummer millionaire miracle misnomer molasses molecule Montana monument mosquito narrative nebula newsletter Norwegian October Ohio onlooker opulent Orlando outfielder Pacific pandemic Pandora paperweight paragon paragraph paramount passenger pedigree Pegasus penetrate perceptive performance pharmacy phonetic photograph pioneer pocketful politeness positive potato processor provincial proximate puberty publisher pyramid quantity racketeer rebellion recipe recover repellent replica reproduce resistor responsive retraction retrieval retrospect revenue revival revolver sandalwood sardonic Saturday savagery scavenger sensation sociable souvenir specialist speculate stethoscope stupendous supportive surrender suspicious sympathy tambourine telephone therapist tobacco tolerance tomorrow torpedo tradition travesty trombonist truncated typewriter ultimate undaunted underfoot unicorn unify universe unravel upcoming vacancy vagabond vertigo Virginia visitor vocalist voyager warranty Waterloo whimsical Wichita Wilmington Wyoming yesteryear Yucatan/;
my %formats = (
'a' => sub { pick_random(@alpha) },
'n' => sub { pick_random(@numeric) },
'c' => sub { pick_random(@alpha,@numeric) },
'h' => sub { pick_random(@hex) },
'U' => sub { time },
'X' => sub { pick_random(@pgp_even) },
'Y' => sub { pick_random(@pgp_odd) },
);
if( scalar(@plugins) ) {
# scan the plugin commands for use of tokens to count how many we need
my $token_count = 0;
foreach my $p (@plugins) {
my @matches = sort ($p =~ m/%TOKEN(\d+)%/g);
my $max = pop @matches;
$token_count = $max if defined($max) && $max > $token_count;
}
# create the tokens
my @tokens = ();
foreach my $t (1..$token_count) {
my $format = shift @token_formats;
$format = "U-X-Y" unless $format;
my @format_characters = split(//, $format);
my $token = "";
foreach my $c (@format_characters) {
if( defined $formats{$c} ) {
$token .= &{$formats{$c}};
}
else {
$token .= $c;
}
}
push @tokens, $token;
}
# substitute the tokens into each plugin command
foreach my $p (@plugins) {
foreach my $t (1..$token_count) {
my $token = $tokens[$t-1];
$p =~ s/%TOKEN$t%/$token/g;
}
}
# mark plugins that are allowed to generate alerts. default behavior is to alert for all plugins.
my %alert_plugins = ();
if( scalar(@alert_plugins) > 0 ) {
%alert_plugins = map { $_ => 1 } @alert_plugins;
}
else {
%alert_plugins = map { $_ => 1 } (1..scalar(@plugins));
}
# run each plugin and store its output in a report
$time_start = time;
my $i = 0;
foreach my $p( @plugins ) {
$i++;
my $plugin_timeout = shift(@alarm_times) || $default_timeout;
# run the plugin
eval {
local $SIG{ALRM} = sub { die "exceeded timeout $plugin_timeout seconds\n" }; # NB: \n required, see `perldoc -f alarm`
alarm $plugin_timeout;
my $output = `$p`;
chomp $output;
if( $output !~ m/OK|WARNING|CRITICAL/ ) {
print "EMAIL DELIVERY UNKNOWN - plugin $i error: $output\n";
print "Plugin $i: $p\n" if $verbose;
# record tokens in a file if option is enabled
record_tokens($tokenfile,\@tokens,$time_start,undef,'UNKNOWN',$i,$output) if $tokenfile;
exit $status{UNKNOWN};
}
if( $output =~ m/CRITICAL/ && $alert_plugins{$i} ) {
print "EMAIL DELIVERY CRITICAL - plugin $i failed: $output\n";
print "Plugin $i: $p" if $verbose;
# record tokens in a file if option is enabled
record_tokens($tokenfile,\@tokens,$time_start,undef,'CRITICAL',$i,$output) if $tokenfile;
exit $status{CRITICAL};
}
if( $output =~ m/WARNING/ && $alert_plugins{$i} ) {
print "EMAIL DELIVERY WARNING - plugin $i warning: $output\n";
print "Plugin $i: $p\n" if $verbose;
# record tokens in a file if option is enabled
record_tokens($tokenfile,\@tokens,$time_start,undef,'WARNING',$i,$output) if $tokenfile;
exit $status{WARNING};
}
$report->{"plugin".$i} = $output;
alarm 0;
};
if( $@ && $alert_plugins{$i} ) {
print "EMAIL DELIVERY CRITICAL - Could not run plugin $i: $@\n";
print "Plugin $i: $p\n" if $verbose;
exit $status{CRITICAL};
}
# if this wasn't the last plugin, wait before continuing
if( $i < scalar(@plugins) ) {
my $wait = shift(@wait_times) || $default_wait;
sleep $wait;
}
# compatibility with the "not using plugins" method... pretend to calculate the total round trip time (the delay) using data from the plugins ...
$report->{max} = 0;
$report->{delay} = 0;
}
# register the list of reports
foreach my $r ( 1..scalar(@plugins)) {
push @report_plugins, "plugin".$r;
}
# record tokens in a file if option is enabled
my $tmp_long_report = join(", ", map { "$_: $report->{$_}" } @report_plugins ) if $tokenfile;
record_tokens($tokenfile,\@tokens,$time_start,time,'OK',scalar(@plugins),$tmp_long_report) if $tokenfile;
}
else {
# not using plugins.
$time_start = time;
# send email via SMTP
my $id = $time_start; # XXX should include localhost name maybe or some random number in case the same mailbox is used for multiple delivery tests
my $smtp_plugin = "$libexec/check_smtp_send";
$smtp_plugin = "$libexec/check_smtp_send.pl" unless -e $smtp_plugin;
my $smtp_timeout = shift(@alarm_times) || $default_timeout;
eval {
local $SIG{ALRM} = sub { die "exceeded timeout $smtp_timeout seconds\n" }; # NB: \n required, see `perldoc -f alarm`
alarm $smtp_timeout;
my $smtp = `$smtp_plugin $smtp_options --header 'Subject: Nagios Message SMTP $smtp_server ID $id.' --body 'Nagios Email Delivery Plugin\n$body' $smtp_thresholds`;
if( $smtp !~ m/OK|WARNING|CRITICAL/ ) {
print "EMAIL DELIVERY UNKNOWN - smtp unknown: $smtp\n";
exit $status{UNKNOWN};
}
if( $smtp =~ m/CRITICAL/ ) {
print "EMAIL DELIVERY CRITICAL - smtp failed: $smtp\n";
exit $status{CRITICAL};
}
chomp $smtp;
$report->{smtp} = $smtp;
alarm 0;
};
if( $@ ) {
print "EMAIL DELIVERY CRITICAL - Could not connect to SMTP server $smtp_server: $@\n";
exit $status{CRITICAL};
}
# wait before checking the delivery
$wait = shift(@wait_times) || $default_wait;
sleep $wait;
# check email via IMAP
my $imap_plugin = "$libexec/check_imap_receive";
$imap_plugin = "$libexec/check_imap_receive.pl" unless -e $imap_plugin;
my $imap_timeout = shift(@alarm_times) || $default_timeout;
eval {
local $SIG{ALRM} = sub { die "exceeded timeout $imap_timeout seconds\n" }; # NB: \n required, see `perldoc -f alarm`
alarm $imap_timeout;
my $imap = `$imap_plugin $imap_options -s SUBJECT -s 'Nagios Message SMTP $smtp_server ID' --capture-max 'Nagios Message SMTP $smtp_server ID (\\d+)' --nodelete-captured $imap_thresholds`;
if( $imap !~ m/OK|WARNING|CRITICAL/ ) {
print "EMAIL DELIVERY UNKNOWN - imap unknown: $imap\n";
exit $status{UNKNOWN};
}
if( $imap =~ m/CRITICAL/ ) {
print "EMAIL DELIVERY CRITICAL - imap failed: $imap\n";
exit $status{CRITICAL};
}
if( $imap =~ m/ (\d+) max/ ) {
my $last_received = $1;
$report->{max} = $1;
my $delay = time - $last_received;
$report->{delay} = $delay;
}
chomp $imap;
$report->{imap} = $imap;
alarm 0;
};
if( $@ ) {
print "EMAIL DELIVERY CRITICAL - Could not connect to IMAP server $imap_server: $@\n";
exit $status{CRITICAL};
}
# register the list of reports
push @report_plugins, ("smtp","imap");
}
# calculate elapsed time and issue warnings
my $time_end = time;
my $elapsedtime = $time_end - $time_start;
$report->{seconds} = $elapsedtime;
my @warning = ();
my @critical = ();
push @warning, "most recent received $report->{delay} seconds ago" if( defined($report->{delay}) && $report->{delay} > $delay_warn );
push @critical, "most recent received $report->{delay} seconds ago" if( defined($report->{delay}) && $report->{delay} > $delay_crit );
push @warning, "no emails found" if( !defined($report->{delay}) );
# print report and exit with known status
my $perf_data = "delay=".$report->{delay}."s;$delay_warn;$delay_crit;0 elapsed=".$report->{seconds}."s"; # TODO: need a component for safely generating valid perf data format. for notes on the format, see http://www.perfparse.de/tiki-view_faq.php?faqId=6
my $short_report = $report->text(qw/seconds delay/) . " | $perf_data";
my $long_report = join("", map { "$_: $report->{$_}\n" } @report_plugins );
if( scalar @critical ) {
my $alerts = join(", ", @critical);
print "EMAIL DELIVERY CRITICAL - $alerts; $short_report\n";
print $long_report if $verbose;
exit $status{CRITICAL};
}
if( scalar @warning ) {
my $alerts = join(", ", @warning);
print "EMAIL DELIVERY WARNING - $alerts; $short_report\n";
print $long_report if $verbose;
exit $status{WARNING};
}
print "EMAIL DELIVERY OK - $short_report\n";
print $long_report if $verbose;
exit $status{OK};
# utility to load required modules. exits if unable to load one or more of the modules.
sub load_modules {
my @missing_modules = ();
foreach( @_ ) {
eval "require $_";
push @missing_modules, $_ if $@;
}
if( @missing_modules ) {
print "Missing perl modules: @missing_modules\n";
return 0;
}
return 1;
}
# returns one random character from a set of characters
sub pick_random {
my @set = @_;
my $size = scalar @set;
my $string = $set[int(rand($size))];
return $string;
}
# appens tokens and times to a tab-separated value file
sub record_tokens {
my ($tokenfile,$tokens,$time_start,$time_end,$status,$plugin_num,$output) = @_;
if( $tokenfile ) {
my @tokens = @$tokens;
$time_end = "" unless defined $time_end;
$status = "" unless defined $status;
$plugin_num = "" unless defined $plugin_num;
$output = "" unless defined $output;
print "saving ".scalar(@tokens)." tokens into $tokenfile\n" if $verbose;
open(TOKENFILE,">>$tokenfile");
foreach(@tokens) {
print TOKENFILE "$_\t$time_start\t$time_end\t$status\t$plugin_num\t$output\n";
}
close(TOKENFILE);
}
}
# wraps argument in single-quotes and escapes any single-quotes in the argument
sub shellquote {
my $str = shift || "";
$str =~ s/\'/\'\\\'\'/g;
return "'$str'";
}
# NAME
# PluginReport
# SYNOPSIS
# $report = new PluginReport;
# $report->{label1} = "value1";
# $report->{label2} = "value2";
# print $report->text(qw/label1 label2/);
package PluginReport;
sub new {
my ($proto,%p) = @_;
my $class = ref($proto) || $proto;
my $self = bless {}, $class;
$self->{$_} = $p{$_} foreach keys %p;
return $self;
}
sub text {
my ($self,@labels) = @_;
my @report = map { "$self->{$_} $_" } grep { defined $self->{$_} } @labels;
my $text = join(", ", @report);
return $text;
}
package main;
1;
__END__
=pod
=head1 NAME
check_email_delivery - sends email and verifies delivery
=head1 SYNOPSIS
check_email_delivery -vV
check_email_delivery --usage
check_email_delivery --help
=head1 OPTIONS
=over
=item --warning <seconds>[,<smtp_seconds>,<imap_seconds>]
Exit with WARNING if the most recent email found is older than <seconds>. The
optional <smtp_seconds> and <imap_seconds> parameters will be passed on to the
included plugins that are used for those tasks. If they are not
given then they will not be passed on and the default for that plugin will apply.
Also known as: -w <seconds>[,<send>[,<recv>]]
When using the --plugin option, only one parameter is supported (-w <seconds>) and it will apply
to the entire process. You can specify a warning threshold specific to each plugin in the
plugin command line.
When using the --plugin option, no measuring of "most recent email" is done because we would
not know how to read this information from receive plugins. This may be addressed in future versions.
=item --critical <seconds>[,<smtp_seconds>,<imap_seconds>]
Exit with CRITICAL if the most recent email found is older than <seconds>. The
optional <smtp_seconds> and <imap_seconds> parameters will be passed on to the
included plugins that are used for those tasks. If they are not
given then they will not be passed on and the default for that plugin will apply.
Also known as: -c <seconds>[,<send>[,<recv>]]
When using the --plugin option, only one parameter is supported (-c <seconds>) and it will apply
to the entire process. You can specify a critical threshold specific to each plugin in the
plugin command line.
When using the --plugin option, no measuring of "most recent email" is done because we would
not know how to read this information from receive plugins. This may be addressed in future versions.
=item --timeout <seconds>
=item --timeout <smtp_seconds>,<imap_seconds>
=item --timeout <plugin1_seconds>,<plugin2_seconds>,...
Exit with CRITICAL if the plugins do not return a status within the specified number of seconds.
When only one parameter is used, it applies to each plugin. When multiple parameters are used
(separated by commas) they apply to plugins in the same order the plugins were specified on the
command line. When using --timeout but not the --plugin option, the first parameter is for
check_smtp_send and the second is for check_imap_receive.
=item --alert <pluginN>
Exit with WARNING or CRITICAL only if a warning or error (--warning, --critical, or --timeout)
occurs for specified plugins. If a warning or error occurs for non-specified plugins that run
BEFORE the specified plugins, the exit status will be UNKNOWN. If a warning of error occurs
for non-specified plugins that run AFTER the specified plugins, the exit status will not be
affected.
You would use this option if you are using check_email_delivery with the --plugin option and
the plugins you configure each use different servers, for example different SMTP and IMAP servers.
By default, if you do not use the --alert option, if anything goes wrong during the email delivery
check, a WARNING or CRITICAL alert will be issued. This means that if you define check_email_delivery
for the SMTP server only and the IMAP server fails, Nagios will alert you for the SMTP server which
would be misleading. If you define it for both the SMTP server and IMAP server and just one of them
fails, Nagios will alert you for both servers, which would still be misleading. If you have this
situation, you may want to use the --alert option. You define the check_email_delivery check for
both servers: for the SMTP server (first plugin) you use --alert 1, and for for the IMAP server
(second plugin) you use --alert 2. When check_email_delivery runs with --alert 1 and the SMTP
server fails, you will get the appropriate alert. If the IMAP server fails it will not affect the
status. When check_email_delivery runs with --alert 2 and the SMTP server fails, you will get the
UNKNOWN return code. If the IMAP server generates an alert you will get a WARNING or CRITICAL as
appropriate.
You can repeat this option to specify multiple plugins that should cause an alert.
Do this if you have multiple plugins on the command line but some of them involve the same server.
See also: --plugin.
Also known as: -A <pluginN>
=item --wait <seconds>[,<seconds>,...]
How long to wait between sending the message and checking that it was received. View default with
the -vV option.
When using the --plugin option, you can specify as many wait-between times as you have plugins
(minus the last plugin, because it makes no sense to wait after running the last one). For
example, if you use the --plugin option twice to specify an SMTP plugin and an IMAP plugin, and
you want to wait 5 seconds between sending and receiving, then you would specify --wait 5. A second
example, if you are using the --plugin option three times, then specifying -w 5 will wait 5 seconds
between the second and third plugins also. You can specify a different wait time
of 10 seconds between the second and third plugins, like this: -w 5,10.
=item --hostname <server>
Address or name of the SMTP and IMAP server. Examples: mail.server.com, localhost, 192.168.1.100.
Also known as: -H <server>
=item --smtp-server <server>
Address or name of the SMTP server. Examples: smtp.server.com, localhost, 192.168.1.100.
Using this option overrides the hostname option.
=item --smtp-port <number>
Service port on the SMTP server. Default is 25.
=item --smtp-username <username>
=item --smtp-password <password>
Username and password to use when connecting to the SMTP server with the TLS option.
Use these options if the SMTP account has a different username/password than the
IMAP account you are testing. These options take precendence over the --username and
the --password options.
These are shell-escaped; special characters are ok.
=item --imap-server <server>
Address or name of the IMAP server. Examples: imap.server.com, localhost, 192.168.1.100.
Using this option overrides the hostname option.
=item --imap-port <number>
Service port on the IMAP server. Default is 143. If you use SSL the default is 993.
=item --imap-username <username>
=item --imap-password <password>
Username and password to use when connecting to the IMAP server.
Use these options if the IMAP account has a different username/password than the
SMTP account you are testing. These options take precendence over the --username and
the --password options.
These are shell-escaped; special characters are ok.
=item --username <username>
=item --password <password>
Username and password to use when connecting to IMAP server.
Also known as: -U <username> -P <password>
Also used as the username and password for SMTP when the TLS option is enabled.
To specify a separate set of credentials for SMTP authentication, see the
options --smtp-username and --smtp-password.
=item --imap-check-interval <seconds>
How long to wait between polls of the imap-server for the specified mail. Default is 5 seconds.
=item --imap-retries <times>
How many times to poll the imap-server for the mail, before we give up. Default is 10.
=item --body <message>
Use this option to specify the body of the email message.
=item --header <header>
Use this option to set an arbitrary header in the message. You can use it multiple times.
=item --mailto recipient@your.net
You can send a message to multiple recipients by repeating this option or by separating
the email addresses with commas (no whitespace allowed):
$ check_email_delivery ... --mailto recipient@your.net,recipient2@your.net --mailfrom sender@your.net
This argument is shell-escaped; special characters or angle brackets around the address are ok.
=item --mailfrom sender@your.net
Use this option to set the "from" address in the email.
=item --imapssl
=item --noimapssl
Use this to enable or disable SSL for the IMAP plugin.
This argument is shell-escaped; special characters or angle brackets around the address are ok.
=item --smtptls
=item --nosmtptls
Use this to enable or disable TLS/AUTH for the SMTP plugin.
=item --libexec
Use this option to set the path of the Nagios libexec directory. The default is
/usr/local/monitoring/nagios/libexec. This is where this plugin looks for the SMTP and IMAP
plugins that it depends on.
=item --plugin <command>
This is a new option introduced in version 0.5 of the check_email_delivery plugin.
It frees the plugin from depending on specific external plugins and generalizes the
work done to determine that the email loop is operational. When using the --plugin
option, the following options are ignored: libexec, imapssl, smtptls, hostname,
username, password, smtp*, imap*, mailto, mailfrom, body, header, search.
Use this option multiple times to specify the complete trip. Typically, you would use
this twice to specify plugins for SMTP and IMAP, or SMTP and POP3.
The output will be success if all the plugins return success. Each plugin should be a
standard Nagios plugin.
A random token will be automatically generated and passed to each plugin specified on
the command line by substituting the string %TOKEN1%.
Example usage:
command_name check_email_delivery
command_line check_email_delivery
--plugin "$USER1$/check_smtp_send -H $ARG1$ --mailto recipient@your.net --mailfrom sender@your.net --header 'Subject: Nagios Test %TOKEN1%.'"
--plugin "$USER1$/check_imap_receive -H $ARG1$ -U $ARG1$ -P $ARG2$ -s SUBJECT -s 'Nagios Test %TOKEN1%.'"
This technique allows for a lot of flexibility in configuring the plugins that test
each part of your email delivery loop.
See also: --token.
Also known as: -p <command>
=item --token <format>
This is a new option introduced in version 0.5 of the check_email_delivery plugin.
It can be used in conjunction with --plugin to control the tokens that are generated
and passed to the plugins, like %TOKEN1%.
Use this option multiple times to specify formats for different tokens. For example,
if you want %TOKEN1% to consist of only alphabetical characters but want %TOKEN2% to
consist of only digits, then you might use these options: --token aaaaaa --token nnnnn
Any tokens used in your plugin commands that have not been specified by --token <format>
will default to --token U-X-Y
Token formats:
a - alpha character (a-z)
n - numeric character (0-9)
c - alphanumeric character (a-z0-9)
h - hexadecimal character (0-9a-f)
U - unix time, seconds from epoch. eg 1193012441
X - a word from the pgp even list. eg aardvark
Y - a word from the pgp odd list. eg adroitness
Caution: It has been observed that some IMAP servers do not handle underscores well in the
search criteria. For best results, avoid using underscores in your tokens. Use hyphens or commas instead.
See also: --plugin.
Also known as: -T <format>
The PGP word list was obtained from http://en.wikipedia.org/wiki/PGP_word_list
=item --file <file>
Save (append) status information into the given tab-delimited file. Format used:
token start-time end-time status plugin-num output
Note: format may change in future versions and may become configurable.
This option available as of version 0.6.2.
Also known as: -F <file>
=item --hires
Use the Time::HiRes module to measure time, if available.
=item --verbose
Display additional information. Useful for troubleshooting. Use together with --version to see the default
warning and critical timeout values.
Also known as: -v
=item --version
Display plugin version and exit.
Also known as: -V
=item --help
Display this documentation and exit. Does not work in the ePN version.
Also known as: -h
=item --usage
Display a short usage instruction and exit.
=back
=head1 EXAMPLES
=head2 Send a message with custom headers
$ check_email_delivery -H mail.server.net --mailto recipient@your.net --mailfrom sender@your.net
--username recipient --password secret
EMAIL DELIVERY OK - 1 seconds
=head2 Set warning and critical timeouts for receive plugin only:
$ check_email_delivery -H mail.server.net --mailto recipient@your.net --mailfrom sender@your.net
--username recipient --password secret -w ,,5 -c ,,15
EMAIL DELIVERY OK - 1 seconds
=head1 EXIT CODES
Complies with the Nagios plug-in specification:
0 OK The plugin was able to check the service and it appeared to be functioning properly
1 Warning The plugin was able to check the service, but it appeared to be above some "warning" threshold or did not appear to be working properly
2 Critical The plugin detected that either the service was not running or it was above some "critical" threshold
3 Unknown Invalid command line arguments were supplied to the plugin or the plugin was unable to check the status of the given hosts/service
=head1 NAGIOS PLUGIN NOTES
Nagios plugin reference: http://nagiosplug.sourceforge.net/developer-guidelines.html
This plugin does NOT use Nagios DEFAULT_SOCKET_TIMEOUT (provided by utils.pm as $TIMEOUT) because
the path to utils.pm must be specified completely in this program and forces users to edit the source
code if their install location is different (if they realize this is the problem). You can view
the default timeout for this module by using the --verbose and --version options together. The
short form is -vV.
Other than that, it attempts to follow published guidelines for Nagios plugins.
=head1 CHANGES
Wed Oct 29 13:08:00 PST 2005
+ version 0.1
Wed Nov 9 17:16:09 PST 2005
+ updated arguments to check_smtp_send and check_imap_receive
+ added eval/alarm block to implement -c option
+ added wait option to adjust sleep time between smtp and imap calls
+ added delay-warn and delay-crit options to adjust email delivery warning thresholds
+ now using an inline PluginReport package to generate the report
+ copyright notice and GNU GPL
+ version 0.2
Thu Apr 20 14:00:00 CET 2006 (by Johan Nilsson <johann (at) axis.com>)
+ version 0.2.1
+ corrected bug in getoptions ($imap_server would never ever be set from command-line...)
+ will not make $smtp_server and $imap_server == $host if they're defined on commandline
+ added support for multiple polls of imap-server, with specified intervals
+ changed default behaviour in check_imap_server (searches for the specific id in subject and deletes mails found)
+ increased default delay_warn from 65 seconds to 95 seconds
Thu Apr 20 16:00:00 PST 2006 (by Geoff Crompton <geoff.crompton@strategicdata.com.au>)
+ fixed a bug in getoptions
+ version 0.2.2
Tue Apr 24 21:17:53 PDT 2007
+ now there is an alternate version (same but without embedded perl POD) that is compatible with the new new embedded-perl Nagios feature
+ version 0.2.3
Fri Apr 27 20:32:53 PDT 2007
+ documentation now mentions every command-line option accepted by the plugin, including abbreviations
+ changed connection error to display timeout only if timeout was the error
+ default IMAP plugin is libexec/check_imap_receive (also checking for same but with .pl extension)
+ default SMTP plugin is libexec/check_smtp_send (also checking for same but with .pl extension)
+ removed default values for SMTP port and IMAP port to allow those plugins to set the defaults; so current behavior stays the same and will continue to make sense with SSL
+ version 0.3
Thu Oct 11 10:00:00 EET 2007 (by Timo Virtaneva <timo (at) virtaneva dot com>
+ Changed the header and the search criteria so that the same email-box can be used for all smtp-servers
+ version 0.3.1
Sun Oct 21 11:01:03 PDT 2007
+ added support for TLS options to the SMTP plugin
+ version 0.4
Sun Oct 21 16:17:14 PDT 2007
+ added support for arbitrary plugins to send and receive mail (or anthing else!). see the --plugin option.
+ version 0.5
Tue Dec 4 07:36:20 PST 2007
+ added --usage option because the official nagios plugins have both --help and --usage
+ added --timeout option to match the official nagios plugins
+ shortcut option for --token is now -T to avoid clash with standard shortcut -t for --timeout
+ fixed some minor pod formatting issues for perldoc
+ version 0.5.1
Sat Dec 15 07:39:59 PST 2007
+ improved compatibility with Nagios embedded perl (ePN)
+ version 0.5.2
Thu Jan 17 20:27:36 PST 2008 (by Timo Virtaneva <timo (at) virtaneva dot com> on Thu Oct 11 10:00:00 EET 2007)
+ Changed the header and the search criteria so that the same email-box can be used for all smtp-servers
+ version 0.5.3
Mon Jan 28 22:11:02 PST 2008
+ fixed a bug, smtp-password and imap-password are now string parameters
+ added --alert option to allow selection of which plugin(s) should cause a WARNING or CRITICAL alert
+ version 0.6
Mon Feb 11 19:09:37 PST 2008
+ fixed a bug for embedded perl version, variable "%status" will not stay shared in load_modules
+ version 0.6.1
Mon May 26 10:39:19 PDT 2008
+ added --file option to allow plugin to record status information into a tab-delimited file
+ changed default token from U_X_Y to U-X-Y
+ version 0.6.2
Wed Jan 14 08:29:35 PST 2009
+ fixed a bug that the --header parameter was not being passed to the smtp plugin.
+ version 0.6.3
Mon Jun 8 15:43:48 PDT 2009
+ added performance data for use with PNP4Nagios! (thanks to Ben Ritcey for the patch)
+ version 0.6.4
Wed Sep 16 07:10:10 PDT 2009
+ added elapsed time in seconds to performance data
+ version 0.6.5
Fri Oct 8 19:48:44 PDT 2010
+ fixed uniform IMAP and SMTP username and password bug (thanks to Micle Moerenhout for pointing it out)
+ version 0.6.6
Mon Jan 3 08:24:23 PST 2011
+ added shell escaping for smtp-username, smtp-password, mailto, mailfrom, imap-username, and imap-password arguments
+ version 0.7.0
Fri May 6 08:35:09 AST 2011
+ added --hires option to enable use of Time::Hires if available
+ version 0.7.1
Sun Jun 12 17:17:06 AST 2011
+ added --imap-mailbox option to pass through to check_imap_receive --mailbox option
+ added --ssl option to conveniently enable both --smtp-tls and --imap-ssl
+ version 0.7.2
=head1 AUTHOR
Jonathan Buhacoff <jonathan@buhacoff.net>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2005-2011 Jonathan Buhacoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
http://www.gnu.org/licenses/gpl.txt
=cut

@ -1,840 +0,0 @@
#!/usr/local/monitoring/bin/python
# -*- coding: UTF-8 -*-
#
# Script for checking global health of host running VMware ESX/ESXi
#
# Licence : GNU General Public Licence (GPL) http://www.gnu.org/
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# Pre-req : pywbem
#
# Copyright (c) 2008 David Ligeret
# Copyright (c) 2009 Joshua Daniel Franklin
# Copyright (c) 2010 Branden Schneider
# Copyright (c) 2010-2013 Claudio Kuenzler
# Copyright (c) 2010 Samir Ibradzic
# Copyright (c) 2010 Aaron Rogers
# Copyright (c) 2011 Ludovic Hutin
# Copyright (c) 2011 Carsten Schoene
# Copyright (c) 2011-2012 Phil Randal
# Copyright (c) 2011 Fredrik Aslund
# Copyright (c) 2011 Bertrand Jomin
# Copyright (c) 2011 Ian Chard
# Copyright (c) 2012 Craig Hart
# Copyright (c) 2013 Carl R. Friend
#
# The VMware 4.1 CIM API is documented here:
# http://www.vmware.com/support/developer/cim-sdk/4.1/smash/cim_smash_410_prog.pdf
# http://www.vmware.com/support/developer/cim-sdk/smash/u2/ga/apirefdoc/
#
# The VMware 5.x CIM API is documented here:
# http://pubs.vmware.com/vsphere-50/index.jsp?nav=/5_1_1
#
# This Nagios plugin is maintained here:
# http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
#
#@---------------------------------------------------
#@ History
#@---------------------------------------------------
#@ Date : 20080820
#@ Author : David Ligeret
#@ Reason : Initial release
#@---------------------------------------------------
#@ Date : 20080821
#@ Author : David Ligeret
#@ Reason : Add verbose mode
#@---------------------------------------------------
#@ Date : 20090219
#@ Author : Joshua Daniel Franklin
#@ Reason : Add try/except to catch AuthError and CIMError
#@---------------------------------------------------
#@ Date : 20100202
#@ Author : Branden Schneider
#@ Reason : Added HP Support (HealthState)
#@---------------------------------------------------
#@ Date : 20100512
#@ Author : Claudio Kuenzler www.claudiokuenzler.com
#@ Reason : Combined different versions (Joshua and Branden)
#@ Reason : Added hardware type switch (dell or hp)
#@---------------------------------------------------
#@ Date : 20100626/28
#@ Author : Samir Ibradzic www.brastel.com
#@ Reason : Added basic server info
#@ Reason : Wanted to have server name, serial number & bios version at output
#@ Reason : Set default return status to Unknown
#@---------------------------------------------------
#@ Date : 20100702
#@ Author : Aaron Rogers www.cloudmark.com
#@ Reason : GlobalStatus was incorrectly getting (re)set to OK with every CIM element check
#@---------------------------------------------------
#@ Date : 20100705
#@ Author : Claudio Kuenzler www.claudiokuenzler.com
#@ Reason : Due to change 20100702 all Dell servers would return UNKNOWN instead of OK...
#@ Reason : ... so added Aaron's logic at the end of the Dell checks as well
#@---------------------------------------------------
#@ Date : 20101028
#@ Author : Claudio Kuenzler www.claudiokuenzler.com
#@ Reason : Changed text in Usage and Example so people dont forget to use https://
#@---------------------------------------------------
#@ Date : 20110110
#@ Author : Ludovic Hutin (Idea and Coding) / Claudio Kuenzler (Bugfix)
#@ Reason : If Dell Blade Servers are used, Serial Number of Chassis was returned
#@---------------------------------------------------
#@ Date : 20110207
#@ Author : Carsten Schoene carsten.schoene.cc
#@ Reason : Bugfix for Intel systems (in this case Intel SE7520) - use 'intel' as system type
#@---------------------------------------------------
#@ Date : 20110215
#@ Author : Ludovic Hutin
#@ Reason : Plugin now catches Socket Error (Timeout Error) and added a timeout parameter
#@---------------------------------------------------
#@ Date : 20110217/18
#@ Author : Ludovic Hutin / Tom Murphy
#@ Reason : Bugfix in Socket Error if clause
#@---------------------------------------------------
#@ Date : 20110221
#@ Author : Claudio Kuenzler www.claudiokuenzler.com
#@ Reason : Remove recently added Timeout due to incompabatility on Windows
#@ Reason : and changed name of plugin to check_esxi_hardware
#@---------------------------------------------------
#@ Date : 20110426
#@ Author : Claudio Kuenzler www.claudiokuenzler.com
#@ Reason : Added 'ibm' hardware type (compatible to Dell output). Tested by Keith Erekson.
#@---------------------------------------------------
#@ Date : 20110426
#@ Author : Phil Randal
#@ Reason : URLise Dell model and tag numbers (as in check_openmanage)
#@ Reason : Return performance data (as in check_openmanage, using similar names where possible)
#@ Reason : Minor code tidyup - use elementName instead of instance['ElementName']
#@---------------------------------------------------
#@ Date : 20110428
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : If hardware type is specified as 'auto' try to autodetect vendor
#@ Reason : Return performance data for some HP models
#@ Reason : Indent 'verbose' output to make it easier to read
#@ Reason : Use OptionParser to give better parameter parsing (retaining compatability with original)
#@---------------------------------------------------
#@ Date : 20110503
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Fix bug in HP Virtual Fan percentage output
#@ Reason : Slight code reorganisation
#@ Reason : Sort performance data
#@ Reason : Fix formatting of current output
#@---------------------------------------------------
#@ Date : 20110504
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Minor code changes and documentation improvements
#@ Reason : Remove redundant mismatched ' character in performance data output
#@ Reason : Output non-integral values for all sensors to fix problem seen with system board voltage sensors
#@ on an IBM server (thanks to Attilio Drei for the sample output)
#@---------------------------------------------------
#@ Date : 20110505
#@ Author : Fredrik Aslund
#@ Reason : Added possibility to use first line of a file as password (file:)
#@---------------------------------------------------
#@ Date : 20110505
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Simplfy 'verboseoutput' to use 'verbose' as global variable instead of as parameter
#@ Reason : Don't look at performance data from CIM_NumericSensor if we're not using it
#@ Reason : Add --no-power, --no-volts, --no-current, --no-temp, and --no-fan options
#@---------------------------------------------------
#@ Date : 20110506
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Reinstate timeouts with --timeout parameter (but not on Windows)
#@ Reason : Allow file:passwordfile in old-style arguments too
#@---------------------------------------------------
#@ Date : 20110507
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : On error, include numeric sensor value in output
#@---------------------------------------------------
#@ Date : 20110520
#@ Author : Bertrand Jomin
#@ Reason : Plugin had problems to handle some S/N from IBM Blade Servers
#@---------------------------------------------------
#@ Date : 20110614
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Rewrote file handling and file can now be used for user AND password
#@---------------------------------------------------
#@ Date : 20111003
#@ Author : Ian Chard (ian@chard.org)
#@ Reason : Allow a list of unwanted elements to be specified, which is useful
#@ in cases where hardware isn't well supported by ESXi
#@---------------------------------------------------
#@ Date : 20120402
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Making plugin GPL compatible (Copyright) and preparing for OpenBSD port
#@---------------------------------------------------
#@ Date : 20120405
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Fix lookup of warranty info for Dell
#@---------------------------------------------------
#@ Date : 20120501
#@ Author : Craig Hart
#@ Reason : Bugfix in manufacturer discovery when cim entry not found or empty
#@---------------------------------------------------
#@ Date : 20121027
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Added workaround for Dell PE x620 where "System Board 1 Riser Config Err 0: Connected"
#@ element outputs wrong return code. Dell, please fix that.
#@ Added web-link to VMware CIM API 5.x at top of script.
#@---------------------------------------------------
#@ Date : 20130424
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Another workaround for Dell systems "System Board 1 LCD Cable Pres 0: Connected"
#@---------------------------------------------------
#@ Date : 20130702
#@ Author : Carl R. Friend
#@ Reason : Improving wrong authentication timeout and exit UNKNOWN
#@---------------------------------------------------
#@ Date : 20130725
#@ Author : Phil Randal (phil.randal@gmail.com)
#@ Reason : Fix lookup of warranty info for Dell
#@---------------------------------------------------
import sys
sys.path.append('/usr/local/monitoring/python/lib/python2.7/site-packages')
import time
import pywbem
import re
import string
from optparse import OptionParser,OptionGroup
version = '20130725'
NS = 'root/cimv2'
# define classes to check 'OperationStatus' instance
ClassesToCheck = [
'OMC_SMASHFirmwareIdentity',
'CIM_Chassis',
'CIM_Card',
'CIM_ComputerSystem',
'CIM_NumericSensor',
'CIM_Memory',
'CIM_Processor',
'CIM_RecordLog',
'OMC_DiscreteSensor',
'OMC_Fan',
'OMC_PowerSupply',
'VMware_StorageExtent',
'VMware_Controller',
'VMware_StorageVolume',
'VMware_Battery',
'VMware_SASSATAPort'
]
sensor_Type = {
0:'unknown',
1:'Other',
2:'Temperature',
3:'Voltage',
4:'Current',
5:'Tachometer',
6:'Counter',
7:'Switch',
8:'Lock',
9:'Humidity',
10:'Smoke Detection',
11:'Presence',
12:'Air Flow',
13:'Power Consumption',
14:'Power Production',
15:'Pressure',
16:'Intrusion',
32768:'DMTF Reserved',
65535:'Vendor Reserved'
}
data = []
perf_Prefix = {
1:'Pow',
2:'Vol',
3:'Cur',
4:'Tem',
5:'Fan',
6:'FanP'
}
# parameters
# host name
hostname=''
# user
user=''
# password
password=''
# vendor - possible values are 'unknown', 'auto', 'dell', 'hp', 'ibm', 'intel'
vendor='unknown'
# verbose
verbose=False
# Produce performance data output for nagios
perfdata=False
# timeout
timeout = 0
# elements to ignore (full SEL, broken BIOS, etc)
ignore_list=[]
# urlise model and tag numbers (currently only Dell supported, but the code does the right thing for other vendors)
urlise_country=''
# collect perfdata for each category
get_power = True
get_volts = True
get_current = True
get_temp = True
get_fan = True
# define exit codes
ExitOK = 0
ExitWarning = 1
ExitCritical = 2
ExitUnknown = 3
def dell_country(country):
if country == 'at': # Austria
return 'at/de/'
if country == 'be': # Belgium
return 'be/nl/'
if country == 'cz': # Czech Republic
return 'cz/cs/'
if country == 'de': # Germany
return 'de/de/'
if country == 'dk': # Denmark
return 'dk/da/'
if country == 'es': # Spain
return 'es/es/'
if country == 'fi': # Finland
return 'fi/fi/'
if country == 'fr': # France
return 'fr/fr/'
if country == 'gr': # Greece
return 'gr/en/'
if country == 'it': # Italy
return 'it/it/'
if country == 'il': # Israel
return 'il/en/'
if country == 'me': # Middle East
return 'me/en/'
if country == 'no': # Norway
return 'no/no/'
if country == 'nl': # The Netherlands
return 'nl/nl/'
if country == 'pl': # Poland
return 'pl/pl/'
if country == 'pt': # Portugal
return 'pt/en/'
if country == 'ru': # Russia
return 'ru/ru/'
if country == 'se': # Sweden
return 'se/sv/'
if country == 'uk': # United Kingdom
return 'uk/en/'
if country == 'za': # South Africa
return 'za/en/'
if country == 'br': # Brazil
return 'br/pt/'
if country == 'ca': # Canada
return 'ca/en/'
if country == 'mx': # Mexico
return 'mx/es/'
if country == 'us': # United States
return 'us/en/'
if country == 'au': # Australia
return 'au/en/'
if country == 'cn': # China
return 'cn/zh/'
if country == 'in': # India
return 'in/en/'
# default
return 'en/us/'
def urlised_server_info(vendor, country, server_info):
#server_inf = server_info
if vendor == 'dell' :
# Dell support URLs (idea and tables borrowed from check_openmanage)
du = 'http://www.dell.com/support/troubleshooting/' + dell_country(country) + '19/Product/poweredge-'
if (server_info is not None) :
p=re.match('(.*)PowerEdge (.*) (.*)',server_info)
if (p is not None) :
md=p.group(2)
if md == 'R210 II':
md='r210-2'
md=md.lower()
server_info = p.group(1) + '<a href="' + du + md + '#ui-tabs-4">PowerEdge ' + p.group(2)+'</a> ' + p.group(3)
elif vendor == 'hp':
return server_info
elif vendor == 'ibm':
return server_info
elif vendor == 'intel':
return server_info
return server_info
# ----------------------------------------------------------------------
def system_tag_url(vendor,country):
if vendor == 'dell':
# Dell support sites
supportsite = 'http://www.dell.com/support/troubleshooting/'
dellsuffix = 'nodhs1/Index?t=warranty&servicetag='
# warranty URLs for different country codes
return supportsite + dell_country(country) + dellsuffix
# elif vendor == 'hp':
# elif vendor == 'ibm':
# elif vendor == 'intel':
return ''
# ----------------------------------------------------------------------
def urlised_serialnumber(vendor,country,SerialNumber):
if SerialNumber is not None :
tu = system_tag_url(vendor,country)
if tu != '' :
SerialNumber = '<a href="' + tu + SerialNumber + '">' + SerialNumber + '</a>'
return SerialNumber
# ----------------------------------------------------------------------
def verboseoutput(message) :
if verbose:
print "%s %s" % (time.strftime("%Y%m%d %H:%M:%S"), message)
# ----------------------------------------------------------------------
def getopts() :
global hosturl,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,get_power,get_volts,get_current,get_temp,get_fan
usage = "usage: %prog https://hostname user password system [verbose]\n" \
"example: %prog https://my-shiny-new-vmware-server root fakepassword dell\n\n" \
"or, using new style options:\n\n" \
"usage: %prog -H hostname -U username -P password [-V system -v -p -I XX]\n" \
"example: %prog -H my-shiny-new-vmware-server -U root -P fakepassword -V auto -I uk\n\n" \
"or, verbosely:\n\n" \
"usage: %prog --host=hostname --user=username --pass=password [--vendor=system --verbose --perfdata --html=XX]\n"
parser = OptionParser(usage=usage, version="%prog "+version)
group1 = OptionGroup(parser, 'Mandatory parameters')
group2 = OptionGroup(parser, 'Optional parameters')
group1.add_option("-H", "--host", dest="host", help="report on HOST", metavar="HOST")
group1.add_option("-U", "--user", dest="user", help="user to connect as", metavar="USER")
group1.add_option("-P", "--pass", dest="password", \
help="password, if password matches file:<path>, first line of given file will be used as password", metavar="PASS")
group2.add_option("-V", "--vendor", dest="vendor", help="Vendor code: auto, dell, hp, ibm, intel, or unknown (default)", \
metavar="VENDOR", type='choice', choices=['auto','dell','hp','ibm','intel','unknown'],default="unknown")
group2.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, \
help="print status messages to stdout (default is to be quiet)")
group2.add_option("-p", "--perfdata", action="store_true", dest="perfdata", default=False, \
help="collect performance data for pnp4nagios (default is not to)")
group2.add_option("-I", "--html", dest="urlise_country", default="", \
help="generate html links for country XX (default is not to)", metavar="XX")
group2.add_option("-t", "--timeout", action="store", type="int", dest="timeout", default=0, \
help="timeout in seconds - no effect on Windows (default = no timeout)")
group2.add_option("-i", "--ignore", action="store", type="string", dest="ignore", default="", \
help="comma-separated list of elements to ignore")
group2.add_option("--no-power", action="store_false", dest="get_power", default=True, \
help="don't collect power performance data")
group2.add_option("--no-volts", action="store_false", dest="get_volts", default=True, \
help="don't collect voltage performance data")
group2.add_option("--no-current", action="store_false", dest="get_current", default=True, \
help="don't collect current performance data")
group2.add_option("--no-temp", action="store_false", dest="get_temp", default=True, \
help="don't collect temperature performance data")
group2.add_option("--no-fan", action="store_false", dest="get_fan", default=True, \
help="don't collect fan performance data")
parser.add_option_group(group1)
parser.add_option_group(group2)
# check input arguments
if len(sys.argv) < 2:
print "no parameters specified\n"
parser.print_help()
sys.exit(-1)
# if first argument starts with 'https://' we have old-style parameters, so handle in old way
if re.match("https://",sys.argv[1]):
# check input arguments
if len(sys.argv) < 5:
print "too few parameters\n"
parser.print_help()
sys.exit(-1)
if len(sys.argv) > 5 :
if sys.argv[5] == "verbose" :
verbose = True
hosturl = sys.argv[1]
user = sys.argv[2]
password = sys.argv[3]
vendor = sys.argv[4]
else:
# we're dealing with new-style parameters, so go get them!
(options, args) = parser.parse_args()
# Making sure all mandatory options appeared.
mandatories = ['host', 'user', 'password']
for m in mandatories:
if not options.__dict__[m]:
print "mandatory parameter '--" + m + "' is missing\n"
parser.print_help()
sys.exit(-1)
hostname=options.host.lower()
# if user has put "https://" in front of hostname out of habit, do the right thing
# hosturl will end up as https://hostname
if re.match('^https://',hostname):
hosturl = hostname
else:
hosturl = 'https://' + hostname
user=options.user
password=options.password
vendor=options.vendor.lower()
verbose=options.verbose
perfdata=options.perfdata
urlise_country=options.urlise_country.lower()
timeout=options.timeout
ignore_list=options.ignore.split(',')
get_power=options.get_power
get_volts=options.get_volts
get_current=options.get_current
get_temp=options.get_temp
get_fan=options.get_fan
# if user or password starts with 'file:', use the first string in file as user, second as password
if (re.match('^file:', user) or re.match('^file:', password)):
if re.match('^file:', user):
filextract = re.sub('^file:', '', user)
filename = open(filextract, 'r')
filetext = filename.readline().split()
user = filetext[0]
password = filetext[1]
filename.close()
elif re.match('^file:', password):
filextract = re.sub('^file:', '', password)
filename = open(filextract, 'r')
filetext = filename.readline().split()
password = filetext[0]
filename.close()
# ----------------------------------------------------------------------
getopts()
# if running on Windows, don't use timeouts and signal.alarm
on_windows = True
os_platform = sys.platform
if os_platform != "win32":
on_windows = False
import signal
def handler(signum, frame):
print 'CRITICAL: Execution time too long!'
sys.exit(ExitCritical)
# connection to host
verboseoutput("Connection to "+hosturl)
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), NS)
# Add a timeout for the script. When using with Nagios, the Nagios timeout cannot be < than plugin timeout.
if on_windows == False and timeout > 0:
signal.signal(signal.SIGALRM, handler)
signal.alarm(timeout)
# run the check for each defined class
GlobalStatus = ExitUnknown
server_info = ""
bios_info = ""
SerialNumber = ""
ExitMsg = ""
# if vendor is specified as 'auto', try to get vendor from CIM
# note: the default vendor is 'unknown'
if vendor=='auto':
try:
c=wbemclient.EnumerateInstances('CIM_Chassis')
except pywbem.cim_operations.CIMError,args:
if ( args[1].find('Socket error') >= 0 ):
print "UNKNOWN: %s" %args
sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem.cim_http.AuthError,arg:
verboseoutput("Global exit set to UNKNOWN")
GlobalStatus = ExitUnknown
print "UNKNOWN: Authentication Error"
sys.exit (GlobalStatus)
else:
man=c[0][u'Manufacturer']
if re.match("Dell",man):
vendor="dell"
elif re.match("HP",man):
vendor="hp"
elif re.match("IBM",man):
vendor="ibm"
elif re.match("Intel",man):
vendor="intel"
else:
vendor='unknown'
for classe in ClassesToCheck :
verboseoutput("Check classe "+classe)
try:
instance_list = wbemclient.EnumerateInstances(classe)
except pywbem.cim_operations.CIMError,args:
if ( args[1].find('Socket error') >= 0 ):
print "CRITICAL: %s" %args
sys.exit (ExitCritical)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem.cim_http.AuthError,arg:
verboseoutput("Global exit set to UNKNOWN")
GlobalStatus = ExitCritical
print "UNKNOWN: Authentication Error"
sys.exit (GlobalStatus)
else:
# GlobalStatus = ExitOK #ARR
for instance in instance_list :
sensor_value = ""
elementName = instance['ElementName']
elementNameValue = elementName
verboseoutput(" Element Name = "+elementName)
# Ignore element if we don't want it
if elementName in ignore_list :
verboseoutput(" (ignored)")
continue
# BIOS & Server info
if elementName == 'System BIOS' :
bios_info = instance[u'Name'] + ': ' \
+ instance[u'VersionString'] + ' ' \
+ str(instance[u'ReleaseDate'].datetime.date())
verboseoutput(" VersionString = "+instance[u'VersionString'])
elif elementName == 'Chassis' :
man = instance[u'Manufacturer']
if man is None :
man = 'Unknown Manufacturer'
verboseoutput(" Manufacturer = "+man)
SerialNumber = instance[u'SerialNumber']
if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber)
server_info = man + ' '
if vendor != 'intel':
model = instance[u'Model']
if model:
verboseoutput(" Model = "+model)
server_info += model + ' s/n:'
elif elementName == 'Server Blade' :
SerialNumber = instance[u'SerialNumber']
if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber)
# Report detail of Numeric Sensors and generate nagios perfdata
if classe == "CIM_NumericSensor" :
sensorType = instance[u'sensorType']
sensStr = sensor_Type.get(sensorType,"Unknown")
if sensorType:
verboseoutput(" sensorType = %d - %s" % (sensorType,sensStr))
units = instance[u'BaseUnits']
if units:
verboseoutput(" BaseUnits = %d" % units)
# grab some of these values for Nagios performance data
scale = 10**instance[u'UnitModifier']
verboseoutput(" Scaled by = %f " % scale)
cr = int(instance[u'CurrentReading'])*scale
verboseoutput(" Current Reading = %f" % cr)
elementNameValue = "%s: %g" % (elementName,cr)
ltnc = 0
utnc = 0
ltc = 0
utc = 0
if instance[u'LowerThresholdNonCritical'] is not None:
ltnc = instance[u'LowerThresholdNonCritical']*scale
verboseoutput(" Lower Threshold Non Critical = %f" % ltnc)
if instance[u'UpperThresholdNonCritical'] is not None:
utnc = instance[u'UpperThresholdNonCritical']*scale
verboseoutput(" Upper Threshold Non Critical = %f" % utnc)
if instance[u'LowerThresholdCritical'] is not None:
ltc = instance[u'LowerThresholdCritical']*scale
verboseoutput(" Lower Threshold Critical = %f" % ltc)
if instance[u'UpperThresholdCritical'] is not None:
utc = instance[u'UpperThresholdCritical']*scale
verboseoutput(" Upper Threshold Critical = %f" % utc)
#
if perfdata:
perf_el = elementName.replace(' ','_')
# Power and Current
if sensorType == 4: # Current or Power Consumption
if units == 7: # Watts
if get_power:
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),1) )
elif units == 6: # Current
if get_current:
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),3) )
# PSU Voltage
elif sensorType == 3: # Voltage
if get_volts:
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),2) )
# Temperatures
elif sensorType == 2: # Temperature
if get_temp:
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),4) )
# Fan speeds
elif sensorType == 5: # Tachometer
if get_fan:
if units == 65: # percentage
data.append( ("%s=%g%%;%g;%g " % (perf_el, cr, utnc, utc),6) )
else:
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),5) )
elif classe == "CIM_Processor" :
verboseoutput(" Family = %d" % instance['Family'])
verboseoutput(" CurrentClockSpeed = %dMHz" % instance['CurrentClockSpeed'])
# HP Check
if vendor == "hp" :
if instance['HealthState'] is not None :
elementStatus = instance['HealthState']
verboseoutput(" Element HealthState = %d" % elementStatus)
interpretStatus = {
0 : ExitOK, # Unknown
5 : ExitOK, # OK
10 : ExitWarning, # Degraded
15 : ExitWarning, # Minor
20 : ExitCritical, # Major
25 : ExitCritical, # Critical
30 : ExitCritical, # Non-recoverable Error
}[elementStatus]
if (interpretStatus == ExitCritical) :
verboseoutput("GLobal exit set to CRITICAL")
GlobalStatus = ExitCritical
ExitMsg += " CRITICAL : %s " % elementNameValue
if (interpretStatus == ExitWarning and GlobalStatus != ExitCritical) :
verboseoutput("GLobal exit set to WARNING")
GlobalStatus = ExitWarning
ExitMsg += " WARNING : %s " % elementNameValue
# Added the following for when GlobalStatus is ExitCritical and a warning is detected
# This way the ExitMsg gets added but GlobalStatus isn't changed
if (interpretStatus == ExitWarning and GlobalStatus == ExitCritical) : # ARR
ExitMsg += " WARNING : %s " % elementNameValue #ARR
# Added the following so that GlobalStatus gets set to OK if there's no warning or critical
if (interpretStatus == ExitOK and GlobalStatus != ExitWarning and GlobalStatus != ExitCritical) : #ARR
GlobalStatus = ExitOK #ARR
# Dell, Intel, IBM and unknown hardware check
elif (vendor == "dell" or vendor == "intel" or vendor == "ibm" or vendor=="unknown") :
# Added 20121027 As long as Dell doesnt correct these CIM elements return code we have to ignore it
ignore_list.append("System Board 1 Riser Config Err 0: Connected")
ignore_list.append("System Board 1 LCD Cable Pres 0: Connected")
if instance['OperationalStatus'] is not None :
elementStatus = instance['OperationalStatus'][0]
verboseoutput(" Element Op Status = %d" % elementStatus)
interpretStatus = {
0 : ExitOK, # Unknown
1 : ExitCritical, # Other
2 : ExitOK, # OK
3 : ExitWarning, # Degraded
4 : ExitWarning, # Stressed
5 : ExitWarning, # Predictive Failure
6 : ExitCritical, # Error
7 : ExitCritical, # Non-Recoverable Error
8 : ExitWarning, # Starting
9 : ExitWarning, # Stopping
10 : ExitCritical, # Stopped
11 : ExitOK, # In Service
12 : ExitWarning, # No Contact
13 : ExitCritical, # Lost Communication
14 : ExitCritical, # Aborted
15 : ExitOK, # Dormant
16 : ExitCritical, # Supporting Entity in Error
17 : ExitOK, # Completed
18 : ExitOK, # Power Mode
19 : ExitOK, # DMTF Reserved
20 : ExitOK # Vendor Reserved
}[elementStatus]
if (interpretStatus == ExitCritical) :
verboseoutput("Global exit set to CRITICAL")
GlobalStatus = ExitCritical
ExitMsg += " CRITICAL : %s " % elementNameValue
if (interpretStatus == ExitWarning and GlobalStatus != ExitCritical) :
verboseoutput("GLobal exit set to WARNING")
GlobalStatus = ExitWarning
ExitMsg += " WARNING : %s " % elementNameValue
# Added same logic as in 20100702 here, otherwise Dell servers would return UNKNOWN instead of OK
if (interpretStatus == ExitWarning and GlobalStatus == ExitCritical) : # ARR
ExitMsg += " WARNING : %s " % elementNameValue #ARR
if (interpretStatus == ExitOK and GlobalStatus != ExitWarning and GlobalStatus != ExitCritical) : #ARR
GlobalStatus = ExitOK #ARR
if elementName == 'Server Blade' :
if SerialNumber :
if SerialNumber.find(".") != -1 :
SerialNumber = SerialNumber.split('.')[1]
# Munge the ouptput to give links to documentation and warranty info
if (urlise_country != '') :
SerialNumber = urlised_serialnumber(vendor,urlise_country,SerialNumber)
server_info = urlised_server_info(vendor,urlise_country,server_info)
# Output performance data
perf = '|'
if perfdata:
sdata=[]
ctr=[0,0,0,0,0,0,0]
# sort the data so we always get perfdata in the right order
# we make no assumptions about the order in which CIM returns data
# first sort by element name (effectively) and insert sequence numbers
for p in sorted(data):
p1 = p[1]
sdata.append( ("P%d%s_%d_%s") % (p1,perf_Prefix[p1], ctr[p1], p[0]) )
ctr[p1] += 1
# then sort perfdata into groups and output perfdata string
for p in sorted(sdata):
perf += p
# sanitise perfdata - don't output "|" if nothing to report
if perf == '|':
perf = ''
if GlobalStatus == ExitOK :
print "OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf)
elif GlobalStatus == ExitUnknown :
print "UNKNOWN: %s" % (ExitMsg) #ARR
else:
print "%s- Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf)
sys.exit (GlobalStatus)

@ -1,48 +0,0 @@
#!/usr/bin/perl
use Getopt::Std;
use File::Basename;
getopts('wch');
if ($opt_h or $ARGV[0] eq '') {
print "Usage:\n";
print " check_file -w|-c file1,file2,file3,...\n";
print " check_file -h\n";
exit 0;
}
(@files) = split(/,/, $ARGV[0]);
foreach $f (@files) {
($n, $p, $s) = fileparse($f, ());
$ff = "$n$s";
@st = stat $f;
if ($st[7] eq '') {
$bad = $bad . " $ff(?)";
}
elsif ($st[7] == 0) {
$bad = $bad . " $ff(0)";
}
else {
$ok = $ok . " $ff";
}
}
if ($bad ne '') {
if ($opt_w) {
print "FILES WARNING:$bad\n";
exit 1;
}
if ($opt_c) {
print "FILES CRITICAL:$bad\n";
exit 2;
}
}
print "FILES OK:$ok\n";
exit 0;

@ -1,127 +0,0 @@
#!/usr/local/bin/perl -w
# check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com>
#
# Checks a file's size and modification time to make sure it's not empty
# and that it's sufficiently recent.
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# you should have received a copy of the GNU General Public License
# along with this program if not, write to the Free Software Foundation,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
use strict;
use English;
use Getopt::Long;
use File::stat;
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '/usr/local/monitoring/libexec';
use utils qw (%ERRORS &print_revision &support);
sub print_help ();
sub print_usage ();
my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
my ($result, $message, $age, $size, $st, $perfdata);
$PROGNAME="check_file_age";
$ENV{'PATH'}='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
$opt_w = 240;
$opt_c = 600;
$opt_W = 0;
$opt_C = 0;
$opt_f = "";
Getopt::Long::Configure('bundling');
GetOptions(
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"i" => \$opt_i, "ignore-missing" => \$opt_i,
"f=s" => \$opt_f, "file" => \$opt_f,
"w=f" => \$opt_w, "warning-age=f" => \$opt_w,
"W=f" => \$opt_W, "warning-size=f" => \$opt_W,
"c=f" => \$opt_c, "critical-age=f" => \$opt_c,
"C=f" => \$opt_C, "critical-size=f" => \$opt_C);
if ($opt_V) {
print_revision($PROGNAME, '2.1.1');
exit $ERRORS{'OK'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
}
$opt_f = shift unless ($opt_f);
if (! $opt_f) {
print "FILE_AGE UNKNOWN: No file specified\n";
exit $ERRORS{'UNKNOWN'};
}
# Check that file exists (can be directory or link)
unless (-e $opt_f) {
if ($opt_i) {
$result = 'OK';
print "FILE_AGE $result: $opt_f doesn't exist, but ignore-missing was set\n";
exit $ERRORS{$result};
} else {
print "FILE_AGE CRITICAL: File not found - $opt_f\n";
exit $ERRORS{'CRITICAL'};
}
}
$st = File::stat::stat($opt_f);
$age = time - $st->mtime;
$size = $st->size;
$perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0";
$result = 'OK';
if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) {
$result = 'CRITICAL';
}
elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
$result = 'WARNING';
}
print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n";
exit $ERRORS{$result};
sub print_usage () {
print "Usage:\n";
print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>\n";
print " $PROGNAME [-h | --help]\n";
print " $PROGNAME [-V | --version]\n";
}
sub print_help () {
print_revision($PROGNAME, '2.1.1');
print "Copyright (c) 2003 Steven Grimm\n\n";
print_usage();
print "\n";
print " -i | --ignore-missing : return OK if the file does not exist\n";
print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n";
print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n";
print "\n";
support();
}

@ -1,246 +0,0 @@
#!/usr/local/bin/perl -w
#
# usage:
# check_flexlm.pl license_file
#
# Check available flexlm license managers.
# Use lmstat to check the status of the license server
# described by the license file given as argument.
# Check and interpret the output of lmstat
# and create returncodes and output.
#
# Contrary to most other plugins, this script takes
# a file, not a hostname as an argument and returns
# the status of hosts and services described in that
# file. Use these hosts.cfg entries as an example
#
#host[anchor]=any host will do;some.address.com;;check-host-alive;3;120;24x7;1;1;1;
#service[anchor]=yodel;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yodel_lic
#service[anchor]=yeehaw;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yeehaw_lic
#command[check_flexlm]=/some/path/libexec/check_flexlm.pl $ARG1$
#
# Notes:
# - you need the lmstat utility which comes with flexlm.
# - set the correct path in the variable $lmstat.
#
# initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com
#
# License: GPL
#
# lmstat output patches from Steve Rigler/Cliff Rice 13-Apr-2002
# srigler@marathonoil.com,cerice@marathonoil.com
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '/usr/local/monitoring/libexec';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME="check_flexlm";
sub print_help ();
sub print_usage ();
$ENV{'PATH'}='/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
Getopt::Long::Configure('bundling');
GetOptions
("V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"v" => \$verbose, "verbose" => \$verbose,
"F=s" => \$opt_F, "filename=s" => \$opt_F,
"t=i" => \$opt_t, "timeout=i" => \$opt_t);
if ($opt_V) {
print_revision($PROGNAME,'2.1.1');
exit $ERRORS{'OK'};
}
unless (defined $opt_t) {
$opt_t = $utils::TIMEOUT ; # default timeout
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
unless (defined $opt_F) {
print "Missing license.dat file\n";
print_usage();
exit $ERRORS{'UNKNOWN'};
}
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print "Timeout: No Answer from Client\n";
exit $ERRORS{'UNKNOWN'};
};
alarm($opt_t);
my $lmstat = $utils::PATH_TO_LMSTAT ;
unless (-x $lmstat ) {
print "Cannot find \"lmstat\"\n";
exit $ERRORS{'UNKNOWN'};
}
($opt_F) || ($opt_F = shift) || usage("License file not specified\n");
my $licfile = $1 if ($opt_F =~ /^(.*)$/);
($licfile) || usage("Invalid filename: $opt_F\n");
print "$licfile\n" if $verbose;
if ( ! open(CMD,"$lmstat -c $licfile |") ) {
print "ERROR: Could not open \"$lmstat -c $licfile\" ($!)\n";
exit exit $ERRORS{'UNKNOWN'};
}
my $serverup = 0;
my @upsrv;
my @downsrv; # list of servers up and down
#my ($ls1,$ls2,$ls3,$lf1,$lf2,$lf3,$servers);
# key off of the term "license server" and
# grab the status. Keep going until "Vendor" is found
#
#
# Collect list of license servers by their status
# Vendor daemon status is ignored for the moment.
while ( <CMD> ) {
next if (/^lmstat/); # ignore 1st line - copyright
next if (/^Flexible/); # ignore 2nd line - timestamp
(/^Vendor/) && last; # ignore Vendor daemon status
print $_ if $verbose;
if ($_ =~ /license server /) { # matched 1 (of possibly 3) license server
s/^\s*//; #some servers start at col 1, other have whitespace
# strip staring whitespace if any
if ( $_ =~ /UP/) {
$_ =~ /^(.*):/ ;
push(@upsrv, $1);
print "up:$1:\n" if $verbose;
} else {
$_ =~ /^(.*):/;
push(@downsrv, $1);
print "down:$1:\n" if $verbose;
}
}
# if ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*)/ ) {
# $ls1 = $1;
# $ls2 = $2;
# $ls3 = $3;
# $lf1 = $lf2 = $lf3 = 0;
# $servers = 3;
# } elsif ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*)/ ) {
# $ls1 = $1;
# $ls2 = $ls3 = "";
# $lf1 = $lf2 = $lf3 = 0;
# $servers = 1;
# } elsif ( / *$ls1: license server UP/ ) {
# print "$ls1 UP, ";
# $lf1 = 1
# } elsif ( / *$ls2: license server UP/ ) {
# print "$ls2 UP, ";
# $lf2 = 1
# } elsif ( / *$ls3: license server UP/ ) {
# print "$ls3 UP, ";
# $lf3 = 1
# } elsif ( / *([^:]*: UP .*)/ ) {
# print " license server for $1\n";
# $serverup = 1;
# }
}
#if ( $serverup == 0 ) {
# print " license server not running\n";
# exit 2;
#}
close CMD;
if ($verbose) {
print "License Servers running: ".scalar(@upsrv) ."\n";
foreach my $upserver (@upsrv) {
print "$upserver\n";
}
print "License servers not running: ".scalar(@downsrv)."\n";
foreach my $downserver (@downsrv) {
print "$downserver\n";
}
}
#
# print list of servers which are up.
#
if (scalar(@upsrv) > 0) {
print "License Servers running:";
foreach my $upserver (@upsrv) {
print "$upserver,";
}
}
#
# Ditto for those which are down.
#
if (scalar(@downsrv) > 0) {
print "License servers NOT running:";
foreach my $downserver (@downsrv) {
print "$downserver,";
}
}
# perfdata
print "\n|flexlm::up:".scalar(@upsrv).";down:".scalar(@downsrv)."\n";
exit $ERRORS{'OK'} if ( scalar(@downsrv) == 0 );
exit $ERRORS{'WARNING'} if ( (scalar(@upsrv) > 0) && (scalar(@downsrv) > 0));
#exit $ERRORS{'OK'} if ( $servers == $lf1 + $lf2 + $lf3 );
#exit $ERRORS{'WARNING'} if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );
exit $ERRORS{'CRITICAL'};
sub print_usage () {
print "Usage:
$PROGNAME -F <filename> [-v] [-t] [-V] [-h]
$PROGNAME --help
$PROGNAME --version
";
}
sub print_help () {
print_revision($PROGNAME,'2.1.1');
print "Copyright (c) 2000 Ernst-Dieter Martin/Karl DeBisschop
Check available flexlm license managers
";
print_usage();
print "
-F, --filename=FILE
Name of license file (usually \"license.dat\")
-v, --verbose
Print some extra debugging information (not advised for normal operation)
-t, --timeout
Plugin time out in seconds (default = $utils::TIMEOUT )
-V, --version
Show version and license information
-h, --help
Show this help screen
Flexlm license managers usually run as a single server or three servers and a
quorum is needed. The plugin return OK if 1 (single) or 3 (triple) servers
are running, CRITICAL if 1(single) or 3 (triple) servers are down, and WARNING
if 1 or 2 of 3 servers are running\n
";
support();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,651 +0,0 @@
#!/usr/bin/perl -w
#
# check_generic - nagios plugin
#
# Copyright (c) 2007 Matthias Flacke (matthias.flacke at gmx.de)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# TODO
#
#
# $Id$
#
#nagios: -epn
#
use strict;
use Getopt::Long qw(:config no_ignore_case bundling);
BEGIN { eval("use Time::HiRes qw(time)") }
use lib "/usr/local/monitoring/libexec";
use vars qw(
$MYSELF %opt %cmd %rc $command $returncode
$VERSION $OK $WARNING $CRITICAL $UNKNOWN
$DETAIL_LIST $DETAIL_RC $DETAIL_STDERR $DETAIL_PERFORMANCE
);
#-------------------------------------------------------------------------------
#--- vars ----------------------------------------------------------------------
#-------------------------------------------------------------------------------
$MYSELF="check_generic";
$VERSION='$Revision$ $Date$ $Author$';
#
#--- RC defines
$OK=0;
$WARNING=1;
$CRITICAL=2;
$UNKNOWN=3;
#
#--- report defines
$DETAIL_LIST=1;
$DETAIL_RC=2;
$DETAIL_STDERR=4;
$DETAIL_PERFORMANCE=8;
#
#--- vars
%cmd=(
matchlist => [],
);
%rc=(
label => { $OK => "OK", $WARNING => "WARNING", $CRITICAL => "CRITICAL", $UNKNOWN => "UNKNOWN", },
number => { "OK" => $OK, "WARNING" => $WARNING, "CRITICAL" => $CRITICAL, "UNKNOWN" => $UNKNOWN,
"ok" => $OK, "warning" => $WARNING, "critical" => $CRITICAL, "unknown" => $UNKNOWN,
"o" => $OK, "w" => $WARNING, "c" => $CRITICAL, "u" => $UNKNOWN, },
s2r => { 0 => $OK, 2 => $WARNING, 3 => $CRITICAL, 1 => $UNKNOWN, },
r2s => { $OK => 0, $WARNING => 2, $CRITICAL => 3, $UNKNOWN => 1, },
complement => { $OK => $CRITICAL, $WARNING => $OK, $CRITICAL => $OK, $UNKNOWN => $OK, },
minimum => { $OK => 0, $WARNING => 1, $CRITICAL => 1, $UNKNOWN => 1, },
maximum => { $OK => 0, $WARNING => 1, $CRITICAL => 1, $UNKNOWN => 1, },
list => { $OK => [],$WARNING => [],$CRITICAL => [],$UNKNOWN => [], },
textsev => ["ok","unknown","warning","critical"],
top => $OK,
error => [ ],
starttime => 0.0,
endtime => 0.0,
);
my %opt=(
"configfile" => "",
"ignore_rc" => 0,
"libexec" => "/usr/local/nagios/libexec",
"maxage" => 24, #hours
"name" => "CHANGEME",
"performance" => undef,
"report" => 15,
"string" => {},
"timeout" => 10,
"tmpdir" => "/usr/tmp/check_generic",
"type" => "scalar",
"verbose" => 0,
#"ok" => "0:0",
#"warning" => "1:1",
#"critical" => "1:1",
#"unknown" => "1:1",
);
#-------------------------------------------------------------------------------
#--- subs ----------------------------------------------------------------------
#-------------------------------------------------------------------------------
sub process_parameters {
if (! GetOptions(
"c|critical=s" => \$opt{critical},
"d|tmpdir=s" => \$opt{tmpdir},
"e|execute=s" => \$opt{execute},
"h|help" => \$opt{help},
"i|ignore_rc" => \$opt{ignore_rc},
"n|name=s" => \$opt{name},
"o|ok=s" => \$opt{ok},
"p|performance=s" => \$opt{performance},
"r|report:i" => \$opt{report},
"f|false=s" => \$opt{false},
"t|timeout=i" => \$opt{timeout},
"u|unknown=s" => \$opt{unknown},
"v|verbose+" => \$opt{verbose},
"V|version" => \$opt{version},
"w|warning=s" => \$opt{warning},
"y|type=s" => \$opt{type},
)
) {
short_usage();
return $UNKNOWN;
}
if ($opt{version}) {
print "$MYSELF: v$VERSION\n";
return $UNKNOWN;
}
if ($opt{help}) {
short_usage();
long_usage();
return $UNKNOWN;
}
if (!$opt{execute}) {
print "$MYSELF error: no commandline specified\n";
short_usage();
return $UNKNOWN;
} else {
$cmd{command}=$opt{execute};
$cmd{name}=$opt{execute};
}
if (!$opt{ok} && !$opt{warning} && !$opt{critical} && !$opt{unknown}) {
print "$MYSELF error: no evaluation expression specified\n";
short_usage();
return $UNKNOWN;
} else {
foreach my $state (reverse @{$rc{textsev}}) {
if (defined($opt{$state})) {
$opt{string}=is_string_cmp($opt{$state});
debug(3,"process_parameters: state $state defined:$opt{$state}, text evaluation:$opt{string}");
} else {
debug(3,"process_parameters: state $state not defined");
}
}
}
if ($opt{false} && (
$opt{false} ne "o" && $opt{false} ne "OK" &&
$opt{false} ne "u" && $opt{false} ne "UNKNOWN" &&
$opt{false} ne "w" && $opt{false} ne "WARNING" &&
$opt{false} ne "c" && $opt{false} ne "CRITICAL")) {
print "$MYSELF error: unknown false $opt{false}, should be u|UNKNOWN w|WARNING c|critical o|OK\n";
short_usage();
return $UNKNOWN;
}
while (!defined($opt{false})) {
foreach my $state (reverse @{$rc{textsev}}) {
#print "DEBUG:state:$state opt{state}:$opt{$state}\n";
if (defined($opt{$state})) {
$opt{false}=$rc{label}{$rc{complement}{$rc{number}{$state}}};
last;
}
}
}
if (! -d $opt{tmpdir}) {
mkdir $opt{tmpdir} || debug(0,"mkdir $opt{tmpdir} failed:$!");
if (! -d $opt{tmpdir}) {
return $UNKNOWN if (defined($opt{delta}));
}
}
if ($opt{type} eq "delta") {
#--- create tmpfile name from 1. tag 2. command 3. expressions
$opt{tmpfile}=$opt{name} . "_" . $opt{execute};
foreach my $state (reverse @{$rc{textsev}}) {
$opt{tmpfile} .= '_' . $opt{$state} if (defined($opt{$state}));
}
$opt{tmpfile}=~s/\W/_/g;
$opt{tmpfile}="$MYSELF.$opt{tmpfile}.tmp";
debug(2, "process_parameter: tmpfile:$opt{tmpfile}");
#--- read content of old tmpfile if available
my $content=readfile("$opt{tmpdir}/$opt{tmpfile}");
if ($content ne "") {
chomp $content;
($cmd{old_timestamp},$cmd{old_output})=split(/\s+/,$content);
debug(2, "process_parameter: old_timestamp:$cmd{old_timestamp} old_output:$cmd{old_output}");
}
#--- remove old files in tmpdir older than one day
&garbage_collection($opt{maxage});
}
debug(2, "verbosity:$opt{verbose}");
return $OK;
}
sub short_usage {
print <<SHORTEOF;
$MYSELF -e <cmdline> -o|u|w|c <expression> [-f false_state] [-n name] [-t timeout] [-r level]
$MYSELF [-h | --help]
$MYSELF [-V | --version]
SHORTEOF
}
sub long_usage {
print <<LONGEOF;
Options:
-e, --execute <cmdline>
string which contains commands to be executed
(can be a complete filter chain)
-u|w|c|o, --unknown,warning,critical,ok <expression>
operator is perl operators, e.g.
'= n' - numerically equal
'< n' - numerically equal
'> n' - numerically equal
'eq s' - string equal
'ne s' - string non equal
'=~/s/ - pattern matching
default: CRITICAL
-f, --false [u|UNKNOWN|w|WARNING|c|CRITICAL|o|OK]
which state the plugin should become if the expression is false
default: complement of state
-y, --type [SCALAR,ARRAY,DELTA]
type of data value
-i, --ignore_rc
normally the return code of the command executed is taken into account
use this option to explicitly ignore it, default: $opt{ignore_rc}
-n, --name
plugin name (shown in output), default: $opt{name}
-t, --timeout
timeout for one command, default: $opt{timeout}
-d, --tmpdir
specify directory for tmpfiles, default: $opt{tmpdir}
(garbage collection for files \'${MYSELF}*\' removes files older than )
-v, --verbose
increase verbosity (can be called multiple), default: $opt{verbose}
-h, --help
print detailed help screen
-V, --version
print version information
LONGEOF
#-s, --state [u|UNKNOWN|w|WARNING|c|CRITICAL|o|OK]
# which state the plugin should become if the expression is true
#-r, --report <level>
# specify level of details in output (level is binary coded, just add all options)
# default: $opt{report}
# 1: mention service names in plugin_output, e.g.
# "24 plugins checked, 1 critical (http), 0 warning, 0 unknown, 23 ok"
# 2: show STATE in front of each line of plugin output, e.g.
# "[16] OK system_ssh - SSH OK - OpenSSH_4.4 (protocol 1.99)"
# 4: show STDERR (if any) in each line of plugin output
# 8: show performance data
}
#---
#--- debug output routine
#---
sub debug {
my ($level,$message)=@_;
print "$message\n" if ($level <= $opt{verbose});
}
#---
#--- read file and return its contents
#---
sub readfile {
my ($filename)=@_;
open(FILE,$filename) || add_error("readfile: error opening $filename:$!") && return "";
my @lines=<FILE>;
close(FILE);
return join("", @lines);
}
#---
#--- write to file
#---
sub writefile {
my ($filename, $content)=@_;
open(FILE,">$filename") || add_error("writefile: error opening $filename:$!") && return 0;
print FILE $content;
close(FILE);
return -s $filename;
}
#---
#--- check if expression is string evaluation
#---
sub is_string_cmp {
my $expression=shift;
my %stringop=(' lt ',' gt ',' le ',' ge ','\=\~','\!\~',' eq ',' ne ');
foreach my $key (keys(%stringop)) {
return 1 if ($expression=~/^\s*$key/);
}
return 0;
}
#
#---
sub match_env {
my ($string, $expr, $wanted_length)=@_;
my @match=();
my @len=();
my $total="";
my $cute_little_proc="if (\'${string}\'${expr}) { \@match=(\$\`,\$\&,\$\'); }";
my $rc=eval($cute_little_proc);
#print "match_env: cute_little_proc:$cute_little_proc\n";
#print "match_env: string:$string expr:$expr wanted_length:$wanted_length rc eval:$rc eval:$@\n";
for my $i (0..$#match) {
$len[$i]=length($match[$i]);
#print "match $i: $match[$i] ($len[$i])\n";
}
return squeeze($match[0],"right",$wanted_length/3) .
squeeze($match[1],"middle",$wanted_length/3) .
squeeze($match[2],"left",$wanted_length/3);
}
#---
#--- squeeze string
#---
sub squeeze {
my ($string,$fromwhere,$num)=@_;
return "" if (!defined($string));
my $len=length($string);
my $replacement="[...]";
my $rlen=5; # length($replacement)
#--- nothing to squeeze ;-)
return $string if ($len<=$num);
if ($fromwhere eq "left") {
return substr($string,0,$num-$rlen) . $replacement;
} elsif ($fromwhere eq "middle") {
return $replacement . substr($string,($len/2)-($num/2)+$rlen,$num-($rlen*2)) . $replacement;
} elsif ($fromwhere eq "right") {
return $replacement . substr($string,$num*-1+$rlen);
} elsif ($fromwhere eq "both") {
return substr($string,0,$num/2-($rlen/2)) . $replacement . substr($string,($num*-1)/2+($rlen/2));
} else {
return "squeeze error: unknown fromwhere parameter $fromwhere\n";
}
}
#---
#--- taken from Perl Cookbook ;-)
#---
sub is_valid_regex {
my $pat = shift;
return eval { "" =~ /$pat/; 1 } || 0;
}
#---
#--- trim input string if found any chars from trim string
#---
sub mytrim {
my ($src, $trim)=@_;
return ($src=~/[$trim]*(.*)[$trim]*/) ? $1 : $src;
}
#---
#---
#---
sub mysubst {
my ($src,$pattern,$substitution)=@_;
$src=~s/$pattern/$substitution/g;
return $src;
}
#---
#--- substitute macros a la $HOSTNAME$ from environment
#---
sub substitute_macros {
my ($input)=@_;
while ((my $var)=($input=~/\$([A-Z0-9^\$]+)\$/)) {
$input=~s/\$$var\$/$ENV{"NAGIOS_$var"}/g;
}
return $input;
}
#---
#--- add error(s) to global error list
#---
sub add_error {
push @{$rc{error}}, @_;
}
#---
#--- create unique tmpfile and try to create it
#---
sub get_tmpfile {
my ($path,$prefix)=@_;
my $attempt=0;
my $tmpfile="";
#--- check existance of path and create it if necessary
if (! -d $path && ! mkdir($path,0700)) {
die("get_tmpfile: error creating tmp_path $path:$!");
return "";
}
#--- do 5 attempts to create tmpfile
while (++$attempt <= 5) {
my $suffix=int(rand(89999))+10000;
$tmpfile="$path/$prefix.$suffix";
next if (-f $tmpfile);
if (open(TMP,">$tmpfile")) {
close TMP;
return $tmpfile;
}
}
die("get_tmpfile: giving up opening $tmpfile:$!");
return "";
}
#---
#--- remove too old files from $tmpdir
#---
sub garbage_collection {
my $interval=shift;
opendir(DIR, $opt{tmpdir}) or die "garbage_collection: cannot open directory $opt{tmpdir}: $!";
while (defined(my $filename = readdir(DIR))) {
#--- basic security against weak tmpdirs: delete only files beginning with $MYSELF
next if ($filename!~/^$MYSELF/);
my $mtime=(stat("$opt{tmpdir}/$filename"))[9];
if (time-$mtime>($interval*60*60)) {
debug(2, sprintf("garbage collection: removing %d hours old $opt{tmpdir}/$filename", (time-$mtime)/(60*60)));
unlink "$opt{tmpdir}/$filename";
}
}
closedir(DIR);
}
#---
#--- execute $command, return result in %cmd
#---
sub exec_command {
my ($cmd)=@_;
my $tmp_stdout="";
my $tmp_stderr="";
#--- execute command with alarm timer to catch timeouts
$SIG{'ALRM'} = sub { die "timeout" };
eval {
alarm($opt{timeout});
#--- prepare tmpfiles for stdout and stderr
$tmp_stdout=&get_tmpfile($opt{tmpdir}, "${MYSELF}_stdout_$$");
$tmp_stderr=&get_tmpfile($opt{tmpdir}, "${MYSELF}_stderr_$$");
#--- execute command and store stdout/stderr/return code
`$cmd{command} 1>$tmp_stdout 2>$tmp_stderr`;
$cmd{rc}=$? >> 8;
$cmd{timestamp}=time;
#--- store stdout/stderr and cleanup tmpfiles
$cmd{output}=readfile($tmp_stdout);
$cmd{stderr}=readfile($tmp_stderr);
unlink $tmp_stdout, $tmp_stderr;
debug(3, "exec_command: raw output:>" . squeeze($cmd{output},"both",80) . "< raw stderr:>" . squeeze($cmd{stderr},"both",80) . "<");
$cmd{output} .= $cmd{stderr};
#--- unknown return code? change it explicitly to UNKNOWN
if (!defined($rc{r2s}{$cmd{rc}})) {
$cmd{stderr}.=" RC was $cmd{no}{rc}!";
$cmd{rc}=$UNKNOWN;
}
#--- remove white chars from output
chomp $cmd{output};
$cmd{output}=~s/'//mg;
#$cmd{output}=~s/\n/\\n/mg;
#$cmd{output}=mytrim($cmd{output},"\\n\\s");
#$cmd{stderr}=mytrim($cmd{stderr},"\\n\\s");
#print "DEBUG output:>$cmd{output}< stderr:>$cmd{stderr}<n";
alarm(0);
};
#--- any oddities during command execution?
if ($@) {
#--- timeout encountered: store status
if ($@ =~ /timeout/) {
$cmd{output}="UNKNOWN - \'$command\' cancelled after timeout ($opt{timeout}s)";
$cmd{rc}=$UNKNOWN;
#--- catchall for unknown errors
} else {
alarm(0);
die "$MYSELF: unexpected exception encountered:$@";
}
unlink $tmp_stdout, $tmp_stderr;
}
return $cmd{rc};
}
#---
#--- analyze results stored in %cmd
#---
sub do_analysis {
my ($cmd)=@_;
#debug(2,"do_analysis: state:$opt{state} false:$opt{false} number{false}:($rc{number}{$opt{false}})");
my $returncode=$rc{number}{$opt{false}};
#--- first: check return code
if ($opt{ignore_rc}) {
if ($cmd{rc} != 0) {
debug(2, "do_analysis: ignoring error return code $cmd{rc}");
}
} else {
if ($cmd{rc} != 0) {
printf "%s UNKNOWN - cmd %s: %s [%s]\n",
$opt{name},
# replace | with PIPE to avoid perfdata problems
mysubst($cmd{command},"\\|","PIPE"),
squeeze($cmd{output},"left",80),
squeeze($cmd{stderr},"left",80);
return $UNKNOWN;
}
}
#--- check type
if ($opt{type} eq "delta") {
if (defined($cmd{old_timestamp}) && $cmd{old_timestamp} > 0) {
$cmd{elapsed_seconds}=$cmd{timestamp}-$cmd{old_timestamp};
$cmd{delta}=$cmd{output}-$cmd{old_output};
writefile("$opt{tmpdir}/$opt{tmpfile}", "$cmd{timestamp} $cmd{output}");
debug(2, "do_analysis: elapsed_seconds:$cmd{elapsed_seconds} delta:$cmd{delta}");
if ($cmd{elapsed_seconds} > 0) {
$cmd{output}=sprintf "%.2f", $cmd{delta}/$cmd{elapsed_seconds};
}
} else {
writefile("$opt{tmpdir}/$opt{tmpfile}", "$cmd{timestamp} $cmd{output}");
$cmd{result}=squeeze($cmd{output},"left",80);
$cmd{match}="[ delta: no previous output available ]";
return $UNKNOWN;
}
}
#--- start with no match
$cmd{match}="none";
$cmd{matchlist}=[];
if ($opt{string}) {
#--- escape newlines in multiline pattern
$cmd{output}=~s/\n/\\n/mg;
$cmd{result}=squeeze($cmd{output},"left",50);
} else {
#--- remove last newline from numerical patterns
chomp($cmd{output}) if ($cmd{output}=~/\n$/);
$cmd{result}=$cmd{output};
}
#--- step forward in the order of severity from OK to CRITICAL
foreach my $severity (@{$rc{textsev}}) {
if (defined($opt{$severity})) {
my $expression="\'$cmd{output}\'$opt{$severity}";
debug(2,"do_analysis: evaluate expression for severity $severity >\'" . squeeze($cmd{output},"left",80) .
"\'" . squeeze($opt{$severity},"both",80)."<");
#--- can be numerical or string evaluation
if (eval($expression)) {
$cmd{match}=$opt{$severity};
push @{$cmd{matchlist}},$severity;
$returncode=$rc{number}{$severity};
if ($opt{string}) {
$cmd{result}="x" . match_env($cmd{output},$opt{$severity},50);
} else {
$cmd{result}=$cmd{output};
#$cmd{result}=squeeze($cmd{output},"both",80);
}
debug(2,"do_analysis: eval was successful rc:$returncode result:\'$cmd{result}\' match:\'$cmd{match}\'");
} else {
$cmd{result}=squeeze($cmd{output},"both",80);
debug(2,"do_analysis: eval was *not* successful rc:$returncode severity:$severity expression:>\'" .
squeeze($cmd{output},"both",80) . "\'$opt{$severity}<");
}
}
}
return $returncode;
}
#---
#---
#---
sub do_report {
my $cmd=shift;
foreach my $var ('$opt{name}','$rc{rc}','$rc{label}{$rc{rc}}','$cmd{result}','$cmd{match}','$cmd{matchlist}') {
defined_var("do_report",$var);
}
#--- report results
my $report_output=sprintf "%s %s - result:%s match:%s %s",
$opt{name},
$rc{label}{$rc{rc}},
defined($cmd{result}) ? $cmd{result} : "[...]",
defined($cmd{match}) ? $cmd{match} : "[...]",
(@{$cmd{matchlist}}) ? "severities:" . join(',',@{$cmd{matchlist}}) : "";
#print mysubst($report_output,"\\|","PIPE");
print $report_output;
#printf "|%s=%s", $opt{performance}, squeeze($cmd{output},"left",80) if ($opt{performance});
printf "\n";
}
#
#
#
sub defined_var {
my ($prefix,$var)=@_;
if (! eval "defined($var)") {
debug(0,"$prefix: var $var is not defined");
return 0;
}
return 1;
}
#-------------------------------------------------------------------------------
#--- main ----------------------------------------------------------------------
#-------------------------------------------------------------------------------
#--- parse command line options
if (&process_parameters != $OK) {
exit $UNKNOWN;
}
#--- initialize timer for overall timeout
$rc{starttime}=time;
$rc{endtime}=$rc{starttime} + $opt{timeout};
#--- execute command
&exec_command(\%cmd);
#--- analyze results
$rc{rc}=&do_analysis(\%cmd);
#--- report
&do_report(\%cmd);
#--- return rc with highest severity
exit $rc{rc};

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

@ -1,125 +0,0 @@
#!/usr/bin/perl -w
#
# A check to log in a website
#
# By Igor Gubenko (igubenko@Princeton.EDU), 12/15/2011
#
use strict;
use warnings;
use lib qw(/usr/local/perl/lib/perl5);
use Switch;
use Getopt::Std;
use IO::Socket::SSL;
my $context = new IO::Socket::SSL::SSL_Context(
SSL_version => 'tlsv1_2',
SSL_verify_mode => Net::SSLeay::VERIFY_NONE(),
);
IO::Socket::SSL::set_default_context($context);
use LWP::UserAgent;
use HTTP::Request::Common;
#use Net::SSL; # From Crypt-SSLeay
#use LWP::Protocol::https;
#BEGIN {
# $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL
# $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="IO::Socket::SSL";
#}
#$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#$ENV{HTTPS_VERSION} = 3;
sub usage;
my $progname = $0;
my %opt;
# (U)RL, Auth (t)ype, (h)elp, (u)sername, (p)assword, (s)tring to expect, (w)arning threshold, (c)ritical threshold
getopts ("U:t:hu:p:s:w:c:", \%opt);
foreach (qw(U u p)) {
usage unless exists $opt{$_} && not exists $opt{h};
}
my ($url, $type, $user, $pass, $str, $warn, $crit) = (
$opt{U},
exists $opt{t} ? $opt{t} : 'basic',
$opt{u},
$opt{p},
exists $opt{s} ? $opt{s} : undef,
exists $opt{w} ? $opt{w} : 3,
exists $opt{c} ? $opt{c} : 5
);
$url =~ m#^http([s]?)://([^/]+)#i;
my $hst = $2;
$hst .= defined $1 && $1 eq 's' ? ':443' : ':80';
#$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0;
#$ENV{PERL_LWP_SSL_VERIFY_MODE}='SSL_VERIFY_NONE';
#$ENV{'HTTPS_PROXY'} = 'http://malka.princeton.edu:8888';
my $ua = LWP::UserAgent->new( keep_alive => 1 );
my $tstart = time;
#$ua->proxy ('https', 'http://malka.princeton.edu:8888');
#$ua->proxy ('http', 'http://malka.princeton.edu:3128');
$ua->agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)');
#### FOR DEBUG
#$ua->add_handler("request_send", sub { shift->dump; return });
#$ua->add_handler("response_done", sub { shift->dump; return });
my ($req, $response);
$req = GET $url;
switch ($type) {
case 'ntlm' {
$user =~ s#%#\\#;
$ua->credentials ($hst, '', $user, $pass);
#$ua->credentials ('140.180.227.33:8888', '', $user, $pass);
#print "hst = #$hst#, user = #$user#\n";
}
case 'digest' {
$user =~ m#^([^\\%]+)[\\%]{1}(.*)#;
my $realm = $1;
$user = $2;
#print "user = #$user#, realm = #$realm#\n";
$ua->credentials ($hst, $realm, $user, $pass);
}
case 'basic' {
$req->authorization_basic($user, $pass);
}
else { usage; }
}
#$response = $ua -> request ($req);
$response = $ua -> request ($req, undef, 1024 * 1024);
my $tdiff = time - $tstart;
unless ($response->is_success && (defined $str ? $response->decoded_content =~ m#$str# : 1)) {
print "Error retrieving \"$url\". Error: " . $response->status_line . "\n";
exit 2;
}
#print $response->decoded_content . "\n";
if ($tdiff > $crit) {
print "CRITICAL: Login succeeded, but the request took $tdiff seconds!\n";
exit 2;
} elsif ($tdiff > $warn) {
print "WARNING: Login succeeded, but the request took $tdiff seconds!\n";
exit 1;
}
print "Success retrieving and logging in to \"$url\". Response: " . $response->status_line . "; Time elapsed: $tdiff seconds\n";
exit 0;
sub usage {
print "Usage: $progname <-U URL> <-u username> <-p password> [-w warn_thres] [-c crit_thres] [-t type] [-h] [-s regex_in_response]\n";
print "For digest or ntlm auth, username **MUST** be in the form of DOMAIN%username\n";
exit 2;
}

@ -1,22 +0,0 @@
#!/bin/bash
#
# Wrapper for check_generic
#
plugins="$1"
shift
name="$6"
# This crazy ass shit does the following:
#
# 1) Runs a web check on the first argument given (http://admitted.Princeton.EDU in the example below)
# 2) Looks for a string or regex given by the second argument (Congratulations)
# 3) Substitutes the wrong output given by the third argument (403 Forbidden) to the fourth argument (OK)
# 4) If the resultant output looks like the fifth argument (=~/HTTP\/1.1 OK/), the success, else failure
#
# Example:
# check_command check_http_string!admitted.Princeton.EDU!Congratulations!403 Forbidden!OK!'=~/HTTP\/1.1 OK/'
# command $USER1$/check_http_generic $USER1$ '$ARG1$' '$ARG2$' '$ARG3$' '$ARG4$' "$ARG5$" "$SERVICEDESC$"
#${plugins}/check_generic -e $(/usr/local/monitoring/princeton/generic_http.cmd $plugins "$1" "$2" "$3" "$4") -o "$5" -n $name -i -p test -vvv
${plugins}/check_generic -e "${plugins}/check_http -H $1 -f follow -v | sed -n '/$2/ { h; b }; $ { x; /$2/ { x; s/^[^:]\+: //; s/$3/$4/; x }; x; p }'" -o "$5" -n $name -i -p test ### -vvv

@ -1,47 +0,0 @@
#!/usr/bin/perl -w
#
# Test Kaltura login page accessibility
#
# By Igor Gubenko (igubenko@Princeton.EDU), 06/08/2012
#
use lib qw(/usr/local/perl/lib/perl5);
#use lib qw(/usr/local/perl/modules/lib/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib/perl5/5.8.8 /usr/local/perl/modules/lib64/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib64/perl5/5.8.8 /var/local/groundwork/perl/lib/site_perl/5.8.8/);
#use lib qw(/usr/local/perl/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/local/perl/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/local/perl/lib/perl5/5.8.8 /usr/local/perl/lib/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib/perl5/5.8.8 /usr/local/perl/modules/lib64/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib64/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/ /usr/lib/perl5/5.8.8);
use strict;
use WWW::Mechanize;
sub usage;
my $progname = $0;
usage unless @ARGV == 0;
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0', stack_depth => '1', noproxy => '1', quiet => '1', timeout => '20') or die ("Unable to instantiate WWW::Mechanize!\n");
my $url_ini = "http://kaltura.princeton.edu";
# Retrieve initial URL
$mech->get ($url_ini);
unless ($mech -> success() && $mech->title() && $mech->title() =~ m#Kaltura Video Platform - Home Page#) {
print "Failed to fetch \"$url_ini\". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
exit 2;
}
# Go to login link
$mech->follow_link (text => 'Kaltura Management Console (KMC)');
unless ($mech -> success() && $mech->title() =~ m#Kaltura - Open Source Video Platform#) {
print "Error going to the login page. Web server returned " . $mech->status() . "; " . $mech->title() . "\n";
exit 2;
}
print "Successfully accessed \"$url_ini\", and navigated to the login page.\n";
exit 0;
sub usage {
print "Usage: $progname\n";
exit 2;
}

@ -1,182 +0,0 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use lib qw(/usr/local/perl/lib/perl5);
use WWW::Mechanize;
$ENV{HTTPS_CA_DIR}='/etc/pki/tls/certs';
use Data::Dumper;
my %args;
sub sub_var {
my $var = shift (@_);
#print "####$var#####\n";
foreach (keys %args) {
my $argv = $args{$_};
$var =~ s#%%$_%%#$argv#g;
}
#print "NEW####$var#####\n";
return $var;
}
unless (@ARGV) {
print STDERR "The first argument should be the web script configuration file\n";
exit 3;
}
my $config_file = shift @ARGV;
unless (-f $config_file) {
print STDERR "Unable to locate or access configuration file \"$config_file\"\n";
exit 3;
}
my %exp;
my ($usage, $url);
my $stat = 0;
my $expect = 0;
open FL, "< $config_file" or do { print STDERR "Unable to open the configuration file \"$config_file\" for reading"; exit 3; };
my @fllines = <FL>;
close FL;
my @usg = grep (/^usage: /, @fllines);
$usage = $usg[0] =~ /^usage: (.*)/ && defined $1 ? $1 : "USAGE CHANGEME IN FILE";
my @arg = grep (/^arg: /, @fllines);
if (@arg) {
$arg[0] =~ s/^arg: //; chomp $arg[0];
my @argn = split (/\s*,\s*/, $arg[0]);
unless (@argn == @ARGV) { print STDERR "Usage: $0 $usage\n"; exit 3; }
foreach (@argn) {
my $argv = shift @ARGV;
$args{$_} = $argv;
}
}
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0', stack_depth => '1', noproxy => '1', quiet => '1', onerror => undef, onwarn => undef, timeout => '20') or do {
print STDERR "Unable to instantiate WWW::Mechanize!\n";
exit 3;
};
#$mech -> add_handler("request_send", sub { shift->dump; return });
#$mech -> add_handler("response_done", sub { shift->dump; return });
foreach (@fllines) {
next if /^\s*(|#.*)$/;
/^\s*;;\s*(|#.*)$/ and do {
if ($mech -> success()) {
$stat = 0;
} else {
$stat = exists $exp{'abort'} ? $exp{'abort'} : 3;
}
if (exists $exp{'title'}) {
if (defined $mech -> title() && $mech -> title() =~ m#$exp{'title'}#) {
$stat = 0;
} else {
$stat = $exp{'abort'} if exists $exp{'abort'};
}
}
if (exists $exp{'content_type'}) {
if (defined $mech -> ct() && $mech -> ct() =~ m#$exp{'content_type'}#) {
$stat = 0;
} else {
$stat = $exp{'abort'} if exists $exp{'abort'};
}
}
if (exists $exp{'exists'}) {
if (defined $mech -> response() -> decoded_content && $mech -> response() -> decoded_content =~ m#$exp{'exists'}#) {
$stat = 0;
} else {
$stat = $exp{'abort'} if exists $exp{'abort'};
}
}
#print Dumper (\%exp);
if ($stat) {
print "$exp{'error'}\n" if exists $exp{'error'};
} else {
print "$exp{'ok'}\n" if exists $exp{'ok'};
}
%exp = ();
$expect = 0;
next;
};
if ($expect) {
/^\s*(\S+)\s*=>\s*(.+)/ and do {
my ($fldk, $fldv) = ($1, $2);
my $m_stat = defined $mech -> status ? $mech -> status : 'not defined';
my $m_answer = defined $mech -> response() && defined $mech -> response() -> decoded_content ? $mech -> response() -> decoded_content : 'not defined';
my $m_title = defined $mech -> title() ? $mech -> title : 'not defined';
my $m_cururl = defined $mech -> uri -> as_string ? $mech -> uri -> as_string : 'not defined';
$fldv =~ s/%%url%%/$url/g;
$fldv =~ s/%%cururl%%/$m_cururl/g;
$fldv =~ s/%%code%%/$m_stat/g;
$fldv =~ s/%%answer%%/$m_answer/g;
$fldv =~ s/%%title%%/$m_title/g;
$exp{$fldk} = $fldv;
};
next;
}
/^GET:\s*(.*)/ and do {
$expect = 1;
$url = sub_var $1;
if ($url =~ m#%%\w+%%#) {
print "Unable to resolve all of the needed arguments in the URL";
exit 3;
}
$mech -> get ($url);
next;
};
/^POST:\s*(.*)$/ and do {
$expect = 1;
if ((not defined $1) || ($1 =~ /^\s*$/)) {
$mech -> submit();
next;
}
my @argpairs = split /\s*,\s*/;
my (%field_args, %submit_args);
foreach (@argpairs) {
/(\S+) => (.*)/ and do {
my ($fldk, $fldv) = ($1, $2);
if ($fldk eq 'button') {
$submit_args{'button'} = $fldv;
} else {
$fldk = sub_var $fldk;
$fldv = sub_var $fldv;
$field_args{$fldk} = $fldv;
}
};
}
#foreach (keys %field_args) {
# print $_, "###", $field_args{$_}, "\n";
#}
$mech -> submit_form (
with_fields => \%field_args,
%submit_args,
);
next;
};
}
exit $stat;

@ -1,85 +0,0 @@
#!/usr/bin/perl -w
#
# Check to login to http://www.princeton.edu/rms, and perform policy accessibility checks - ticket #1717662
#
# By Igor Gubenko (igubenko@Princeton.EDU), 12/15/2011
#
use lib qw(/usr/local/monitoring/perl/lib/perl5);
#use lib qw(/usr/local/perl/modules/lib/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib/perl5/5.8.8 /usr/local/perl/modules/lib64/perl5/site_perl/5.8.8 /usr/local/perl/modules/lib64/perl5/5.8.8 /var/local/groundwork/perl/lib/site_perl/5.8.8/);
use strict;
use WWW::Mechanize;
#use Net::SSL; # From Crypt-SSLeay
#use LWP::Protocol::https;
#BEGIN {
# $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL
# $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="IO::Socket::SSL";
#}
#$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#$ENV{HTTPS_VERSION} = 3;
sub usage;
my $progname = $0;
usage unless @ARGV == 2;
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0', stack_depth => '1', noproxy => '1', quiet => '1', onerror => undef, onwarn => undef, timeout => '20') or die ("Unable to instantiate WWW::Mechanize!\n");
my $url_ini = "http://www.princeton.edu/rms";
my ($user, $pass) = @ARGV;
# Retrieve initial URL - this is just a very silly bunch of redirects
$mech->get ($url_ini);
unless ($mech -> success() && defined $mech->title() && $mech->title() =~ m#LC SSO Request#) {
print "Failed to fetch \"$url_ini\". Answer: " . $mech->status() . "\n";
exit 2;
}
$url_ini = "https://rms.princeton.edu/edc/Login.do";
# Retrieve the actual website
$mech->get ($url_ini);
unless ($mech -> success() && $mech->title() =~ m#LiveCycle Rights Management#) {
print "Failed to fetch \"$url_ini\". Answer: " . $mech->status() . "\n";
exit 2;
}
# Login
$mech->submit_form (
fields => {
j_username => $user,
j_password => $pass,
}
);
unless ($mech -> success() && $mech->response()->decoded_content =~ m#Manage policies, policy sets#) {
print $mech->response()->decoded_content =~ m#Login failed# ? "Unable to login to Adobe Rights Management. Login failed\n" : 'Error after trying to login. Web server returned ' . $mech->status() . "\n";
exit 2;
}
# Click on Policies
$mech->follow_link (text => 'Policies');
unless ($mech -> success() && $mech->response()->decoded_content =~ m#Policy sets you have access to appear below#) {
print "Error clicking on \"Policies\". Web server returned " . $mech->status() . "\n";
exit 2;
}
# Click on Test Policy Set
$mech->follow_link (text => 'Test Policy Set');
unless ($mech -> success() && $mech->response()->decoded_content =~ m#Edit Policy Set: Test Policy Set#) {
print "Error navigating to \"Test Policy Set\". Web server returned " . $mech->status() . "\n";
exit 2;
}
print "Successfully logged in to \"$url_ini\", navigated to \"Policies\", and then \"Test Policy Set\".\n";
exit 0;
sub usage {
print "Usage: $progname <login_for_www.princeton.edu/rms> <password>\n";
exit 2;
}

@ -1,73 +0,0 @@
#!/usr/bin/perl -w
#
# Test CAS (fed's)
#
# By Igor Gubenko (igubenko@Princeton.EDU), 09/25/2013
#
use strict;
use lib qw(/usr/local/perl/lib/perl5/x86_64-linux-thread-multi /usr/local/perl/lib/perl5);
use WWW::Mechanize;
use Net::SSL; # From Crypt-SSLeay
use LWP::Protocol::https;
BEGIN {
$Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="IO::Socket::SSL";
}
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$ENV{HTTPS_VERSION} = 3;
sub usage;
my $progname = $0;
usage unless @ARGV == 3;
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0', stack_depth => '1', noproxy => '1', quiet => '1', onerror => undef, onwarn => undef, timeout => '20') or die ("Unable to instantiate WWW::Mechanize!\n");
#$mech->proxy (['http', 'https'], 'http://malka.princeton.edu:8888');
#$mech -> add_handler("request_send", sub { shift->dump; return });
#$mech -> add_handler("response_done", sub { shift->dump; return });
my ($URL, $user, $pass) = @ARGV;
$mech->get ($URL);
unless ($mech -> success() && $mech->title() =~ m#AdminCAS - Login#) {
print "Failed to fetch \"$URL\". Current URL: " . $mech->uri->as_string . ". Answer: " . $mech->status() . ";\n";
exit 2;
}
#my @tmp = $mech->find_all_inputs;
#foreach (@tmp) { print $_->type, "###", $_->name, "\n"; }
#exit 1;
# Login
$mech->submit_form (
with_fields => {
username => $user,
password => $pass,
},
image => '',
);
unless ($mech -> success() && $mech->title() =~ m#Admin CAS - Success#) {
print "Failed to login to CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "\n";
exit 2;
}
$mech->follow_link (text => 'logout');
unless ($mech -> success() && $mech->response()->decoded_content =~ m#You have been logged out#) {
print "Failed to sign out of CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
exit 1;
}
#print "\n#########################\n\n\n", $mech -> response() -> decoded_content, "\n";
print "Successfully accessed CAS, logged in and logged out\n";
exit 0;
sub usage {
print "Usage: $progname <URL> <login> <password>\n";
exit 2;
}

@ -1,93 +0,0 @@
#!/usr/local/monitoring/bin/python
import calendar, time, sys
sys.path.insert (1, '/usr/local/monitoring/princeton/lib')
from puselenium import init_selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions as EXCEP
from random import sample
if len (sys.argv) != 4:
print "Usage: %s <URL> <username> <password>" % sys.argv[0]
sys.exit (3)
url = sys.argv[1]
usr = sys.argv[2]
usrpass = sys.argv[3]
#ff = puselenium.init_selenium (['monitor'])
ff, fp = init_selenium ()
try:
#ff.implicitly_wait (10)
try:
ff.get (url)
WebDriverWait (ff, 10).until (EC.title_contains("Sign On"))
uid = ff.find_element_by_id ("userid")
uid.send_keys (usr)
uid.submit()
except:
print "Error retrieving the initial page with user ID entry"
sys.exit (2)
try:
WebDriverWait (ff, 10).until (EC.presence_of_element_located((By.ID, "Bharosa_Password_PadDataField")))
pupass = ff.find_element_by_id ("Bharosa_Password_PadDataField")
pupass.send_keys (usrpass)
pupass.submit()
except:
print "Error retrieving the password page with the password pad"
sys.exit (2)
try:
WebDriverWait (ff, 10).until (EC.presence_of_element_located((By.XPATH, "//a[text()='logout']")))
logout1 = ff.find_element_by_xpath ("//a[text()='logout']")
logout1.click()
except:
print "Error logging in or retrieving the page post login"
sys.exit (2)
try:
WebDriverWait (ff, 10).until (EC.presence_of_element_located((By.ID, "close")))
except:
print "Successfully logged in but couldn't get the expected logout page"
sys.exit (1)
time.sleep(2)
except EXCEP.ErrorInResponseException, (resp, msg):
print "ERROR: An error occured communicating with the browser server: Response: %s; Message: %s" % (resp, msg)
sys.exit (1)
except EXCEP.NoSuchElementException, msg:
print "ERROR: Unable to locate webpage element. Probably the page loaded incompletely or incorrectly: %s" % msg
sys.exit (1)
except EXCEP.TimeoutException, msg:
print "ERROR: Request timed out. Network??? Response: %s" % msg
sys.exit (1)
except EXCEP.WebDriverException, msg:
print "ERROR: I don't know what happened. Read this - %s" % msg
sys.exit (1)
finally:
ff.quit()
print "Successfully logged on to Admin CAS and logged off"
sys.exit (0)

@ -1,110 +0,0 @@
#!/usr/bin/perl -w
use lib qw(/usr/local/perl/lib/perl5 /usr/local/perl/lib/perl5/x86_64-linux-thread-multi);
use strict;
use WWW::Mechanize::Firefox;
use Capture::Tiny ':all';
sub ffquit;
sub waituntilappears;
my ($URL, $id, $pass) = @ARGV;
unless (@ARGV == 3) {
print "Usage: $0 <URL> <login> <password>\n";
exit 3;
}
#print "###$URL###$id###$pass##\n";
#exit 0;
$ENV{'DISPLAY'}=':1';
$ENV{'HOME'}='/home/nagios';
`/usr/bin/killall -9 firefox >/dev/null 2>&1`;
my ($stdout, $stderr, $mech) = capture {
WWW::Mechanize::Firefox->new(launch => 'firefox', create => 1, autoclose => 1, log => [ qw/ error / ]);
};
$mech -> autoclose_tab (0);
#print "####stdout:###$stdout###\n";
#print "####stderr:###$stderr###\n";
#print "####res:#####", @res, "###\n";
sleep 1;
$mech->get ($URL);
#my @tabs = $mech->application->openTabs();
#foreach (@tabs) {
#print "title:##", $_->{title}, "##location:##", $_->{location}, "##\n";
# $mech -> application -> closeTab ($_) if $_ -> {location} =~ m#blank#;
#}
if (waituntilappears '//input[@value="blackboardId"]') {
print "Failed to retrieve \"$URL\". Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
ffquit 2;
}
$mech->click ({xpath => '//input[@value="blackboardId"]', single => 'true', synchronize => 0});
if (waituntilappears '//form[@id="bbLoginForm"]') {
print "Failed to retrieve the Blackboard login form. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
ffquit 2;
}
$mech -> form_id ('bbLoginForm');
$mech -> set_fields (
user_id => $id,
password => $pass,
);
$mech -> click ({selector => '.btn'});
### TEMP
if (waituntilappears '//a[@title="Logout"]') {
print "Failed to login to Blackboard. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
ffquit 2;
}
my @logout = $mech -> xpath ('//a[@title="Logout"]');
unless ($mech -> success() && @logout > 0) {
##unless ($mech -> success()) {# && $mech->response()->decoded_content =~ m#Rover Account#) {
print "Failed to login to Blackboard. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
ffquit 2;
}
##sleep 2;
$mech -> follow_link ($logout[0]);
##$mech -> get ("https://blackboard.princeton.edu/webapps/login?action=logout");
if (waituntilappears '//input[@value="blackboardId"]') {
print "Failed to logout out of Blackboard. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . $mech->title() . "\n";
ffquit 2;
}
#$mech -> autoclose_tab(0);
print "Successfully logged in to Blackboard and logged out\n";
ffquit 0;
sub ffquit {
my $err = shift;
$mech -> application -> closeTab ($mech -> tab);
$mech -> application -> quit if $mech -> application -> openTabs < 2 || $mech -> application -> openTabs > 2;
sleep 2;
exit $err;
}
sub waituntilappears {
my $retries = 20;
my $fnd = shift;
while ($retries-- > 0) {
return 0 if $mech->is_visible (xpath => $fnd);
sleep 1;
}
return 1;
}

@ -1,73 +0,0 @@
#!/usr/local/monitoring/bin/python
import calendar, time, sys
sys.path.insert (1, '/usr/local/monitoring/princeton/lib')
from puseleniumnew import init_selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions as EXCEP
from random import sample
if len (sys.argv) != 4:
print "Usage: %s <URL> <username> <password>" % sys.argv[0]
sys.exit (3)
url = sys.argv[1]
usr = sys.argv[2]
usrpass = sys.argv[3]
ff, fp = init_selenium()
try:
ff.implicitly_wait (10)
ff.get (url)
bbid = ff.find_element_by_xpath ("//input[@type='radio'][@value='blackboardId']")
bbid.click()
loginid = ff.find_element_by_id ("user_id")
loginid.send_keys (usr)
loginpass = ff.find_element_by_id ("password")
loginpass.send_keys (usrpass)
continuebtn = ff.find_element_by_xpath ("//div[text()='Login']")
continuebtn.click()
logout = ff.find_element_by_xpath ("//a[@title='Logout']")
logout.click()
WebDriverWait (ff, 10).until (EC.element_to_be_clickable((By.XPATH, "//input[@type='radio'][@value='blackboardId']")))
time.sleep(5)
except EXCEP.ErrorInResponseException, (resp, msg):
print "ERROR: An error occured communicating with the browser server: Response: %s; Message: %s" % (resp, msg)
sys.exit (1)
except EXCEP.NoSuchElementException, msg:
print "ERROR: Unable to locate webpage element. Probably the page loaded incompletely or incorrectly: %s" % msg
sys.exit (1)
except EXCEP.TimeoutException, msg:
print "ERROR: Request timed out. Network??? Response: %s" % msg
sys.exit (1)
except EXCEP.WebDriverException, msg:
print "ERROR: I don't know what happened. Read this - %s" % msg
sys.exit (1)
finally:
ff.quit()
print "Successfully logged on to Blackboard and logged off"
sys.exit (0)

@ -1,73 +0,0 @@
#!/usr/bin/perl -w
#
# Test CAS (fed's)
#
# By Igor Gubenko (igubenko@Princeton.EDU), 09/25/2013
#
use strict;
use lib qw(/usr/local/perl/lib/perl5/x86_64-linux-thread-multi /usr/local/perl/lib/perl5);
use WWW::Mechanize;
#use Net::SSL; # From Crypt-SSLeay
#use LWP::Protocol::https;
#BEGIN {
# $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL
# $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="IO::Socket::SSL";
#}
#$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
#$ENV{HTTPS_VERSION} = 3;
sub usage;
my $progname = $0;
usage unless @ARGV == 3;
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0', stack_depth => '1', noproxy => '1', quiet => '1', onerror => undef, onwarn => undef, timeout => '20') or die ("Unable to instantiate WWW::Mechanize!\n");
#$mech->proxy (['http', 'https'], 'http://malka.princeton.edu:8888');
#$mech -> add_handler("request_send", sub { shift->dump; return });
#$mech -> add_handler("response_done", sub { shift->dump; return });
my ($URL, $user, $pass) = @ARGV;
$mech->get ($URL);
unless ($mech -> success() && $mech->title() =~ m#Princeton University Authentication Service#) {
print "Failed to fetch \"$URL\". Current URL: " . $mech->uri->as_string . ". Answer: " . $mech->status() . ";\n";
exit 2;
}
#my @tmp = $mech->find_all_inputs;
#foreach (@tmp) { print $_->type, "###", $_->name, "\n"; }
#exit 1;
# Login
$mech->submit_form (
with_fields => {
username => $user,
password => $pass,
},
image => '',
);
unless ($mech -> success() && $mech->title() =~ m#Princeton University Authentication Service - Success#) {
print "Failed to login to CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; \n";
exit 2;
}
$mech->follow_link (text => 'logout');
unless ($mech -> success() && $mech->response()->decoded_content =~ m#You have been logged out#) {
print "Failed to sign out of CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . ((defined $mech->title() ? $mech->title() : "" )) . "\n";
exit 1;
}
#print "\n#########################\n\n\n", $mech -> response() -> decoded_content, "\n";
print "Successfully accessed CAS, logged in and logged out\n";
exit 0;
sub usage {
print "Usage: $progname <URL> <login> <password>\n";
exit 2;
}

@ -1,75 +0,0 @@
#!/usr/bin/perl -w
#
# Test CAS (fed's)
#
# By Igor Gubenko (igubenko@Princeton.EDU), 09/25/2013
#
use strict;
use lib qw(/usr/local/perl/lib/perl5/x86_64-linux-thread-multi /usr/local/perl/lib/perl5);
use WWW::Mechanize;
use Net::SSL; # From Crypt-SSLeay
use LWP::Protocol::https;
BEGIN {
$Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="IO::Socket::SSL";
}
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$ENV{HTTPS_VERSION} = 3;
sub usage;
my $progname = $0;
usage unless @ARGV == 3;
my $mech = WWW::Mechanize->new (agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0', stack_depth => '1', noproxy => '1', quiet => '1', onerror => undef, onwarn => undef, timeout => '20') or die ("Unable to instantiate WWW::Mechanize!\n");
#$mech->proxy (['http', 'https'], 'http://malka.princeton.edu:8888');
#$mech -> add_handler("request_send", sub { shift->dump; return });
#$mech -> add_handler("response_done", sub { shift->dump; return });
my ($URL, $user, $pass) = @ARGV;
$mech->get ($URL);
unless ($mech -> success() && $mech->title() =~ m#Princeton University Authentication Service#) {
print "Failed to fetch \"$URL\". Current URL: " . $mech->uri->as_string . ". Answer: " . $mech->status() . ";\n";
exit 2;
}
#my @tmp = $mech->find_all_inputs;
#foreach (@tmp) { print $_->type, "###", $_->name, "\n"; }
#exit 1;
# Login
$mech->submit_form (
with_fields => {
username => $user,
password => $pass,
},
image => '',
);
unless ($mech -> success() && $mech->title() =~ m#Princeton University Authentication Service - Success#) {
print "Failed to login to CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; \n";
exit 2;
}
$URL =~ s#login#logout#;
#print "####$URL#####\n";
$mech->get ($URL);
#unless ($mech -> success() && $mech->response()->decoded_content =~ m#You have been logged out#) {
# print "Failed to sign out of CAS. Current URL: ". $mech->uri->as_string . ". Answer: " . $mech->status() . "; " . ((defined $mech->title() ? $mech->title() : "" )) . "\n";
# exit 1;
#}
#print "\n#########################\n\n\n", $mech -> response() -> decoded_content, "\n";
print "Successfully accessed CAS, logged in and logged out\n";
exit 0;
sub usage {
print "Usage: $progname <URL> <login> <password>\n";
exit 2;
}

@ -1,90 +0,0 @@
#!/usr/local/monitoring/bin/python
import calendar, time, sys
sys.path.insert (1, '/usr/local/monitoring/princeton/lib')
from puselenium import init_selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions as EXCEP
from random import sample
if len (sys.argv) != 4:
print "Usage: %s <URL> <username> <password>" % sys.argv[0]
sys.exit (3)
url = sys.argv[1]
usr = sys.argv[2]
usrpass = sys.argv[3]
#ff, fp = init_selenium (['mon202w'])
ff, fp = init_selenium()
try:
#ff.implicitly_wait (10)
try:
ff.get (url)
WebDriverWait (ff, 10).until (EC.title_contains("Central Authentication Service - CAS"))
WebDriverWait (ff, 10).until (EC.presence_of_element_located((By.NAME, "submit")))
uid = ff.find_element_by_id ("username")
uid.send_keys (usr)
pupass = ff.find_element_by_id ("password")
pupass.send_keys (usrpass)
submt = ff.find_element_by_name ("submit")
submt.click()
except:
print "Error retrieving the initial login page"
sys.exit (2)
try:
WebDriverWait (ff, 10).until (EC.presence_of_element_located((By.XPATH, "//a[text()='log out']")))
logout1 = ff.find_element_by_xpath ("//a[text()='log out']")
logout1.click()
except:
print "Error logging in, or retrieving the page post login"
sys.exit (2)
try:
WebDriverWait (ff, 10).until (EC.title_contains("Logout successful - CAS"))
except:
print "Successfully logged in, but couldn't log out"
sys.exit (1)
time.sleep(1)
except EXCEP.ErrorInResponseException, (resp, msg):
print "ERROR: An error occured communicating with the browser server: Response: %s; Message: %s" % (resp, msg)
sys.exit (1)
except EXCEP.NoSuchElementException, msg:
print "ERROR: Unable to locate webpage element. Probably the page loaded incompletely or incorrectly: %s" % msg
sys.exit (1)
except EXCEP.TimeoutException, msg:
print "ERROR: Request timed out. Network??? Response: %s" % msg
sys.exit (1)
except EXCEP.WebDriverException, msg:
print "ERROR: I don't know what happened. Read this - %s" % msg
sys.exit (1)
finally:
ff.quit()
print "Successfully logged on to CAS and logged off"
sys.exit (0)

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save