# Installing munin & configuring apache.



## Alain De Vos (Jul 16, 2021)

I tried to install munin & configure apache. But it just didn't work for me. You need to fine-tune apache.
If it works for someone i'm interested.


----------



## SirDice (Jul 16, 2021)

What exactly is the problem you're having? "It doesn't work for me" doesn't provide much to go on.


----------



## Alain De Vos (Jul 16, 2021)

It does not work for me means i tried different things and received different errors so I was unable to specify them.

But this is the guide for linux.


			Apache CGI Configuration — Munin 2.999.10-detached-2018-12-16-c13-g47debb5 documentation
		

I must make little small changes to this file, but the correct ones.
And then i must enable some form of cgi.


----------



## Phishfry (Jul 16, 2021)

Do you absolutly need Apache? Munin uses rrd which is really ideal.
I used lightttpd for the web server.

I guess for the live charts you might need it and CGI.


----------



## Phishfry (Jul 16, 2021)

If you look at the instructions from Munin.org they give a basic setup.
Have you tried to get a static Munin setup running.
That is where you should start.
Then worry about Apache, CGI and sparks and fireworks.
Basic Munin charts are very nice.


----------



## SirDice (Jul 16, 2021)

Alain De Vos said:


> But this is the guide for linux.
> Apache CGI Configuration — Munin 2.999.10-detached-2018-12-16-c13-g47debb5 documentation  I must make little small changes to this file, but the correct ones.


Looks pretty straight-forward. Just look at the files it installs `pkg info -l munin-master`. If I just look at the pkg-plist it's pretty easy to 'translate' those Linux based directories to the ones the FreeBSD package/port installs.


```
/etc/munin/static -> /usr/local/etc/munin/static/
/usr/lib/munin/cgi/munin-cgi-graph -> /usr/local/www/cgi-bin/munin-cgi-graph
/usr/lib/munin/cgi/munin-cgi-html -> /usr/local/www/cgi-bin/munin-cgi-html
/usr/lib/munin/cgi -> /usr/local/www/cgi-bin
/var/www -> /usr/local/www/munin
```


----------



## Phishfry (Jul 16, 2021)

I will post my basic setup if you want. Nothing fancy. Munin installs rrd.
`pkg install munin-master munin-node munin-contrib`

```
## /usr/local/etc/lighttpd/lighttpd.conf
##
var.log_root    = "/var/log/lighttpd"
var.server_root = "/usr/local/www/munin"
var.state_dir   = "/run"
var.home_dir    = "/var/run/lighttpd"
var.conf_dir    = "/usr/local/etc/lighttpd"

var.vhosts_dir  = server_root + "/vhosts"
var.cache_dir   = "/var/cache/lighttpd"
var.socket_dir  = home_dir + "/sockets"
include "modules.conf"
server.port = 80
server.username  = "www"
server.groupname = "www"
server.document-root = "/usr/local/www" + "/munin"
server.errorlog             = log_root + "/error.log"
include "conf.d/access_log.conf"
include "conf.d/debug.conf"
server.network-backend = "writev"
server.max-fds = 2048
server.stat-cache-engine = "simple"
server.max-connections = 1024
index-file.names += ("index.xhtml", "index.html", "index.htm", "default.htm", "index.php")
url.access-deny  = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
include "conf.d/mime.conf"
include "conf.d/dirlisting.conf"
# IPv4 listening socket
$SERVER["socket"] == "0.0.0.0:80" { }
```


----------



## Phishfry (Jul 16, 2021)

/usr/local/etc/munin/munin.conf

```
includedir /usr/local/etc/munin/munin-conf.d
graph_strategy cron
html_strategy cron
# a simple host tree
[Munin-APU1]
    address 127.0.0.1
    use_node_name yes

[8470p]
    address 192.168.1.100
    use_node_name yes

[E6420]
    address 192.168.1.111
    use_node_name yes

[debian]
    address 192.168.1.123
    use_node_name yes
```


----------



## Phishfry (Jul 16, 2021)

Host monitoring node. /usr/local/etc/munin/munin-node.conf

```
# Example config-file for munin-node
#
log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid

background 1
setsid 1

user root
group wheel
# Regexps for files to ignore
ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$
ignore_file \.sample$

allow ^127\.0\.0\.1$
allow ^::1$

# Which address to bind to;
host *
# host 127.0.0.1

# And which port
port 4949
```


----------



## Alain De Vos (Jul 16, 2021)

Manually running,
/usr/local/www/cgi-bin/munin-cgi-html
bails out with :
2021/07/16 20:47:49 [FATAL] munin_readconfig_part(datafile) - missing file
Note, I compiled everything with

```
DEFAULT_VERSIONS+=perl=5.32
DEFAULT_VERSIONS+=perl5=5.32
```

Placing a file

```
#!/usr/local/bin/perl
print "Content-Type: text/html\n\n";
print ("<h1>Perl is working!</h1>");
```
in /usr/local/www/cgi-bin/ renders fine.


----------



## Alain De Vos (Jul 16, 2021)

Phishfry said:


> I will post my basic setup if you want. Nothing fancy. Munin installs rrd.
> `pkg install munin-master munin-node munin-contrib`
> 
> ```
> ...


Thanks for the info , but it differs alot from this one,



			lighttpd configuration — Munin 2.0.44  documentation


----------



## Alain De Vos (Jul 16, 2021)

If the maintainer of munin would include a configuration file specificlyf or lighttp,nginx,apache it would be easier.
I tried the sources from the github repo. But ended in a perl hell.
I trow the handdoek in the ring, it's time to test cacti which has more or less same functionality


----------



## Alain De Vos (Jul 17, 2021)

.


----------



## Alain De Vos (Apr 23, 2022)

I found the hard way munin and nagios requires perl version < 5.34
And zabbix needs php < 80


----------



## diizzy (Apr 23, 2022)

Another option might be netdata depending on your needs, which works out of the box (you may need to change IP address in the netdata's config file)





						FreshPorts -- net-mgmt/netdata: Scalable distributed realtime performance and health monitoring
					

Netdata is scalable distributed realtime performance & health monitoring system netdata collects and visualizes metrics. If it is a number and it can be collected somehow, netdata can visualize it. Out of the box, it comes with plugins that collect hundreds of system metrics and metrics of...




					www.freshports.org


----------



## SirDice (Apr 25, 2022)

Alain De Vos said:


> And zabbix needs php < 80


net-mgmt/zabbix6-frontend builds with PHP 7.4 even if you set the default to some other PHP version. If you use packages make sure to install zabbix6-frontend-php74, so you get the PHP 7.4 'flavor'.

The Zabbix frontend doesn't support PHP 8.0 (or higher) just yet. It is being worked on though: https://support.zabbix.com/browse/ZBXNEXT-7080

Also watch out for net-mgmt/zabbix6-server, it depends on MySQL 8.0, regardless of what default mysql version you have set. The reason for this is that Zabbix 6 requires MySQL 8.0. Zabbix 6 does also support MariaDB 10.5/10.6 but because of the way the port has been altered it's now configured to _always_ depend on MySQL 8.0. As far as I know the maintainer is aware of this and is trying to add MariaDB support back to the port.


----------



## Alain De Vos (Apr 25, 2022)

cacti+mariadb106+php74 , without linprocfs works fine.
Now trying zabbix54,munin,nagios


----------



## SirDice (Apr 25, 2022)

The net-mgmt/zabbix54-frontend should be set to PHP 7.4 too, just like the 6 frontend.


----------



## Alain De Vos (Apr 25, 2022)

Phishfry said:


> Host monitoring node. /usr/local/etc/munin/munin-node.conf
> 
> ```
> # Example config-file for munin-node
> ...


Is this for munin version 2.0.69 ?
Munin is failing for me big time.
Maybe someone should edit "pkg info -D minun..." to ease the pain?


----------



## Phishfry (Apr 25, 2022)

I am running quarterly packages on this machine.

munin-node-2.0.69
lighttpd-1.4.64_1
perl5-5.32.1_1
python38-3.8.13

Can you get the Munin webpage to show up?
Focus on munin-master and munin-node.
Use the configs files from above.

Follow this very important `pkg` message to activate plugins.

```
If this is a fresh install run
/usr/local/sbin/munin-node-configure --shell | sh -x
to install the plugins automatically.
```
Let this run until complete.

Now get your munin-node running: `service start munin-node`

Get your webserver up and running the Munin homepage.

Check your munin-node to make sure it is up.
`telnet localhost 4949`
`list`
`config cpu`
Check to make sure you have plugins working:`munin-node-configure`

Once you get this far you can work on extras with munin-contrib.
Then rescan your plugins.
Get your system plugins working first.









						Munin on FreeBSD
					

Using Munin you can easily monitor the performance of your computers, networks, SANs, applications, weather measurements and whatever comes to mind. System statistics can help you fine tune a syste…




					artinground.wordpress.com
				








						Monitor Different Systems with Munin | Karim's Blog
					






					elatov.github.io


----------



## Alain De Vos (Apr 27, 2022)

I tried nagios and i failed at configuring webserver.
Gone retry munin.


----------



## Alain De Vos (Apr 27, 2022)

Phishry i tried but it did not worked.
/ : gives 403 forbidden
/munin : gives 404 not found

```
lighttpd-1.4.64_1              Secure, fast, compliant, and flexible Web Server
munin-common-2.0.69            Common components between a munin node and server
munin-contrib-g.2021.04.27     Contributed plugins and other for munin
munin-master-2.0.69            Collector part of Munin
munin-node-2.0.69              Node-specific part of Munin
```


----------



## Alain De Vos (Apr 27, 2022)

I tried munin+nginx but failed big time:
Here i share how i started spawn-fcgi:

```
spawn-fcgi -s /var/run/munin/fastcgi-graph.sock -U 80 -u 842 -g 842 /usr/local/www/cgi-bin/munin-cgi-graph
spawn-fcgi -s /var/run/munin/fastcgi-html.sock  -U 80 -u 842 -g 842 /usr/local/www/cgi-bin/munin-cgi-html
```
This is my nginx.conf:

```
#MUNIN
    server {
        listen      127.0.0.1:33331;
        server_name 127.0.0.1:33331;
        root /usr/local/www/munin/;
        allow 127.0.0.1;
        deny all;
        autoindex on;

        location ^~ /usr/local/www/cgi-bin/ {
            fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_pass unix:/var/run/munin/fastcgi-graph.sock;
            include fastcgi_params;
    }

    location /munin/static/ {
            alias /usr/local/etc/munin/static/;
    }

    location /munin/ {
            fastcgi_split_path_info ^(/munin)(.*);
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_pass unix:/var/run/munin/fastcgi-html.sock;
            include fastcgi_params;
    }
       
       
    }
```

If someone sees a mistake ?
I have the impression spawn-fcgi dies ?


----------



## Phishfry (Apr 27, 2022)

Do you really need cgi? I assume you have the basic static site up and running now?



Alain De Vos said:


> Thanks for the info , but it differs alot from this one,


Yes another CGI example.
Try the most basic first.

graph_strategy cron
html_strategy cron

Then move to bling.


----------



## Phishfry (Apr 27, 2022)

I know from another thread that you want fast monitoring not cron. I get that.

But munin is not all that. It is a Linux based program so every plugin works on that.
For FreeBSD not so much.

So instead of wasting time on CGI look at what static does and lacks.
FreeBSD vs. Linus monitoring.
You will see you have alot of tuning to do. Our disk name is ada not sda. ect.ect.ect.
The basic plugins take a lot of tuning. Just wanted to let you know. This is good old school stuff.
Not unbearable but takes time.
Auto install plugins just gives a a overview of what works OOB. Give it a try.
You will probably run away laughing in insanity. But bear down and the plugins are great.
They just need a BSD touch. Here is something to save you some time.








						GitHub - farrokhi/freebsd-munin-plugins: A set of FreeBSD specific plugins for Munin
					

A set of FreeBSD specific plugins for Munin. Contribute to farrokhi/freebsd-munin-plugins development by creating an account on GitHub.




					github.com
				



My Chelsio's work from the basic plugins and the stats available are impressive.
Some area's the plugins shine others will never work on FreeBSD.
That is just the system plugins that ship with munin.


----------



## Alain De Vos (Apr 27, 2022)

Phishfry said:


> Do you really need cgi? I assume you have the basic static site up and running now?
> 
> 
> Yes another CGI example.
> ...


I use fcron instead of cron. But that should not be the problem. I see maybe i missed copying some .sample files to there non-sample versions.


----------



## Alain De Vos (Apr 27, 2022)

I have a minor breakthrough, this page is visible : 


			http://127.0.0.1:13000/munin/static/definitions.html


----------



## Alain De Vos (Apr 27, 2022)

One babystep further

```
/usr/local/bin/munin-cron --debug
```
Creates a lot of rrd files in :

```
/var/munin/ap-ports-job-04/
```
No somehow these rrd files must be converted to some visible html/images.
I seem to have:

```
/usr/local/www/munin/ap-ports-job-04/ap-ports-job-04/smart_ada1-week.png
```


----------



## Alain De Vos (Apr 27, 2022)

After some last tweaking everything works fine now. I post the httpd.conf file which is quite simple.

```
#Apache Cron Configuration , Virtualhost configuration
<VirtualHost 127.0.0.1:13000>
    ServerName 127.0.0.1
    ServerAlias localhost
    ServerAdmin  devosalain@ymail.com
    DocumentRoot /var/www
    Alias /munin/static/ /usr/local/etc/munin/static/
    <Directory           /usr/local/etc/munin/static/>
        Require all granted
        Options Indexes MultiViews
    </Directory>
    Alias /munin    /usr/local/www/munin/
    <Directory      /usr/local/www/munin>
        Require all granted
        Options Indexes MultiViews
    </Directory>
    CustomLog /var/log/apache2/munin.example.org-access.log combined
    ErrorLog  /var/log/apache2/munin.example.org-error.log
</VirtualHost>
```

Relevant lines in munin.conf:

```
graph_strategy cron
html_strategy cron
```

To fcron-tab i added the line:

```
@first(120s)    300s                                /usr/local/bin/munin-cron                     -u munin
```

Thanks Phishry for guiding in the good direction.


----------



## Alain De Vos (Apr 27, 2022)

PS: I have the impression "nagios" is a commercial/payable product...
Now trying zabbix.


----------



## Alain De Vos (Apr 30, 2022)

Installation of zabbix54+postgresql+apache failed. The frontend produced "rubbish".
Currently cacti,munin,netdata running.


----------



## Alain De Vos (May 16, 2022)

Currently have zabbix6+postgresql13+php80+apache24 running.
(I'll drop nagios.)


----------

