Welcome to My iptv forum

  • Everyone is invited! My iptv forum is for everyone, new and advanced user alike!
  • Searching is key! Before you post a question, use the forum search feature to determine whether your topic has already been covered.
  • Do not start flame wars! If someone has engaged in behavior that is detrimental to the discussion -- spamming, harassment, etc -- report the post and we'll take a look.
  • Tutorial Install and configure grafana to plot beautiful graphs from zabbix

    Tutorial Install and configure grafana to plot beautiful graphs from zabbix
    RazRav Offline

    RazRav

    Living life @ 25 FPS
    Staff member
    Moderator
    Moderator
    VIP Member
    Apr 13, 2020
    616
    6,219
    93
    India
    Introduction
    Zabbix is a great monitoring tool that collects data from servers, virtual machines, and other kinds of network devices so you can analyze it for trends or problems. It has feature-rich notifications on emerging issues, but the built-in tools for data analysis and visualization are not easy to use. You can combine graphs into dashboards, but first you need to create them, and there is practically no easy way to create graphs that display real-time data. Also,to there is no way to collect data from different hosts onto a single graph. While the situation is getting better with each new release, it is far from ideal.

    Grafana is a good alternative to Zabbix’s dashboards. It lets you create graphs and dashboards based on data from various monitoring systems, and it specializes in the display and analysis of this data. It is lightweight, easy to install, and it looks beautiful.

    In this tutorial, you’ll install Grafana and configure it to display data from Zabbix, and you’ll learn how to compose your own custom dashboard that monitors CPU and file usage.

    ZABIXX Installation

    Step 1 — Installing Grafana
    Before we can use Grafana, we need to install it. We’ll use the same server we used for the Zabbix server. Log in to your Zabbix server with your non-root user:

    Code:
    Please, Log in or Register to view codes content!
    Grafana isn’t available through the package manager by default, so we will set up the repository configuration file. First, create a new repository file for Grafana:
    Code:
    Please, Log in or Register to view codes content!
    Paste the following configuration data into the file:
    Code:
    Please, Log in or Register to view codes content!
    Then save and exit the text editor and run the following command to install Grafana:
    Code:
    Please, Log in or Register to view codes content!
    During the installation process you will be asked to import a GPG key. Confirm that you wish to import this key so the installation can continue.

    Once the installation completes, start the Grafana service:
    Code:
    Please, Log in or Register to view codes content!
    Then check whether the Grafana service is running properly:
    Code:
    Please, Log in or Register to view codes content!
    You will see the following status:

    Output
    ● grafana-server.service - Starts and stops a single grafana instance on this system
    Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Mon 2016-11-07 06:18:27 UTC; 1 day 4h ago
    Docs:
    Please, Log in or Register to view URLs content!

    Main PID: 16639 (grafana-server)
    ...

    Finally, enable the service to start at boot time:
    Code:
    Please, Log in or Register to view codes content!
    Grafana is running, so let’s install the component that lets Grafana pull data from Zabbix.

    Step 2 — Installing the Zabbix Plugin for Grafana
    You can extend Grafana’s functionality by installing plugins. You can explore the available plugins
    Please, Log in or Register to view URLs content!
    . There are three types of plugins:

    • Panels: new blocks that can be used on the dashboard, such as pie charts or histograms.
    • Data sources: new storage backends for your time series data, so you can pull data from other sources.
    • Apps: complex plugins that bundle data sources and panels within a single package.
    We will use the Zabbix app plugin, which includes a Zabbix data source, a triggers panel, a Zabbix server dashboard, and a template to view data.

    The easiest way to install plugins is by using the CLI tool grafana-cli which is bundled with Grafana. Run the following command to install the Zabbix App plugin:
    Code:
    Please, Log in or Register to view codes content!
    You will see the following output, indicating that the plugin was installed:

    Output
    ✔ Installed alexanderzobnin-zabbix-app successfully

    Whenever you add or modify plugins, you must restart grafana-server for the changes to take effect.
    Code:
    Please, Log in or Register to view codes content!
    With the plugin installed, you can log in to Grafana and configure it to talk to Zabbix.

    Step 3 — Configuring the Zabbix Plugin
    Log in to the Grafana web interface by navigating to the address http://your_zabbix_server_ip_address:3000.

    Note: Grafana listens for incoming connections on port 3000. If you have a firewall configured, you’ll need to open this port. Review
    Please, Log in or Register to view URLs content!
    to learn about the firewall in CentOS if you run into issues.

    The default login credentials are admin/admin. You can change your password on the Profile page once you log in. When you log in, you’ll be greeted by the Home dashboard.

    Home dashboard


    Access Grafana’s main menu by clicking on the Grafana logo in the top left corner of the user interface. Then select Plugins. Then select the Apps tab. Then click on the Zabbix app and enable it by pressing the Enable button.

    Now you can add a new data source. Select the Grafana logo again and navigate to Data sources. Then click the Add data source button. You will see the configuration page for the data source:

    Add data source


    Configure the data source as follows:

    • Enter a name for this new data source in the Name field.
    • Check the Default option so this data source will be preselected in new panels you create.
    • Select Zabbix from the Type drop down list.
    • Fill in the Url field with the full path to the Zabbix API, which will be http://your_zabbix_server_ip_address/zabbix/api_jsonrpc.php.
    • Fill in the Username and Password fields with the username and password for Zabbix. The default username is admin and the default password is zabbix.
    • Enable the Trends option; it will increase Grafana’s performance when displaying long time periods.
    You can leave the other options at their default values.

    Click the Add button to test and save the configuration. You’ll see a success message that looks like the following:

    Successful test of the connection to Zabbix


    If you do not see this message, check your credentials and test again.

    Now let’s look at the Zabbix dashboard that came with the plugin. Select Zabbix server Dashboard from the dropdown list at the top of the screen. When you select it, the dashboard displays information about your Zabbix server:

    The Zabbix Server Dashboard


    This dashboard is pretty informative, but you can create your own custom dashboard from scratch.

    Step 4 — Creating a Custom Zabbix Dashboard
    Let’s create a dashboard for Zabbix that shows us CPU usage and file system information in real-time.

    Open the drop-down list on the top of the screen and click the Create New button. A new empty dashboard will be created.

    Each dashboard consists of rows which contain blocks. When you create a new dashboard, you automatically get one row. Click on the green menu on the left of the row to access the row’s action menu. Here you can add new panels, set the row’s height, move it, collapse it, or delete it.

    First we will create a graph that displays the CPU usage of our Zabbix server. Select the Add Panel item and then click Graph to insert a new graph into the row.

    You’ll be greeted with a form with several tabs, with the Metrics tab selected. Since we’ve set our Zabbix data source as the default, a new query was added for you. You just have to specify the following options:

    • Set Host Group to Zabbix servers.
    • Set Host to Zabbix server.
    • Set Application to CPU.
    • Set Item to Processor load (1 min average per core).
    You will see you current processor load on the graph.

    Graph metrics options


    Then navigate to the General tab and set the Title field to Processor load and set the Span option to 6. One row can contain up to 12 blocks, so setting this value to 6 makes the panel take up half of the screen.

    Graph general options


    Now you can click on Back to dashboard to see the result:

    Dashboard


    Note: If you don’t see any data, you may be zoomed out too far. Click the clock icon in the upper right of the interface and choose *Last 1 hour from the list of options.

    Let’s add another chart. To do this, you can repeat the previous steps or duplicate the existing graph. To duplicate the existing graph, select the panel title and click Duplicate. Then select the new graph’s title and select the Edit option. Then apply the following settings:

    • Change Title to CPU usage.
    • Select the Metrics tab and change the Item field to /CPU.*/.
    You can use Regular Expression patterns for host or metric names. Just be sure to wrap the pattern in forward slashes (/).

    You can also show summary statistics. Select the Legend tab and you’ll see some options and values you can select.

    • Under Options, check As table and To The right.
    • Under Values, select Min, Max, Avg, and Current.
    Now click Back to dashboard to see the result, which will look like this:

    Dashboard


    Next, add a Singlestat panel to show a single value for a particular metric. Create a new row by clicking Add row button and then select the row’s menu, choose Add panel, and select the Singlestat item.

    Set the Metrics options as follows:

    • Set Host Group to Zabbix servers.
    • Set Host to Zabbix server.
    • Set Application to Filesystems.
    • Set Item to Free disk space on / (percentage).
    Next, switch to the General tab and set the Title field to Free disk space on /.

    Then switch to the Options tab and configure these options:

    • Enable the Show option for Gauge.
    • Set Thresholds to 10,20. This will display these thresholds on the gauge.
    • Select the current option from the Value drop-down list.
    The gauge now looks like this:

    Gauge


    Return to the dashboard and press CTRL+S to save it.

    Now let’s test how this gauge responds to real-time events. To do so we will manually reduce free space on the disk and see what the dashboard displays.

    Log in to your Zabbix server if you’re not logged in currently:
    Code:
    Please, Log in or Register to view codes content!
    Once logged in, determine how much free space is available on the file system. You can do this with the df command:
    Code:
    Please, Log in or Register to view codes content!
    You will see the following output:

    Output
    Code:
    Please, Log in or Register to view codes content!
    In this case, there’s 18 GB of free space. The amount of free space on your server will vary. Reduce the free space on the root partition below the 20% threshold by using the fallocate command to create one big temporary file:
    Code:
    Please, Log in or Register to view codes content!
    Set the file size depending on the amount of free space on your server.

    Then give Zabbix a couple of minutes to update its data. Refresh the dashboard and you’ll see that the gauge changed its color to reflect the free space issue:

    Warning


    Finally, let’s show active Zabbix triggers on the dashboard. Create a new row and then select the row’s menu, select Add panel, and choose the Zabbix Triggers item.

    You will see the active trigger notifying you about the lack of free space on the server.

    Free space trigger


    Select Back to dashboard and save the dashboard with CTRL+S. Your dashboard will now look like this:

    The completed dashboard


    You can now use this simple dashboard to get a quick look at the current state of your server.

    Don’t forget to remove the temporary file you created to free up space on your disk. On your Zabbix server, issue the command:
    Code:
    Please, Log in or Register to view codes content!
    This will remove the test.img file. In a few minutes, the dashboard will update again to reflect the changes on the file system.
     
    Relate Threads

    Create an account or login to comment

    You must be a member in order to leave a comment

    Create account

    Create an account on our community. It's easy!

    Log in

    Already have an account? Log in here.

    Top Posters of the Month

    Latest resources

    Online statistics

    Members online
    85
    Guests online
    584
    Total visitors
    669
    18,334Threads
    64,168Messages
    62,986Members
    Pepe88Latest member
    Top