GWJ6: Out Of Place Cacti Mac OS

GWJ6: Out Of Place Cacti Mac OS
  • Lutris is an open source gaming platform. Match tiles and clear the board. Desktop sharing.
  • Have some non-FreeBSD related questions, or want just to chit-chat about anything that is not related to FreeBSD? This is the forum for you. Note: this is NOT a forum for technical questions about non-FreeBSD operating systems!
This is on a Cacti 0.8.8 machine running RHEL6 as a VM.All graphs have stopped graphing, but it looks like data is getting recorded to the RRDs, at least at first glance.

View Nodir Fayzullaev’s profile on LinkedIn, the world’s largest professional community. Nodir has 9 jobs listed on their profile. See the complete profile on LinkedIn and discover Nodir’s connections and jobs at similar companies.


One interesting thing is that some graphs stopped between 23:00 on Wednesday and 00:00 on Thursday, while others stopped at around 05:00 on Wednesday. Both of these would have been at times when I was not actively working on the machine.
CactiExample:
Interface graph
graph_image_01.png (38.11 KiB) Viewed 4478 times
I've noticed the following items in the logs:I looked at the code for spine.c, and it looks like this error is returned if it gets an EAGAIN from mysql, so the problem could be something with mysql, but I don't know what the problem would be. I did notice earlier that the mysqld process was chewing up a fair amount of CPU and memory, so I shut mysqld down and re-started it, with no significant change in behavior - mysqld would quickly chew up CPU and RAM again. For a brief period after I restarted mysqld, I saw that some RRD files were getting updated. It doesn't look like the machine is starving for CPU or memory/vmem:

Code: Select all

I have the poller log dumped out to a file for each poller run, and that also shows some interesting information. Something appears to be 1. causing poller.php to be very unhappy and 2. causing the poller run to try to exceed 300 seconds (the poller run normally completes in just a few seconds). poller.log shows things like this, in addition to thousands upon thousands of 'Waiting on 1 of 1 pollers.' messages, and the occasional 'resource temporarily unavailable' messages from rrd.php, assumingly when it tries to write to an RRD file.
An strace of the running poller.php process shows it waiting for something, until it gets killed by the next 5-minute poller run.
I activated the 'domains' and 'spikekill' plugins during the day on Wednesday, but I've deactivated both of them since, to eliminate them as variables while I work on this larger problem.
poller.php is running as 'cactiuser', and cactiuser owns all of the files in the cacti directory structure (/var/www/html/stats).
So... at this point, I'm just trying to get a handle on what's happening, and what I can do to fix it / keep it from happening again.

Cacti on a MacOSX machine

Why?

Sometimes, you want to have everything under control. Or just have some nice graphs to watch during your long idle moments. Then cacti is something for you. It will allow you to monitor various values for various machines: bandwidth use for your router, CPU or hard disk use for your server, number of logged in users for your workstation… Cacti polls it for your using SNMP and then makes some nice graphs out of it.

How?

This article will briefly guide through setting up your random Intel Mac machine running Leopard (tested here on a MBP and iMac) to turn it into a Cacti server. Note that with that, you will be able to monitor any machine or device, running MacOSX or not, Linux or not, being an actual PC or not.

Step one will be to install the necessary Linux packages through Mac Ports. If you start from scratch, download the installer from the site, install it, and then run from Terminal

You will also need to install MySQL for MacOSX from MySQL website. This will put a nifty panel in your System Preferences, make sure the MySQL engine is enabled before proceeding forward.

We will run Cacti as the cacti user on the system, so go and create it. Open System Preferences and go under the Accounts panel. Create a user named cacti, give it some password, and keep it a “Standard user”.

Now, from the Terminal, change to being the cacti user and let’s proceed onward:

Now time to deal with the database:

Change directory to the cacti directory or give the full path to cacti.sql

Gwj6: Out Of Place Cacti Mac Os Catalina

Now, edit include/config.php with the right values based on what you used above:

Data has to be polled at a regular interval, usually five minutes, so, still as cacti user, from Terminal, run

and append this line somewhere:

Now you should be able to access your Cacti server from http://localhost/cacti/ so just follow the on screen indications for a while.

Go in Configuration > Settings in the main page in the Console view, NET-SNMP version should be 5.x and RRDTool should be 1.2.x. Otherwise, you will never get any graphs.

Now we have to add some data sources.

  1. Go into Devices > Add > give the device a name, a description, and give its IP or hostname (start with localhost, it’s the easier). SNMP version 2, public should be your default choices. For my part, I have set that localhost to being a “Leopard host” (see templates below), and added those graph templates:Linux – Memory Usage, Unix – Load Average, Unix – Logged in Users, Unix – Processesand the following data queries:SNMP – Get Mounted Partitions, SNMP – Get Processor Information, SNMP – Interface Statistics, Unix – Mounted partitions.When adding the templates and queries to a host, check if they return a success or a failure (Status column). Also, you can check on top of the page to see if the host is even reachable at all (Ping Results and SNMP Information).
  2. As a second example, here is how to add a Web server to your Cacti monitoring. Add another device, I set it to “web server – apache” (see below how to import templates), device detection is set to Ping or SNMP (UDP ping).I have added the following graph templates:teMySQL – CPU Usage, teMySQL – Load Average, WebServer – Apache Statistics – Hits /s, WebServer – Apache Statistics – kBits / sand following data queries:

    SNMP – Get Mounted Partitions, SNMP – Get Processor Information, SNMP – Interface statistics.

Some things to keep in mind:

  • If you have a public server, using SNMP 1 or 2, you don’t have much possibility to securize the SNMP protocol. You might want to disable all rw access and change the community name in /etc/snmp/snmpd.conf, for instance I commented out a bunch of lines in mine:

[…]

[…]

  • Also, sometimes, you will be presented with data from a different host (usually localhost) than the host you are working on. Be careful not to add this data to your graphs! (in device / graphs views in Console)
  • Which leads me to warn you that once data has been added to a device, you still need to create a graph about it, which will instruct Cacti to try to create the graph, and not just poll the values.
  • Last point, it’s probably a good thing to browse around Cacti’s interface to really customize it to your needs. Graph trees for instance will help you make useful views for your graphs: by host, by data type, etc.

Templates

You can install some extra data presentation and fetching templates via the obvious “Import templates” in the Console view in Cacti’s GUI. I used the following templates:

  1. apachestats make sure to enable mod_status in your apache server and to copy ws_apachestats.pl into Cacti’s scripts folder.
  2. teMySQLcacti to monitor MySQL use (including innoDB)
  3. Leopard templates (I do not seem to remember where I found them, please contact me if you know about their source)

Extra templates can be found there for instance: http://www.debianhelp.co.uk/cactitemplates.htm

Result

Note that it will take some time before enough data is gathered and the graphs can start being created and displayed, be patient. Count a couple of hours.

Sources:

Gwj6: Out Of Place Cacti Mac Os 7

Because I simply didn’t invent all of that, below are the links I used as guide lines. I wrote this article because some were a bit outdated or concerned MacOSX server. Or simply because I prefer to have it all in one place.