Newer
Older
nextcloud-monitoring-dashboard / zabbix-agent-scripts / read_apache2_user_agent_metrics.py
#
# @copyright Copyright (c) 2024, Pietro Marini (pmarini@rcasys.com)
#
# @license GNU AGPL version 3 or any later version
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import json

import sys

user_agent = sys.argv[1]


user_agent_values = json.load(open("/var/lib/zabbix/output/apache2_user_agent_metrics.json","r"))

if user_agent in user_agent_values.keys():
        print(user_agent_values[user_agent])
else:
        print(0)