Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # get_services.ps1
- #
- ################################################################################
- $services = Get-Service | select name
- Write-Host "{"
- Write-Host " `"data`":[`n"
- ForEach($s in $services) {
- $line= "{ `"{#SERVICE}`" : `"" + $s.Name + "`" }"
- Write-Host $line
- }
- Write-Host
- Write-Host " ]"
- Write-Host "}"
- ################################################################################
- # get_servicestate.ps1
- #
- ################################################################################
- Param ([String] $name = 0)
- $service = Get-Service -Name $name
- Write-Host $service.Status
- ### Option: UserParameter
- # User-defined parameter to monitor. There can be several user-defined parameters.
- # Format: UserParameter=<key>,<shell command>
- #
- # Mandatory: no
- # Default:
- # UserParameter=
- UserParameter=org.service.discovery,powershell -NoProfile -ExecutionPolicy Bypass -File "S:ZabbixtemplatesZabbix_Services_monitoringget_services.ps1"
- UserParameter=org.service.state[*],powershell -NoProfile -ExecutionPolicy Bypass -File S:ZabbixtemplatesZabbix_Services_monitoringget_servicestate.ps1 "$1"
- <?xml version="1.0" encoding="UTF-8"?>
- <zabbix_export>
- <version>3.0</version>
- <date>2017-11-20T16:44:57Z</date>
- <groups>
- <group>
- <name>
- Templates
- </name>
- </group>
- </groups>
- <templates>
- <template>
- <template>Template Microsoft Services</template>
- <name>Template Microsoft Services</name>
- <description/>
- <groups>
- <group>
- <name>
- Templates
- </name>
- </group>
- </groups>
- <applications>
- <application>
- <name>Windows Services</name>
- </application>
- </applications>
- <items/>
- <discovery_rules>
- <discovery_rule>
- <name>Windows Service</name>
- <type>0</type>
- <snmp_community/>
- <snmp_oid/>
- <key>org.service.discovery</key>
- <delay>30</delay>
- <status>1</status>
- <allowed_hosts/>
- <snmpv3_contextname/>
- <snmpv3_securityname/>
- <snmpv3_securitylevel>0</snmpv3_securitylevel>
- <snmpv3_authprotocol>0</snmpv3_authprotocol>
- <snmpv3_authpassphrase/>
- <snmpv3_privprotocol>0</snmpv3_privprotocol>
- <snmpv3_privpassphrase/>
- <delay_flex/>
- <params/>
- <ipmi_sensor/>
- <authtype>0</authtype>
- <username/>
- <password/>
- <publickey/>
- <privatekey/>
- <port/>
- <filter>
- <evaltype>0</evaltype>
- <formula/>
- <conditions/>
- </filter>
- <lifetime>30</lifetime>
- <description/>
- <item_prototypes>
- <item_prototype>
- <name>Windows Service {#SERVICE}</name>
- <type>0</type>
- <snmp_community/>
- <multiplier>0</multiplier>
- <snmp_oid/>
- <key>org.service.state[{#SERVICE}]</key>
- <delay>30</delay>
- <history>90</history>
- <trends>0</trends>
- <status>0</status>
- <value_type>4</value_type>
- <allowed_hosts/>
- <units/>
- <delta>0</delta>
- <snmpv3_contextname/>
- <snmpv3_securityname/>
- <snmpv3_securitylevel>0</snmpv3_securitylevel>
- <snmpv3_authprotocol>0</snmpv3_authprotocol>
- <snmpv3_authpassphrase/>
- <snmpv3_privprotocol>0</snmpv3_privprotocol>
- <snmpv3_privpassphrase/>
- <formula>1</formula>
- <delay_flex/>
- <params/>
- <ipmi_sensor/>
- <data_type>0</data_type>
- <authtype>0</authtype>
- <username/>
- <password/>
- <publickey/>
- <privatekey/>
- <port/>
- <description/>
- <inventory_link>0</inventory_link>
- <applications>
- <application>
- <name>Windows Services</name>
- </application>
- </applications>
- <valuemap/>
- <logtimefmt/>
- <application_prototypes/>
- </item_prototype>
- </item_prototypes>
- <trigger_prototypes>
- <trigger_prototype>
- <expression>{Template Microsoft Services:org.service.state[{#SERVICE}].str(Stopped)}<>0</expression>
- <name>Windows Service {#SERVICE} is down</name>
- <url/>
- <status>0</status>
- <priority>4</priority>
- <description/>
- <type>0</type>
- <dependencies/>
- </trigger_prototype>
- </trigger_prototypes>
- <graph_prototypes/>
- <host_prototypes/>
- </discovery_rule>
- </discovery_rules>
- <macros/>
- <templates/>
- <screens/>
- </template>
- </templates>
- </zabbix_export>
Add Comment
Please, Sign In to add comment