Newer
Older
nextcloud-monitoring-dashboard / zabbix-agent-scripts / discover_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 warnings

import sys

import json

warnings.filterwarnings("ignore")

norm_user_agents = json.load(open("/var/lib/zabbix/output/apache2_user_agent_metrics.json"))

norm_user_agent_list = []

for norm_user_agent in norm_user_agents.keys():

    norm_user_agent_list.append(
                                {"{#NORM_USER_AGENT}":norm_user_agent}
                               )


print(
        json.dumps(norm_user_agent_list)
     )