{"id":47,"date":"2019-05-29T04:04:48","date_gmt":"2019-05-29T04:04:48","guid":{"rendered":"http:\/\/edcint.co.nz\/checkwmiplus\/?page_id=47"},"modified":"2023-08-22T12:32:31","modified_gmt":"2023-08-22T02:32:31","slug":"nagios-service-definitions","status":"publish","type":"page","link":"https:\/\/edcint.co.nz\/checkwmiplus\/documentation\/nagios-service-definitions\/","title":{"rendered":"Nagios Service Definitions"},"content":{"rendered":"<div class=\"node-content\">\n<div class=\"field field-name-body field-type-text-with-summary field-label-hidden view-mode-full\">\n<div class=\"field-items\">\n<div class=\"field-item even\">\n<p>Some sample Nagios Service definitions that access the majority of the check_wmi_plus features.<br \/>\nThis is a straight cut and paste from my own Nagios configuration.<br \/>\nThere are 2 main parts<br \/>\n1) General Windows checks that should run against most Windows machines<br \/>\n2) Checks that are more dependent on the applications installed or the server roles configured<\/p>\n<p><cite>Note: The check for &#8220;Services &#8211; Print Spooler&#8221; includes an example use of the generic event handler script to restart the service. It uses the command &#8220;event_restart_win_service&#8221; which is defined at the bottom of <a href=\"https:\/\/edcint.co.nz\/checkwmiplus\/documentation\/nagios-command-definitions\/\">this page<\/a>.<\/cite><\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212; SERVICE TEMPLATES &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\ndefine service {<br \/>\nname windows_service<br \/>\nhostgroup_name primary_windows<br \/>\nis_volatile 0<br \/>\nmax_check_attempts 3<br \/>\nnormal_check_interval 5<br \/>\nretry_check_interval 1<br \/>\nactive_checks_enabled 1<br \/>\npassive_checks_enabled 1<br \/>\ncheck_period 24&#215;7<br \/>\nparallelize_check 1<br \/>\nobsess_over_service 1<br \/>\ncheck_freshness 0<br \/>\nevent_handler_enabled 1<br \/>\nflap_detection_enabled 1<br \/>\nretain_status_information 1<br \/>\nretain_nonstatus_information 1<br \/>\ncontact_groups windows_admin<br \/>\nnotification_interval 1440<br \/>\nnotification_period 24&#215;7<br \/>\nnotification_options w,u,c,r,f<br \/>\nnotifications_enabled 1<br \/>\naction_url \/pnp4nagios\/graph?host=$HOSTNAME$&amp;srv=$SERVICEDESC$<br \/>\nprocess_perf_data 1<br \/>\nregister 0 ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL SERVICE, JUST A TEMPLATE!<br \/>\n}<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212; SERVICE TEMPLATES &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description PING<br \/>\ncheck_command check_ping!100.0,20%!200.0,60%<br \/>\n}<\/p>\n<p># &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; services using WMI directly<\/p>\n<p># example Windows service check with an event handler to restart the service<br \/>\ndefine service {<br \/>\nuse windows_service<br \/>\nservice_description Services &#8211; Print Spooler<br \/>\ncheck_command check_win_service!spooler!!-c _NumGood=1:1<br \/>\nevent_handler event_restart_win_service!spooler<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process &#8211; Quote Tracker<br \/>\ncheck_command check_win_process!stocks.exe!!1:1!1:1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process &#8211; HP ToolBox<br \/>\ncheck_command check_win_process!hptlbxfx.exe!!1:1!1:1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process &#8211; svchost<br \/>\ncheck_command check_win_process!svchost.exe!!1:10!1:20<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description IO C:<br \/>\ncheck_command check_win_io!logical!C:<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Disk Space &#8211; All<br \/>\ncheck_command check_win_disk!.!80!90!-o 1 -3 1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Event Log Application Warnings<br \/>\ncheck_command check_win_eventlog!application!2!1!50!100<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Event Log System Warnings<br \/>\ncheck_command check_win_eventlog!system!2!1!50!100<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Time Check<br \/>\ncheck_command check_win_time!-10:10!-30:30<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Uptime<br \/>\ncheck_command check_win_uptime!5min:!15min:<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description RAM Utilisation<br \/>\ncheck_command check_win_mem!90!95<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Page File Utilisation<br \/>\ncheck_command check_win_page!-a auto<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Network Interface LAN2<br \/>\ncheck_command check_win_network!LAN2<br \/>\n}<\/p>\n<p>#define service {<br \/>\n# use windows_service<br \/>\n# service_description Network Interface LAN0<br \/>\n# check_command check_win_network!LAN0<br \/>\n# }<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Print Spooler Totals<br \/>\ncheck_command check_win_print!spooler!-a _Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description CPU Utilisation<br \/>\ncheck_command check_win_cpu!80!90<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description CPU Utilisation Detail<br \/>\ncheck_command check_win_cpudetail!80!90<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description CPU Queue Length<br \/>\ncheck_command check_win_cpuq!10!20!-a 20 -y 0<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Services &#8211; All<br \/>\ncheck_command check_win_service!Auto!!-w 0 -c 1<br \/>\n# add a restart of the wmi service if it contains the text that says a restart should fix it<br \/>\nevent_handler event_restart_win_service!winmgmt!-r!Restarting the WMI service can fix it<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Services &#8211; DHCP Client<br \/>\ncheck_command check_win_service!dhcp client!!-c _NumGood=1:1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description File Size &#8211; Page File<br \/>\ncheck_command check_win_filesize!c:\/pagefile.sys!1500m!2g<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description File Age &#8211; All Users ntuser.dat<br \/>\ncheck_command check_win_fileage!c:\/documents and settings\/all users\/ntuser.dat!1wk:!2wk:<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description File Age &#8211; Page File<br \/>\ncheck_command check_win_fileage!c:\/pagefile.sys!10min:!30min:<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description TS Sessions 2003<br \/>\ncheck_command check_ts!sessions2003<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description TS Console Session Info<br \/>\ncheck_command check_ts!sessioninfo!-a console<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process Memory SVCHOST<br \/>\ncheck_command check_win_proc!memorytotals!svchost%<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process Count<br \/>\ncheck_command check_win_proc!count!%<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process High CPU<br \/>\ncheck_command check_win_proc!cpuabove!%!-w 25!-exc _AvgCPU=@0:2!&#8211;nodataexit 0!&#8211;nodatastring &#8220;No processes with high CPU found&#8221;<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Process CPU Firefox<br \/>\ncheck_command check_win_proc!cpu!firefox!&#8211;nodatamode<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Info &#8211; Net<br \/>\ncheck_command check_wmi_plus!info!net<br \/>\nprocess_perf_data 0<br \/>\naction_url<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Info &#8211; OS Version<br \/>\ncheck_command check_wmi_plus!info!os<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Test 1<br \/>\ncheck_command check_wmi_plus!test!1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_service<br \/>\nservice_description Test 2<br \/>\ncheck_command check_wmi_plus!test!2<br \/>\n}<\/p>\n<p>#==================================================================================<br \/>\n#==================================================================================<br \/>\n#================== OTHER CHECKS THAT ARE MORE APPLICATION SPECIFIC ==================<br \/>\n#==================================================================================<br \/>\n#==================================================================================<\/p>\n<p>#&#8212;&#8212;&#8212;&#8212;&#8212; SERVICE TEMPLATES &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\ndefine service {<br \/>\nname windows_extra_service<br \/>\nuse windows_service<br \/>\nhostgroup_name secondary_windows<br \/>\nmax_check_attempts 10<br \/>\nnormal_check_interval 1<br \/>\nretry_check_interval 1<br \/>\nregister 0 ; DONT REGISTER THIS DEFINITION &#8211; ITS NOT A REAL SERVICE, JUST A TEMPLATE!<br \/>\n}<br \/>\n#&#8212;&#8212;&#8212;&#8212;&#8212; SERVICE TEMPLATES &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SMART Status<br \/>\ncheck_command check_win_smart!-c 1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Volume Space &#8211; All<br \/>\ncheck_command check_win_volume!.!80!90!-o 1 -3 1<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Power Supplies<br \/>\ncheck_command check_win_power!state!-a &#8220;%&#8221;<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description File Age &#8211; winhelp<br \/>\ncheck_command check_win_fileage!c:\/windows\/winhelp.exe!4wk!8wk<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Network Interface<br \/>\ncheck_command check_win_network!Intel[R] PRO_1000 MT Network Connection<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description IIS Users<br \/>\ncheck_command check_iis!users!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description IIS Requests<br \/>\ncheck_command check_iis!requests!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description IIS Errors<br \/>\ncheck_command check_iis!errors!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description IIS Transfers<br \/>\ncheck_command check_iis!transfers!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description IIS Connections<br \/>\ncheck_command check_iis!connections!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DNS Stats<br \/>\ncheck_command check_win_dns!stats<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DNS A Records<br \/>\ncheck_command check_win_dns!arecords!&#8211;nodatamode<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DNS CNAME Records<br \/>\ncheck_command check_win_dns!cnamerecords!&#8211;nodatamode<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DNS PTR Records<br \/>\ncheck_command check_win_dns!ptrrecords!&#8211;nodatamode<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DHCP Stats<br \/>\ncheck_command check_win_dhcp!stats<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description DHCPv6 Stats<br \/>\ncheck_command check_win_dhcpv6!stats<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description TS Sessions<br \/>\ncheck_command check_ts!sessions<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange listDBInstances<br \/>\ncheck_command check_exchange!listDBInstances<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange listSmtpSendTransports<br \/>\ncheck_command check_exchange!listSmtpSendTransports<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange listSmtpReceiveTransports<br \/>\ncheck_command check_exchange!listSmtpReceiveTransports<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange HubTransportServer<br \/>\ncheck_command check_exchange!HubTransportServer<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange TransportQueues<br \/>\ncheck_command check_exchange!TransportQueues<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange DB Instance _Total<br \/>\ncheck_command check_exchange!DBInstances!&#8221;%_Total&#8221;<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange SmtpReceive<br \/>\ncheck_command check_exchange!SmtpReceive!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Exchange SmtpSend<br \/>\ncheck_command check_exchange!SmtpSend!_Total<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Buffer Manager<br \/>\ncheck_command check_sql!buffermanager!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express General Stats<br \/>\ncheck_command check_sql!general!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Latch Stats<br \/>\ncheck_command check_sql!latches!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Total Lock Stats<br \/>\ncheck_command check_sql!locks!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS!default<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express SQL Stats<br \/>\ncheck_command check_sql!sqlstats!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Wait Stats<br \/>\ncheck_command check_sql!waits!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Memory Stats<br \/>\ncheck_command check_sql!memory!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description SQL Express Total Cache Stats<br \/>\ncheck_command check_sql!cache!MSSQLSQLEXPRESS_MSSQLSQLEXPRESS!default<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description Total User Count<br \/>\ncheck_command check_win_users!count!-a &#8220;status like &#8216;%'&#8221;<br \/>\n}<\/p>\n<p>define service {<br \/>\nuse windows_extra_service<br \/>\nservice_description AD Replication<br \/>\ncheck_command check_ad!replication!-w 0!&#8211;nodatamode<br \/>\n}<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Some sample Nagios Service definitions that access the majority of the check_wmi_plus features. This is a straight cut and paste from my own Nagios configuration.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":37,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-47","page","type-page","status-publish","hentry","category-documentation"],"_links":{"self":[{"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/pages\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":3,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/pages\/47\/revisions"}],"predecessor-version":[{"id":989,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/pages\/47\/revisions\/989"}],"up":[{"embeddable":true,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/pages\/37"}],"wp:attachment":[{"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edcint.co.nz\/checkwmiplus\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}