<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export><version>5.0</version><date>2021-11-21T22:01:38Z</date><groups><group><name>Templates/Applications</name></group></groups><templates><template><template>App Rocket Chat</template><name>App Rocket Chat</name><description>## Overview

**Zabbix Template Rocket Chat Statistics**
==========================================


Template using Zabbix for monitoring Rocket Chat Statistics via API.


**Versions**
------------


I tested this using zabbix 4.4.10 and Rocket Chat 3.5.0, but maybe it works with different versions. 


**Requirements**
----------------


Zabbix version &gt; 4.4 because template is using HTTP agent and JSON Path.


* If you need using it in late zabbix version, I recommend https://github.com/tristanlt/zabbix-rocketchat-stats


**Installation**
----------------


* Download Zabbix template
* Import the template on Zabbix
* Add a Rocket Chat user which contains permissions to view-statistics
* Create a rocketchat api keypair  

	+ Login user
	+ Profile -&gt; My Account -&gt; Personal Access Token
* Create a Personal Token  

	+ Save the ID and Token, you will need this
* Create host on Zabbix and apply the template  

	+ On host configuration, modify macros{$USERAPI\_ID} and {$USERAPI\_TOKEN} with the information you saved.


## Author

Felipe Vieira

</description><groups><group><name>Templates/Applications</name></group></groups><applications><application><name>Rocket Chat</name></application><application><name>Rocket Chat Messages</name></application><application><name>Rocket Chat OS</name></application><application><name>Rocket Chat Raw Data</name></application><application><name>Rocket Chat Users</name></application></applications><items><item><name>Rocket Chat Last Message Time ago</name><type>CALCULATED</type><key>calc.lastMessage.timeDiff</key><delay>2m</delay><history>14d</history><units>s</units><params>last(&quot;rocketchat-stats[updatedAt]&quot;) - last(&quot;rocketchat-stats[lastMessageSentAt]&quot;)</params><description>Time difference between update time and last message time.</description><applications><application><name>Rocket Chat Messages</name></application></applications></item><item><name>Rocket Chat Get Stats</name><type>HTTP_AGENT</type><key>rocketchat-stats</key><delay>2m</delay><history>14d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>Rocket Chat Raw Data</name></application></applications><timeout>10s</timeout><url>https://{HOST.CONN}/api/v1/statistics</url><query_fields><query_field><name>refresh</name><value>true</value></query_field></query_fields><headers><header><name>X-Auth-Token</name><value>{$USERAPI_TOKEN}</value></header><header><name>X-User-Id</name><value>{$USERAPI_ID}</value></header></headers><triggers><trigger><expression>{nodata(10m)}=1</expression><name>Rocket Chat: Failed to fetch statistics JSON (or no data for 10m)</name><url>{$ROCKETCHAT_URL}/../</url><priority>AVERAGE</priority></trigger></triggers></item><item><name>Rocket Chat Users - Away</name><type>DEPENDENT</type><key>rocketchat-stats[awayUsers]</key><delay>0</delay><history>14d</history><units>users</units><applications><application><name>Rocket Chat Users</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.awayUsers</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Last Message Time</name><type>DEPENDENT</type><key>rocketchat-stats[lastMessageSentAt]</key><delay>0</delay><history>14d</history><units>unixtime</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.lastMessageSentAt</params></step><step><type>JAVASCRIPT</type><params>var unixTime = parseInt((new Date(value).getTime() / 1000).toFixed(0));
return unixTime</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat Users - Offline</name><type>DEPENDENT</type><key>rocketchat-stats[offlineUsers]</key><delay>0</delay><history>14d</history><units>users</units><applications><application><name>Rocket Chat Users</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.offlineUsers</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Users - Online</name><type>DEPENDENT</type><key>rocketchat-stats[onlineUsers]</key><delay>0</delay><history>14d</history><units>users</units><applications><application><name>Rocket Chat Users</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.onlineUsers</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat OS Memory Free</name><type>DEPENDENT</type><key>rocketchat-stats[os.freemem]</key><delay>0</delay><history>14d</history><units>B</units><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.freemem</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat OS CPU Load 1 min</name><type>DEPENDENT</type><key>rocketchat-stats[os.load.1min]</key><delay>0</delay><history>14d</history><value_type>FLOAT</value_type><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.loadavg[0]</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat OS CPU Load 5 min</name><type>DEPENDENT</type><key>rocketchat-stats[os.load.5min]</key><delay>0</delay><history>14d</history><value_type>FLOAT</value_type><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.loadavg[1]</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat OS CPU Load 15 min</name><type>DEPENDENT</type><key>rocketchat-stats[os.load.15min]</key><delay>0</delay><history>14d</history><value_type>FLOAT</value_type><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.loadavg[2]</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat OS Memory Total</name><type>DEPENDENT</type><key>rocketchat-stats[os.totalmem]</key><delay>0</delay><history>14d</history><units>B</units><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.totalmem</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat OS Uptime</name><type>DEPENDENT</type><key>rocketchat-stats[os.uptime]</key><delay>0</delay><history>14d</history><units>uptime</units><applications><application><name>Rocket Chat OS</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.os.uptime</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat Channel - Messages</name><type>DEPENDENT</type><key>rocketchat-stats[totalChannelMessages]</key><delay>0</delay><history>14d</history><units>msg</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalChannelMessages</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Channel - Total</name><type>DEPENDENT</type><key>rocketchat-stats[totalChannels]</key><delay>0</delay><history>14d</history><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalChannels</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Direct - Messages</name><type>DEPENDENT</type><key>rocketchat-stats[totalDirectMessages]</key><delay>0</delay><history>14d</history><units>msg</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalDirectMessages</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Direct - Total</name><type>DEPENDENT</type><key>rocketchat-stats[totalDirect]</key><delay>0</delay><history>14d</history><units>msg</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalDirect</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Livechat - Messages</name><type>DEPENDENT</type><key>rocketchat-stats[totalLivechatMessages]</key><delay>0</delay><history>14d</history><units>msg</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalLivechatMessages</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Livechats - Total</name><type>DEPENDENT</type><key>rocketchat-stats[totalLivechat]</key><delay>0</delay><history>14d</history><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalLivechat</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Total Messages</name><type>DEPENDENT</type><key>rocketchat-stats[totalMessages]</key><delay>0</delay><history>14d</history><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalMessages</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Private Group - Messages</name><type>DEPENDENT</type><key>rocketchat-stats[totalPrivateGroupMessages]</key><delay>0</delay><history>14d</history><units>msg</units><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalPrivateGroupMessages</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Private Group - Total</name><type>DEPENDENT</type><key>rocketchat-stats[totalPrivateGroups]</key><delay>0</delay><history>14d</history><applications><application><name>Rocket Chat Messages</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalPrivateGroups</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method></item><item><name>Rocket Chat Users - Total</name><type>DEPENDENT</type><key>rocketchat-stats[totalUsers]</key><delay>0</delay><history>14d</history><units>users</units><applications><application><name>Rocket Chat Users</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.totalUsers</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat Last Update</name><type>DEPENDENT</type><key>rocketchat-stats[updatedAt]</key><delay>0</delay><history>14d</history><units>unixtime</units><applications><application><name>Rocket Chat</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$._updatedAt</params></step><step><type>JAVASCRIPT</type><params>var unixTime = parseInt((new Date(value).getTime() / 1000).toFixed(0));
return unixTime</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item></item><item><name>Rocket Chat Version</name><type>DEPENDENT</type><key>rocketchat-stats[version]</key><delay>0</delay><history>14d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>Rocket Chat</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.version</params></step></preprocessing><master_item><key>rocketchat-stats</key></master_item><request_method>POST</request_method><triggers><trigger><expression>{diff()}=1</expression><name>Rocket Chat: Version changed to {ITEM.VALUE}</name><url>{$ROCKETCHAT_URL}/../</url><priority>INFO</priority></trigger></triggers></item></items><macros><macro><macro>{$ROCKETCHAT_URL}</macro><value>https://rocket_chat.fqdn/api</value></macro><macro><macro>{$ROCKETCHAT_USERAPI_ID}</macro><value>ujjdjdhhhh7822232</value></macro><macro><macro>{$ROCKETCHAT_USERAPI_TOKEN}</macro><value>gf-PAT-l_W4jhddggdggsshdhdhdhkkkjfbbdbddt332</value></macro></macros><screens><screen><name>Rocket Chat Statistics</name><hsize>2</hsize><vsize>4</vsize><screen_items><screen_item><resourcetype>3</resourcetype><style>1</style><resource><key>rocketchat-stats[version]</key><host>App Rocket Chat</host></resource><width>500</width><height>100</height><x>0</x><y>0</y><colspan>1</colspan><rowspan>1</rowspan><elements>1</elements><valign>1</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>1</resourcetype><style>0</style><resource><key>calc.lastMessage.timeDiff</key><host>App Rocket Chat</host></resource><width>900</width><height>100</height><x>1</x><y>0</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat OS CPU Load</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>0</x><y>1</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat OS Memory</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>1</x><y>1</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat Messages</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>0</x><y>2</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat Exchanges</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>1</x><y>2</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat Total Messages</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>0</x><y>3</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item><screen_item><resourcetype>0</resourcetype><style>0</style><resource><name>Rocket Chat Users</name><host>App Rocket Chat</host></resource><width>900</width><height>300</height><x>1</x><y>3</y><colspan>1</colspan><rowspan>1</rowspan><elements>0</elements><valign>0</valign><halign>0</halign><dynamic>0</dynamic><sort_triggers>0</sort_triggers><url/><application/><max_columns>3</max_columns></screen_item></screen_items></screen></screens></template></templates><graphs><graph><name>Rocket Chat Exchanges</name><height>300</height><type>STACKED</type><graph_items><graph_item><color>BBBB00</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalPrivateGroups]</key></item></graph_item><graph_item><sortorder>1</sortorder><color>2774A4</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalLivechat]</key></item></graph_item><graph_item><sortorder>2</sortorder><color>F63100</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalChannels]</key></item></graph_item></graph_items></graph><graph><name>Rocket Chat Messages</name><type>STACKED</type><ymin_type_1>FIXED</ymin_type_1><graph_items><graph_item><color>BBBB00</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalPrivateGroupMessages]</key></item></graph_item><graph_item><sortorder>1</sortorder><color>2774A4</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalLivechatMessages]</key></item></graph_item><graph_item><sortorder>2</sortorder><color>F63100</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalDirectMessages]</key></item></graph_item></graph_items></graph><graph><name>Rocket Chat OS CPU Load</name><graph_items><graph_item><color>199C0D</color><item><host>App Rocket Chat</host><key>rocketchat-stats[os.load.1min]</key></item></graph_item><graph_item><sortorder>1</sortorder><color>F63100</color><item><host>App Rocket Chat</host><key>rocketchat-stats[os.load.5min]</key></item></graph_item><graph_item><sortorder>2</sortorder><color>2774A4</color><item><host>App Rocket Chat</host><key>rocketchat-stats[os.load.15min]</key></item></graph_item></graph_items></graph><graph><name>Rocket Chat OS Memory</name><ymin_type_1>FIXED</ymin_type_1><ymax_type_1>ITEM</ymax_type_1><ymax_item_1><host>App Rocket Chat</host><key>rocketchat-stats[os.totalmem]</key></ymax_item_1><graph_items><graph_item><drawtype>FILLED_REGION</drawtype><color>199C0D</color><item><host>App Rocket Chat</host><key>rocketchat-stats[os.freemem]</key></item></graph_item><graph_item><sortorder>1</sortorder><drawtype>GRADIENT_LINE</drawtype><color>F63100</color><item><host>App Rocket Chat</host><key>rocketchat-stats[os.totalmem]</key></item></graph_item></graph_items></graph><graph><name>Rocket Chat Total Messages</name><ymin_type_1>FIXED</ymin_type_1><graph_items><graph_item><drawtype>GRADIENT_LINE</drawtype><color>1A7C11</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[totalMessages]</key></item></graph_item></graph_items></graph><graph><name>Rocket Chat Users</name><height>300</height><type>STACKED</type><ymin_type_1>FIXED</ymin_type_1><graph_items><graph_item><color>303F9F</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[offlineUsers]</key></item></graph_item><graph_item><sortorder>1</sortorder><color>FFD54F</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[awayUsers]</key></item></graph_item><graph_item><sortorder>2</sortorder><color>66BB6A</color><calc_fnc>MAX</calc_fnc><item><host>App Rocket Chat</host><key>rocketchat-stats[onlineUsers]</key></item></graph_item></graph_items></graph></graphs></zabbix_export>
